Exemplo n.º 1
0
 /**
  * constructor
  * Deze constructor controleert of de gebruiker is ingelogd, is dat het geval,
  * dan wordt het ingelogde menu gecreeerd. Als de gebruiker de rechten admin heeft,
  * wordt het adminmenu gecreeerd.
  * @param string $p_sTitel De getoonde titel op het scherm
  * @param array $p_aRechten array bevat alle benodigde rechten om deze pagina op te roepen. Een lege array 
  * @throws InsufficientRightsException
  */
 public function __construct($p_sTitel, $p_aRechten)
 {
     $this->m_sTitel = $p_sTitel;
     $this->m_sHTML = '';
     $this->m_aData = array();
     $this->m_aScripts = array();
     $this->m_oSmarty = null;
     $this->m_sTemplate = '';
     if (is_array($p_aRechten)) {
         $this->m_aBenodigdeRechten = $p_aRechten;
     } else {
         $this->m_aBenodigdeRechten = array(Gebruiker::TOEGANG_GEWEIGERD);
     }
     // genereer het menu aan de hand van de gebruikerrechten
     if (Registry::exists('Bezoeker')) {
         $this->m_oGebruiker = Registry::get('Bezoeker');
         if ($this->m_oGebruiker->isIngelogd()) {
             $oValidator = InputValidator::instantiate();
             $nPagina = intVal($oValidator->getValue('page', InputValidator::SCOPE_GET | InputValidator::SCOPE_POST));
             if ($nPagina >= MenuGenerator::BEHEER) {
                 $aRechten = $this->m_oGebruiker->__get('Rechten');
                 $this->m_oMenu = MenuGenerator::genereerMenuObject(MenuGenerator::BEHEER, $aRechten);
                 if (!$this->checkRechten()) {
                     // genereer een Exception zodat dit scherm nooit per ongeluk getoond kan worden
                     throw new OnvoldoendeRechtenException('Pagina ' . $p_sTitel);
                 }
             } else {
                 $this->m_oMenu = MenuGenerator::genereerMenuObject(MenuGenerator::BEZOEKER, array());
             }
         } else {
             $this->m_oMenu = MenuGenerator::genereerMenuObject(MenuGenerator::BEZOEKER, array());
         }
     } else {
         $this->m_oGebruiker = null;
     }
 }
Exemplo n.º 2
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/menuGenerator.php';
$menuGenerator = new MenuGenerator();
$menuData = array(array("label" => "Home", "url" => "/index.php", "activeTag" => "home"), array("label" => "New Boats", "url" => "/boats/new/index.php", "activeTag" => "boats-new"), array("label" => "Used Boats", "url" => "/boats/used/index.php", "activeTag" => "boats-used"), array("label" => "Sell Your Boat", "url" => "/boats/brokerage/index.php", "activeTag" => "boats-brokerage"), array("label" => "Contact", "url" => "/contact.php", "activeTag" => "contact"));
echo $menuGenerator->getMenu($menuData);
Exemplo n.º 3
0
Arquivo: action.php Projeto: DbyD/cruk
<?php

include '../inc/config.php';
include "lib.php";
$menu = new MenuGenerator();
echo $menu->SaveAction();
Exemplo n.º 4
0
 function generateNavigationFromDir($dirPath, $dbKey = "app")
 {
     $mg = new MenuGenerator("Masters", ['core', $dbKey]);
     return $mg->processMenuArray($mg->processMenuDir($dirPath));
 }