This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/lib/menu.php
2011-01-14 01:45:19 +11:00

50 lines
1.1 KiB
PHP

<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/lib/menu.php,v 1.2 2009/04/19 04:03:05 wurley Exp $
/**
* @package leenooksApp
* @author Deon George
*
* Abstract class which represents the Menu view ; the draw() method
* must be implemented by subclasses
*
* @see Menu_HTML
*/
abstract class Menu {
# Datastore server represented by this tree
protected $index = null;
protected function __construct($index) {
$this->index = $index;
}
static public function getInstance($index) {
$menu = get_cached_item($index,'menu');
if (! $menu) {
$menu = $_SESSION[APPCONFIG]->getValue('appearance','menu');
eval('$menu = new '.$menu.'($index);');
set_cached_item($index,'menu','null',$menu);
}
return $menu;
}
/**
* Get the server Object for this tree
*
* @return object Server Object for this tree
*/
protected function getServer() {
return $_SESSION[APPCONFIG]->getServer($this->index);
}
public function getDatastore() {
return isset($_SESSION[APPCONFIG]->datastore->object[$this->index]) ? $_SESSION[APPCONFIG]->datastore->object[$this->index] : null;
}
/**
* Displays the Menu
*/
abstract public function draw();
}
?>