<?
// This ensures all code knows it's being called by the bandTopia app
// If this variable is missing when another page is loaded.  It will redirect to bandTopia home.
define('IN_BANDTOPIA', "You're here!!!");

ini_set("display_errors","1");
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);

include("../include/config.php");

include(INCLUDE_PATH."pageStart.php");

$staffArray = array(2,4);

if(!in_array($_SESSION['UserTypeId'],$staffArray)) 
{
	header("Location: /index.php");
}

// Set main html page to use for page
$template -> set_filenames(array(
	"body" => SERVER_PATH."admin/template/main.htm"));
	
// Start Navigation
$nav = '<a href="index.php">Admin Home</a>';

if(defined('LOGGEDIN')) {
	$template -> assign_block_vars("logged_in", array());
	$staffArray = array(2,4);

	if(in_array($_SESSION['UserTypeId'],$staffArray)) 
	{
		$template -> assign_block_vars("logged_in.staff_user", array());
	}
}
else {
	$template -> assign_block_vars("logged_out", array());
}

/******************************************************/
/*  Main Page                                         */
/******************************************************/
if($action == 'main')
{
	$template -> assign_block_vars("page_main",array());
	
	$template -> assign_block_vars("page_main.account_admin", array());
	
	$template -> assign_block_vars("page_main.billing_admin", array());
	
//	$template -> assign_block_vars("page_main.artist_admin",array());
	
	if(ADMIN_FULL == "admin" || ADMIN_USER == "radio") {
		//$template -> assign_block_vars("page_main.radio_admin",array());
	}
	if(ADMIN_FULL == "admin" || ADMIN_USER == "agent") {
		//$template -> assign_block_vars("page_main.agent_admin",array());
	}
	
	if(ADMIN_FULL == "admin" || ADMIN_USER == "venue") {
		$template -> assign_block_vars("page_main.venue_admin",array());
	}
}
/******************************************************/
/*  Account Admin Pages
/******************************************************/
elseif($action == 'accountList' || $action == 'accountAdmin')
{
	include(MODULE_PATH.'admin/accountAdmin.php');
}
/******************************************************/
/*  User Admin Page
/******************************************************/
elseif($action == 'userList' || $action == 'userAdmin')
{
	include(MODULE_PATH.'admin/userAdmin.php');
}
/******************************************************/
/*  Artist Admin Page
/******************************************************/
elseif($action == 'artistList' || $action == 'artistAdmin')
{
	include(MODULE_PATH."admin/artistAdmin.php");
}
/******************************************************/
/*  Radio Admin Page
/******************************************************/
elseif($action == 'radio')
{
	include(FUNCTION_PATH."radioadmin.php");
}
/******************************************************/
/*  Agent Admin Page
/******************************************************/
elseif($action == 'agent')
{
	include(FUNCTION_PATH."agentadmin.php");
}
/******************************************************/
/*  Staff Admin Page
/******************************************************/
elseif($action == 'staff')
{
	include(FUNCTION_PATH."staffadmin.php");
}
/******************************************************/
/*  Venue Admin Page
/******************************************************/
elseif($action == 'venue')
{
	include(FUNCTION_PATH."venueadmin.php");
}
/******************************************************/
/*  Error Page                                        */
/******************************************************/
else
{
	$template -> assign_block_vars("page_error",array());
	$template -> assign_block_vars("page_error.action", array());
}
if($action != 'login')
{
	$template -> assign_block_vars("logout", array());
}

$template->assign_var('NAV',$nav);

include(INCLUDE_PATH."pageend.php");
?>