<?php
class cAdmin extends cBase {
	protected $cAdminUser;
	
	function cAdmin($tabinit=0) {
		parent::cBase($tabinit);
		$cAdminUser = new cAdminUser();
	}
	
	function create_menu() {
		cPage::addscript(PAGE.'js/dropdowntabs.js');
		$amenu = new cDiv('amenu', 'bluetabs');
		
		$alist = new cList(false);
		$alink[] = new cLink('##', 'Home', '', '', '', makeattr('rel', 'dropmenu1_b'));
		$alink[] = new cLink('##', 'Users', '', '', '', makeattr('rel', 'dropmenu2_b'));
		$alink[] = new cLink('##', 'Resources', '', '', '', makeattr('rel', 'dropmenu3_b'));
		$alink[] = new cLink('##', 'Look Items', '', '', '', makeattr('rel', 'dropmenu4_b'));
		$alink[] = new cLink('##', 'Items Variant', '', '', '', makeattr('rel', 'dropmenu5_b'));
		$alink[] = new cLink('##', 'Avatars', '', '', '', makeattr('rel', 'dropmenu6_b'));
		$alist->addlistitems( $alink );
		$amenu->addchild($alist);
		
		$div[0] = new cDiv('dropmenu1_b', 'dropmenudiv_b', 'width: 150px;');
		$div[1] = new cDiv('dropmenu2_b', 'dropmenudiv_b');
		$div[2] = new cDiv('dropmenu3_b', 'dropmenudiv_b', 'width: 150px;');
		$div[3] = new cDiv('dropmenu4_b', 'dropmenudiv_b', 'width: 150px;');
		$div[4] = new cDiv('dropmenu5_b', 'dropmenudiv_b', 'width: 150px;');
		$div[5] = new cDiv('dropmenu6_b', 'dropmenudiv_b', 'width: 150px;');
		
		$div[0]->addchild( new cAjaxLink('ajax_clear_admin();', 'Init') );
		$div[0]->addchild( new cAjaxLink('ajax_session_close();', 'Close Session') );
		$div[1]->addchild( new cAjaxLink('ajax_user_add();', 'Add' ) );
		$div[1]->addchild( new cAjaxLink('ajax_user_list();', 'Edit/Erase' ) );
		$div[2]->addchild( new cAjaxLink('ajax_link_add();', 'Add' ) );
		$div[2]->addchild( new cAjaxLink('ajax_link_list();', 'Edit/Erase' ) );
		$div[3]->addchild( new cAjaxLink('ajax_sponsor_add();', 'Add' ) );
		$div[3]->addchild( new cAjaxLink('ajax_sponsor_list();', 'Edit/Erase' ) );
		$div[4]->addchild( new cAjaxLink('ajax_member_add();', 'Add' ) );
		$div[4]->addchild( new cAjaxLink('ajax_member_list();', 'Edit/Erase' ) );
		$div[5]->addchild( new cAjaxLink('ajax_news_add();', 'Add' ) );
		$div[5]->addchild( new cAjaxLink('ajax_news_list();', 'Edit/Erase' ) );
		
		$script = "<script type=\"text/javascript\">tabdropdown.init(\"amenu\");</script>\n";
		$ainfo = new cDiv('ainfo');
		$acontent = new cDiv('acontent');
		$this->pl( $amenu->render().renders($div).$script.$ainfo->render().$acontent->render() );
	}
	
	function ajax_clear_admin() {
		$objResponse = new xajaxResponse();
		$objResponse->clear('ainfo', 'innerHTML');
		$objResponse->clear('acontent', 'innerHTML');
		return $objResponse;
	}
	
	function ajax_session_close() {
		$objResponse = new xajaxResponse();
		session_destroy();
		$objResponse->redirect(ADMIN_PATH);
		return $objResponse;
	}
}
?>