Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/leftdiv.php
<?php
	/* This file controls the action of the buttons on the left side 
	of the screen.  As of 18 Mar 2007, all html has been removed from this file.
	This file still requires globals to be turned on.

	C. Carl Peterson hide@address.com	2005-2007 
	Released under the GPL.account*/
// initialize left button status
if(!isset($lb_status["showLoc"])){ $lb_status['showLoc']="off"; }
if(!isset($lb_status["cr_accounts"])){ $lb_status['cr_accounts']="off"; }
if(!isset($lb_status["vw_group"])){ $lb_status['vw_group']="off"; }
if(!isset($lb_status["vw_radiusprofile"])){ $lb_status['vw_radiusprofile']="off"; }
if(!isset($lb_status["vw_accounts"])){ $lb_status['vw_accounts']="off"; }
if(!isset($lb_status["vw_useful_accounts"])){ $lb_status['vw_useful_accounts']="off"; }
if(!isset($lb_status["billingplan"])){ $lb_status['billingplan']="off"; } 
if(!isset($lb_status["usermanagement"])){ $lb_status['usermanagement']="off"; }
if(!isset($lb_status["stat"])){ $lb_status['stat']="off"; }
if(!isset($lb_status["configuration"])){ $lb_status['configuration']="off"; }
if(!isset($lb_status["portal_configuration"])){ $lb_status['portal_configuration']="off"; }
if(!isset($lb_status["db_mgt"])){ $lb_status['db_mgt']="off"; }
//if(!isset($lb_status["radius"])){ $lb_status['radius']="off"; }



// set a couple global (to this page) options so we don't have to keep setting them
$lb_head['action']="phpmyprepaid.php";
$lb_head['method']="post";
$lb_foot['type']="submit";
$lb_foot['class']="leftButton";
$lb_foot['name']="submit";
$lb_img['class']="leftImage";
//$lb_center['lbstat']="$lb_status";

// begin left button "Show Locations"
$lb_center['buttonID']="showLoc";
$lb_foot['value']="Show Locations";
$lb_img['img']="images/location.png";

// put the button into an array
$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);

leftbutton($lb); // display the button
unset($lb);
// end left button showloc
// begin showloc dropdown
if(($buttonID == "showLoc") or ($_SESSION['drop'] == "showLoc")){
	$_SESSION['drop'] = "showLoc";
}
if($lb_status['showLoc']=="on"){
	
	$result = getLocationNameHeader($oreon->user);
	while ($row= $oreon->database->database->fetch_object($result)) {
		$array[] = $row;
		$id = ($row->ID);
		$loc = ($row->LocationName);
		
			/* this is one button. for each result, a new button is created.
			head will write action and method to the form tag.

			center will write as many hidden tags as you give it here.
			
			foot will write type, class, name, and loc into the submit tag.
			loc is what displays on the submit button.  Perhaps a bad name..

			CP
			 */
		
		
		$dd_head['action']="phpmyprepaid.php";
		$dd_head['method']="post";
		
		$dd_center['buttonID']="location_selected";
		$dd_center['locID']="$id";
		$dd_center['LocationName']="$loc";
		//$dd_center['lb_status']="$lb_status";
		
		$dd_foot['type']="submit";
		$dd_foot['class']="leftDrop";
		$dd_foot['name']="submit";
		$dd_foot['loc']="$loc";
		
		// end of the button
		// put the button into an array
		
		$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
		
		
		
	}
	
	dropdown($dd);
	unset($dd);
	unset($dd_head);
	unset($dd_center);
	unset($dd_foot);
}
// end of the showloc dropdown
// begin left button create accounts
         $lb_center['buttonID']="cr_accounts";
$lb_foot['value']="Create Accounts";
$lb_img['img']="images/account.png";

// put the button into an array
$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);

leftbutton($lb); // display the button
unset($lb);
// end left button cr_accounts
// begin cr_accounts dropdown

if(($buttonID == "cr_accounts") or ($_SESSION['drop'] == "cr_accounts")){
	$_SESSION['drop'] = "cr_accounts";
}
if($lb_status['cr_accounts']=="on"){
		/* These are the buttons for account
			type.  To add another, just add another $btn[].
			Because they are now in an array, it 
		will be easy to add them to the 
		database so that it is easy to configure
		different account types.
		when moving to a db, use the format for
		the db driven dropdowns above which 
		will allow us to have multiple hidden
		tags per button.  CP
		 */
	unset($btn);
	$btn['timed']="Timed Accounts";
	$btn['octets']="Octets Accounts";
	$btn['expiration']="Expiration Accounts";
	$btn['subscription_time']="Subscriber Time";
	$btn['subscription_octets']="Subscriber Octets";
	$btn['subscription_expiration']="Subscriber Expiration";
	$btn['subscription_mac']="Mac Account";
	
	//print_r($btn);
	
	foreach ($btn as $bid=>$value){
		
		// this is one button
		
		$dd_head['action']="phpmyprepaid.php";
		$dd_head['method']="post";
		$dd_center['buttonID']="$bid";
		$dd_foot['type']="submit";
		$dd_foot['class']="leftDrop";
		$dd_foot['name']="submit";
		$dd_foot['loc']="$value";

		// end of the single button
		// put the button into an array
		
		$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
	}
	dropdown($dd); // display the dropdown
	unset($dd);
	unset($dd_head);
	unset($dd_center);
	unset($dd_foot);
	unset($btn);
}


if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
$lb_center['buttonID']="vw_radiusprofile";
$lb_foot['value']="Radius profile";
$lb_img['img']="images/radiusprofile.png";
$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
leftbutton($lb); // display the button
unset($lb);
// End left button radius profile management
// Begin radius profile managment dropdown
if(($buttonID == "vw_radiusprofile") or ($_SESSION['drop'] == "vw_radiusprofile")){
	$_SESSION['drop'] = "vw_radiusprofile";
}
if($lb_status['vw_radiusprofile']=="on"){
	$btn['cr_radiusprofile']="Create radius profile";
	
	if (!is_array($btn)) { die("<p class=\"error\">btn is not an array!  We must die</p>"); }
	foreach ($btn as $bid=>$value){
		$dd_head['action']="phpmyprepaid.php";
		$dd_head['method']="post";
		$dd_center['buttonID']="$bid";
		$dd_foot['type']="submit";
		$dd_foot['class']="leftDrop";
		$dd_foot['name']="submit";
		$dd_foot['loc']="$value";
		// end of single button
		// put the button into an array

		$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
	}
	dropdown($dd); // display the dropdown
	unset($dd);
	unset($dd_head);
	unset($dd_center);
	unset($dd_foot);
	unset($btn);
}


					 
// End Radius profile managment dropdown
}



if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
// End cr_account dropdown
// Begin left button group management
$lb_center['buttonID']="vw_group";
$lb_foot['value']="Group management";
$lb_img['img']="images/group.png";

//	echo"<p>test</p>";
// put the button into an array
$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
leftbutton($lb); // display the button
unset($lb);
// End left button group management
// Begin group managment dropdown
if(($buttonID == "vw_group") or ($_SESSION['drop'] == "vw_group")){
	$_SESSION['drop'] = "vw_group";
}
if($lb_status['vw_group']=="on"){
	$btn['cr_group']="Create groups";
	$btn['choose_user_group']="User groups";
	
	if (!is_array($btn)) { die("<p class=\"error\">btn is not an array!  We must die</p>"); }
	foreach ($btn as $bid=>$value){
		$dd_head['action']="phpmyprepaid.php";
		$dd_head['method']="post";
		$dd_center['buttonID']="$bid";
		$dd_foot['type']="submit";
		$dd_foot['class']="leftDrop";
		$dd_foot['name']="submit";
		$dd_foot['loc']="$value";
		// end of single button
		// put the button into an array

		$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
	}
	dropdown($dd); // display the dropdown
	unset($dd);
	unset($dd_head);
	unset($dd_center);
	unset($dd_foot);
	unset($btn);
}


					 
// End Group managment dropdown
}


// begin left button view accounts
$lb_center['buttonID']="vw_accounts";
$lb_foot['value']="View Accounts";
$lb_img['img']="images/view.png";
// put the button into an array
$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);

leftbutton($lb); // display the button
unset($lb);
// end left button view accounts

if(($buttonID == "vw_accounts") or ($_SESSION['drop'] == "vw_accounts")){
	$_SESSION['drop'] = "vw_accounts";
}
if($lb_status['vw_accounts']=="on"){
		/* These are the buttons for account
			veiwing.  To add another, just add another.
			Because they are now in an array, it
			will be easy to add them to the
			database so that it is easy to configure
			different account views.  See the note about db 
			format above.  CP
		 */
	unset($btn);
	$btn['timed_accounts']="Timed Accounts";
	$btn['octets_accounts']="Octets Accounts";
	$btn['expiration_accounts']="Expiration Accounts";
	$btn['subscription_time_accounts']="Subscribers Times";
	$btn['subscription_octets_accounts']="Subscribers Octets";
	$btn['subscription_expiration_accounts']="Subscribers Expiration";
	$btn['subscription_mac_accounts']="Subscribers Mac";
	
	if (!is_array($btn)) { die("<p class=\"error\">btn is says it is not an array!  We must die</p>"); }
	foreach ($btn as $bid=>$value){
		
		// this is one button
		
		$dd_head['action']="phpmyprepaid.php";
		$dd_head['method']="post";
		$dd_center['buttonID']="$bid";
		$dd_foot['type']="submit";
		$dd_foot['class']="leftDrop";
		$dd_foot['name']="submit";
		$dd_foot['loc']="$value";
		
		// end of the button
		// put the button into an array

		$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
	}
	dropdown($dd); // display the dropdown
	unset($dd);
	unset($dd_head);
	unset($dd_center);
	unset($dd_foot);
	unset($btn);
	
}



// begin left button view useful accounts
$lb_center['buttonID']="vw_useful_accounts";
$lb_foot['value']="Useful View Accounts";
$lb_img['img']="images/view_useful.png";
// put the button into an array
$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);

leftbutton($lb); // display the button
unset($lb);
// end left button view accounts

if(($buttonID == "vw_useful_accounts") or ($_SESSION['drop'] == "vw_useful_accounts")){
	$_SESSION['drop'] = "vw_useful_accounts";
}
if($lb_status['vw_useful_accounts']=="on"){
		/* These are the buttons for account
			veiwing.  To add another, just add another.
			Because they are now in an array, it
			will be easy to add them to the
			database so that it is easy to configure
			different account views.  See the note about db 
			format above.  CP
		 */
	unset($btn);
	$btn['unused_account']="Unused Account";
	$btn['partialy_account']="Partialy Used Account";
	$btn['con_users']="Connected Now";
	$btn['today_users']="Today";
	$btn['week_users']="This Week";
	$btn['month_users']="This Month";
	$btn['badusers']="Badusers";
	$btn['failedlogins']="Failed logins";
	
	if (!is_array($btn)) { die("<p class=\"error\">btn is says it is not an array!  We must die</p>"); }
	foreach ($btn as $bid=>$value){
		
		// this is one button
		
		$dd_head['action']="phpmyprepaid.php";
		$dd_head['method']="post";
		$dd_center['buttonID']="$bid";
		$dd_foot['type']="submit";
		$dd_foot['class']="leftDrop";
		$dd_foot['name']="submit";
		$dd_foot['loc']="$value";
		
		// end of the button
		// put the button into an array

		$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
	}
	dropdown($dd); // display the dropdown
	unset($dd);
	unset($dd_head);
	unset($dd_center);
	unset($dd_foot);
	unset($btn);
	
}



if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
	// begin left button "billing plan"
	$lb_center['buttonID']="billingplan";
	$lb_foot['value']="Billing Plan";
	$lb_img['img']="images/billing.png";
	
	// put the button into an array
	$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
	
        leftbutton($lb); // display the button
	unset($lb);
        // end left button "billing plan"
	
	if(($buttonID == "billingplan") or ($_SESSION['drop'] == "billingplan")){
		$_SESSION['drop'] = "billingplan";
	}
	if($lb_status['billingplan']=="on"){
		/* These are the buttons for setting up billing plans

			CP
		 */
		unset($btn);
		$btn['add_tp']="Add Billing Plan";
		$btn['mod_tp']="Modify Billing Plan";
		$btn['del_tp']="Delete Billing Plan";
		
		foreach ($btn as $bid=>$value){
			
			// this is one button
			
			$dd_head['action']="phpmyprepaid.php";
                        $dd_head['method']="post";
			$dd_center['buttonID']="$bid";
			$dd_foot['type']="submit";
			$dd_foot['class']="leftDrop";
			$dd_foot['name']="submit";
			$dd_foot['loc']="$value";
			
			// end of the button
			// put the button into an array
			
			$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
                }
		dropdown($dd); // display the dropdown
		unset($dd);
		unset($dd_head);
		unset($dd_center);
		unset($dd_foot);
		unset($btn);
		
	}
	
}
if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
	// begin left button "user management"
	$lb_center['buttonID']="usermanagement";
	$lb_foot['value']="User management";
	$lb_img['img']="images/user.png";
	
	// put the button into an array
	$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
	
	leftbutton($lb); // display the button
	unset($lb);
	// end left button "user management"
	
	if(($buttonID == "usermanagement") or ($_SESSION['drop'] == "usermanagement")){
		$_SESSION['drop'] = "usermanagement";
	}
	if($lb_status['usermanagement']=="on"){
		/* These are the buttons for user addition and modification.
		
			CP
		 */
		unset($btn);
		$btn['add_user']="Add user";
		$btn['mod_user']="Modify user";
		$btn['del_user']="Delete User";
		$btn['mod_user_loc']="Manage user location";
		
		
		foreach ($btn as $bid=>$value){
			
			// this is one button
			
			$dd_head['action']="phpmyprepaid.php";
                        $dd_head['method']="post";
			$dd_center['buttonID']="$bid";
			$dd_foot['type']="submit";
                        $dd_foot['class']="leftDrop";
			$dd_foot['name']="submit";
			$dd_foot['loc']="$value";
			
			// end of the button
			// put the button into an array
			
			$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
		}
                dropdown($dd); // display the dropdown
		unset($dd);
		unset($dd_head);
		unset($dd_center);
		unset($dd_foot);
		unset($btn);
		
		
		
	}
}

if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
	// begin left button "Statistics"
	$lb_center['buttonID']="stat";
	$lb_foot['value']="Statistics";
	$lb_img['img']="images/stat.png";

	// put the button into an array
         $lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
	
	leftbutton($lb); // display the button
	unset($lb);
	// end left button
	
	if(($buttonID == "stat") or ($_SESSION['drop'] == "stat")){
		$_SESSION['drop'] = "stat";
	}
	if($lb_status['stat']=="on"){
		/* These are the buttons for reports.
		When moving to a db, use the format for
		the db driven dropdowns above which
		will allow us to have multiple hidden
                tags per button.  CP
		 */
		unset($btn);
		$btn['useful_reports']="Useful Reports";
		$btn['general_stat']="General statistics";
		$btn['access_stat']="Access statistics";
		$btn['user_stat']="Users statistics";
		$btn['accounting']="Accounting";
		
		foreach ($btn as $bid=>$value){
			
			// this is one button

			$dd_head['action']="phpmyprepaid.php";
			$dd_head['method']="post";
			$dd_center['buttonID']="$bid";
			$dd_foot['type']="submit";
			$dd_foot['class']="leftDrop";
			$dd_foot['name']="submit";
			$dd_foot['loc']="$value";
			
                        // end of the button
			// put the button into an array
			
			$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
		}
		dropdown($dd); // display the dropdown
		unset($dd);
		unset($dd_head);
		unset($dd_center);
		unset($dd_foot);
		unset($btn);
		
		
	}
}

/*
if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
	// begin left button "Statistics"
	$lb_center['buttonID']="radius";
	$lb_foot['value']="Radius";
	$lb_img['img']="images/radius.png";

	// put the button into an array
         $lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
	
	leftbutton($lb); // display the button
	unset($lb);
	// end left button
	
	if(($buttonID == "radius") or ($_SESSION['drop'] == "radius")){
		$_SESSION['drop'] = "radius";
	}
	if($lb_status['radius']=="on"){
		unset($btn);
		$btn['radius_type']="Radius Type";
		$btn['radius_attribute']="Radius Attribute";
		$btn['sql_counter']="Radius sql counter";
		$btn['user_stat']="Users statistics";
		
		foreach ($btn as $bid=>$value){
			
			// this is one button

			$dd_head['action']="phpmyprepaid.php";
			$dd_head['method']="post";
			$dd_center['buttonID']="$bid";
			$dd_foot['type']="submit";
			$dd_foot['class']="leftDrop";
			$dd_foot['name']="submit";
			$dd_foot['loc']="$value";
			
                        // end of the button
			// put the button into an array
			
			$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
		}
		dropdown($dd); // display the dropdown
		unset($dd);
		unset($dd_head);
		unset($dd_center);
		unset($dd_foot);
		unset($btn);
		
		
	}
}
 */
if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
	// begin left button "Statistics"
	$lb_center['buttonID']="db_mgt";
	$lb_foot['value']="Database mgt";
	$lb_img['img']="images/database.png";
	
	// put the button into an array
	$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
	
	leftbutton($lb); // display the button
	unset($lb);
	// end left button
	
	if(($buttonID == "db_mgt") or ($_SESSION['drop'] == "db_mgt")){
				$_SESSION['drop'] = "db_mgt";
	}
	if($lb_status['db_mgt']=="on"){
		/* These are the buttons for reports.
			When moving to a db, use the format for
			the db driven dropdowns above which
			will allow us to have multiple hidden
			tags per button.  CP
		 */
		unset($btn);
		
		
		
	}
}

if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
	// begin left button "Configuration"
	$lb_center['buttonID']="configuration";
	$lb_foot['value']="Configuration";
	$lb_img['img']="images/config.png";
	
	// put the button into an array
	$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
		
	leftbutton($lb); // display the button
	// end left button "Configuration"
	unset($lb);
	
	if(($buttonID == "configuration") or ($_SESSION['drop'] == "configuration")){
		$_SESSION['drop'] = "configuration";
	}
	if($lb_status['configuration']=="on"){
		/* These are the buttons for system
			configuration.  To add another, just add another $btl[Y]=X.
			where Y is the button ID and X is the display name.
			Because they are now in an array, it will be easy to add them to the
			database so that it is easy to configure different account types.
			When moving to a db, use the format for the db driven dropdowns above which
			will allow us to have multiple hidden tags per button.  
			
			CP
		 */
		unset($btn);
		$btn['general_config']="General Configuration";
		if ($oreon->user->get_status()=="3" ){ // I Carried this forward but don't know what it does.  CP
			$btn['radius_config']="Radius Configuration";
			$btn['images_config']="Image Configuration";
			//$btn['ssh_config']="SSH Configuration"; disable not implemented
			$btn['mysql_config']="Mysql Configuration";
			$btn['ap_config']="Nas Configuration";
			//$btn['sms_paiement']="Sms paiement";
		} // END of if useer status 3
				
		//print_r($btn);
		
		foreach ($btn as $bid=>$value){
			
			// this is one button
					
			$dd_head['action']="phpmyprepaid.php";
			$dd_head['method']="post";
			$dd_center['buttonID']="$bid";
			$dd_foot['type']="submit";
			$dd_foot['class']="leftDrop";
			$dd_foot['name']="submit";
			$dd_foot['loc']="$value";
			
			// end of the button
			// put the button into an array
			
			$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
		}
		dropdown($dd); // display the dropdown
		unset($dd);
		unset($dd_head);
		unset($dd_center);
		unset($dd_foot);
		unset($btn);
	}
}
if ($oreon->user->get_status()=="3" or $oreon->user->get_status()=="2")
{
	// begin left button "Configuration"
	$lb_center['buttonID']="portal_configuration";
	$lb_foot['value']="Portal Configuration";
	$lb_img['img']="images/portal.png";
	
	// put the button into an array
	$lb[]= array($lb_head, $lb_center, $lb_img, $lb_foot, $lb_status);
		
	leftbutton($lb); // display the button
	// end left button "Configuration"
	unset($lb);
	
	if(($buttonID == "portal_configuration") or ($_SESSION['drop'] == "portal_configuration")){
		$_SESSION['drop'] = "portal_configuration";
	}
	if($lb_status['portal_configuration']=="on"){
		if ($oreon->user->get_status()=="3" ){ // I Carried this forward but don't know what it does.  CP
			$btn['chilli_config']="Chillispot Configuration";
			$btn['wlogin_config']="Wlogin Configuration";
			$btn['pdf_config']="Pdf Configuration";
			$btn['fck_editor']="Card Editor";
			//$btn['sms_paiement']="Sms paiement";
		} // END of if useer status 3
				
		//print_r($btn);
		
		foreach ($btn as $bid=>$value){
			
			// this is one button
					
			$dd_head['action']="phpmyprepaid.php";
			$dd_head['method']="post";
			$dd_center['buttonID']="$bid";
			$dd_foot['type']="submit";
			$dd_foot['class']="leftDrop";
			$dd_foot['name']="submit";
			$dd_foot['loc']="$value";
			
			// end of the button
			// put the button into an array
			
			$dd[]= array($dd_head, $dd_center, $dd_foot, $lb_status);
		}
		dropdown($dd); // display the dropdown
		unset($dd);
		unset($dd_head);
		unset($dd_center);
		unset($dd_foot);
		unset($btn);
	}
}
Return current item: phpMyPrepaid