<?php

/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*\
<< ******************************************************************** >>
<< * ---------------------------------------------------------------- * >>
<< * Copyright ©2011-2012 Ozzy47                                      * >>
<< * All Rights Reserved. 											  * >>
<< * This file may not be redistributed in whole or significant part. * >>
<< * ---------------------------------------------------------------- * >>
<< * You are not allowed to use this on your server unless the files  * >>
<< * you downloaded were done so with permission.					  * >>
<< * ---------------------------------------------------------------- * >>
<< ******************************************************************** >>
\*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

// ############################# LOG ACTION ##############################
log_admin_action();
// ############################# END LOG ACTION ##########################

print_cp_header();

if ( $_REQUEST['do'] == 'newdropdown')  
{
	$vbulletin->input->clean_array_gpc('r', array(
		'childid' => TYPE_INT,
		'type'  => TYPE_STR,
		'tabid' => TYPE_INT,
	));
			
		$tabchild = $db->query_first(
        "SELECT *
        FROM " . TABLE_PREFIX . "dbtech_vbnavtabs_childs 
        WHERE  childid = ". $vbulletin->GPC['childid'] .""
        );
	{
		$head_table = $vbphrase['dbtech_vbnavtabs_add_new_dropdown_button'];
		$tabchild['enable'] = 1;
		$tabchild['tabid'] = $vbulletin->GPC['tabid'];
	}
	
	if ($vbulletin->GPC['type']=='menuitem')
	{
		$result = $db->query_read("SELECT tabid,title FROM " . TABLE_PREFIX . "dbtech_vbnavtabs WHERE  url != '[DROPDOWN TAB]'");
	}
	else
	{
		$result = $db->query_read("SELECT tabid,title FROM " . TABLE_PREFIX . "dbtech_vbnavtabs WHERE  url = '[DROPDOWN TAB]'");
	}	

	$tabparent[0]=$vbphrase['dbtech_vbnavtabs_no_asigned'];
	if ($db->num_rows($result))
	{
		while( $sourceitem = $db->fetch_array( $result )) 
		{
			$tabparent[$sourceitem['tabid']]=$sourceitem['title'];
		}
	}

	print_form_header('vbnavtabs', 'updatedropdown');
	construct_hidden_code('childid', $vbulletin->GPC['childid']);
	construct_hidden_code('type', $vbulletin->GPC['type']);
	print_table_header($head_table, 2);
	print_select_row($vbphrase['dbtech_vbnavtabs_tab_parent'], 'tabid',$tabparent,$tabchild['tabid']);
    print_yes_no_row($vbphrase['dbtech_vbnavtabs_dropdown_active'], 'enable', $tabchild['enable']);
    print_input_row($vbphrase['dbtech_vbnavtabs_dropdown_name'], 'title', $tabchild['title'],true,35);
	print_input_row($vbphrase['dbtech_vbnavtabs_dropdown_vbphrase'], 'vbphrase', $tabchild['vbphrase'],true,35);
	print_input_row($vbphrase['dbtech_vbnavtabs_dropdown_url_add'], 'url', $tabchild['url']);
    print_input_row($vbphrase['dbtech_vbnavtabs_image_dropitem'], 'image', $tabchild['image']);
	print_select_row($vbphrase['dbtech_vbnavtabs_dropdown_target'], 'target', array ('_self'=>'_self','_blank'=>'_blank','_parent'=>'_parent','_top'=>'_top'),$tab['target']);
	print_membergroup_row($vbphrase['dbtech_vbnavtabs_ug_allowed_dropdown'], "allowedusergroup",$vbulletin->options['dbtech_vbnavtabs_num_col'],array('usergroupid' => 0, 'membergroupids' => $tabchild['allowedusergroup']));
	print_membergroup_row($vbphrase['dbtech_vbnavtabs_ug_not_allowed_dropdown'], "blockedusergroup",$vbulletin->options['dbtech_vbnavtabs_num_col'],array('usergroupid' => 0, 'membergroupids' => $tabchild['blockedusergroup']));	
	print_input_row($vbphrase['dbtech_vbnavtabs_display_dropdown_order'], 'displayorder', $tabchild['displayorder'],true,35);
    print_textarea_row($vbphrase['dbtech_vbnavtabs_dropdown_notes'], 'notes', $tab['notes'], 15, 35);
	print_submit_row($vbphrase['dbtech_vbnavtabs_save']);
}    

print_cp_footer();

/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*\
<< ********************************************************************* >>
<< * Created: 19:30, Fri Nov 25th 2011                                 * >>
<< * VER: 1.0.1                                                        * >>
<< ********************************************************************* >>
\*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

?>