. */ /** * Abstract implementation of the ALayout class used as base for different layouts * * Note: implementations of this class should be in the directory ../../layout/Layout.php. should start with * one upper case letter. The class' name should be the same as the filename, and images and other resources are stored in * the directory ../../layout/Layout/ */ abstract class AbstractLayout { protected $layout; // Layout class, responsible for printing things to screen protected $sideMenu; // Side menu items protected $topMenu; // Top menu items protected $pathToLayout; // Path to layout files protected $headers; // Additional headers /** * Default constructor * */ public function __construct(Layout $layout) { $this->layout = $layout; $this->sideMenu = array(); $this->headers = array(); $this->initTopMenu(); } /** * Default destructor */ public function __destruct() { } /** * Add a side menu item * * @param string link: the url of the menu item * @param string title: the title of the menu item */ public function addSideMenu($link, $title) { $c = count($this->sideMenu); $this->sideMenu[$c]['link'] = $link; $this->sideMenu[$c]['title'] = $title; } /** * Add a custom header * * @param string header line */ public function addHeader($header) { if( !in_array($header, $this->headers) ) { $this->headers[] = $header; } } /** * Add a custom javascript to the header * * @param string url of the javascript */ public function addJavascript($url) { $this->addHeader(""); } /** * Add a custom stylesheet (css) to the header * * @param string url of the stylesheet */ public function addStylesheet($url) { $this->addHeader(""); } /** * Display the beginning of the page. After this, actual content can be displayed * * To output anything to screen, use "$this->layout->echoln(...);" */ abstract public function displayTop(); /** * Display the end of the page. To be called after actual content has been send to screen * * To output anything to screen, use "$this->layout->echoln(...);" */ abstract public function displayBottom(); /** * Display login page. This is a page on itself * * To output anything to screen, use "$this->layout->echoln(...);" * * @param string url to be used in the action of the form */ abstract public function displayLogin($url); private function initTopMenu() { $this->topMenu = array(); $c = -1; $this->topMenu[++$c]['link'] = "./"; $this->topMenu[$c]['title'] = _("Home"); $this->topMenu[$c]['sub'][0]['title'] = _("Import/Tests"); $this->topMenu[$c]['sub'][0]['link'] = "./oms/import/test-config.php"; $this->topMenu[++$c]['link'] = "./events/"; $this->topMenu[$c]['title'] = _("Events"); $this->topMenu[$c]['sub'][0]['link'] = "./events/"; $this->topMenu[$c]['sub'][0]['title'] = _("Future events"); $this->topMenu[$c]['sub'][1]['link'] = "./events/?past"; $this->topMenu[$c]['sub'][1]['title'] = _("Passed events"); $this->topMenu[++$c]['link'] = "./oms/"; $this->topMenu[$c]['title'] = _("Membership"); $i=0; if ($_SESSION['sess_access'] > Access::VISITOR ){ foreach ($_SESSION['sess_access_bodyCodes'] as $BodyCode=>$accesses){ foreach ($accesses as $access=>$value){ if ( in_array($access, array("BodyName", "BodyCategory", "BodyCategoryOrder") ) ) continue; if (Access::isAccess($value) ) { $this->topMenu[$c]['sub'][$i]['title'] = _($access)." of ".$BodyCode; if ($value == Access::BOARD){ $this->topMenu[$c]['sub'][$i]['link'] = "./oms/board.php?BodyCode=".$BodyCode; }else { $this->topMenu[$c]['sub'][$i]['link'] = "./oms/index.php?BodyCode=".$BodyCode; } $i++; } } } } } } ?>