Esempio n. 1
0
 /**
  * Applies security checks to action request before routing.
  */
 public function route()
 {
     $action = $this->validateAction();
     /**
      * By pass security checks if requested action is public.
      */
     if (in_array($action, $this->getPublicActions())) {
         parent::fastRoute($action);
     }
     /**
      * if requester is not logged in deny access and render login page.
      */
     if (!$this->safe()) {
         $this->deny();
     }
     // access allowed.
     parent::fastRoute($action);
 }
 function beforeFilter()
 {
     $mode = $this->Session->read("Acl.Mode");
     if (!$mode) {
         $mode = 'full';
         $this->Session->write('Acl.Mode', $mode);
     }
     $this->AclMode = $mode;
     if (!$this->_isRequestAction()) {
         // Create the root nodes if they don't exist
         $acos = $this->Aco->findByAlias("ROOT");
         if (empty($acos['Aco']['alias'])) {
             $this->Aco->create(0, NULL, "ROOT");
         }
         $aros = $this->Aro->findByAlias("PUBLIC");
         if (empty($aros['Aro']['alias'])) {
             $this->Aro->create(0, NULL, "PUBLIC");
         }
     }
     parent::beforeFilter();
 }
 function __construct()
 {
     parent::__construct();
 }
Esempio n. 4
0
 /**
  * Charge l'objet, initialise les variables et récupère les
  * propiétés du SearchForm et du Grid.
  *
  * Le tableau de paramètre peut prendre les clé suivante:
  * - 'altname'         => nom de l'objet
  * - 'itemsperpage'    => le nombre d'éléments par page
  * - 'profiles'        => un tableau de profile
  * - 'template'        => template à utiliser
  * - 'title'           => titre du grid
  *
  * @param string $entity nom de l'objet
  * @param array $params tableau de paramètres
  * @return void
  */
 public function __construct($params = array())
 {
     parent::__construct($params);
     $this->_withSearhForm = in_array(GenericController::FEATURE_SEARCHFORM, $this->features);
     $this->mapping = $this->getMapping();
     foreach ($this->mapping as $property => $param) {
         if ($this->getElementType($property) == Object::TYPE_MANYTOMANY && in_array('grid', $param['usedby'])) {
             $this->nbSubGridColumns++;
         }
     }
     if ($this->_withSearhForm) {
         $this->searchForm = new SearchForm($this->clsname);
         $this->searchForm->setQuickFormAttributes(array('name' => $this->clsname, 'id' => $this->clsname));
         $this->searchForm->buildHiddenField(array('entity' => $this->clsname));
         $this->searchForm->buildHiddenField(array('altname' => $this->altname));
     }
     $this->grid = new Grid();
     if (isset($params['itemsperpage'])) {
         $this->grid->itemPerPage = $params['itemsperpage'];
     }
     if (isset($params['showPrintAction'])) {
         $this->showPrintAction = $params['showPrintAction'];
     }
     if (isset($params['showExportAction'])) {
         $this->showExportAction = $params['showExportAction'];
     }
 }
Esempio n. 5
0
 /**
  * Le constructeur prend en paramètres un tableau $params qui peut contenir
  * les valeurs suivantes:
  *
  * array(
  *     // paramètres obligatoires
  *     'clsname'     => 'Toto', // le nom de l'entité de base
  *     'action'      => 'edit', // le nom de l'action (add, edit ou del)
  *
  *     // obligatoire pour une action edit ou delete
  *     'id'          => 1, // l'id de l'objet à éditer (on peut aussi
  *                         // passer un tableau d'ids pour l'action delete)
  *
  *     // paramètres facultatifs
  *     'use_session' => true,    // si on doit utiliser le sessions
  *     'profiles'    => array(), // un tableau de profils
  *     'return_url'  => 'a.php', // l'url de retour à utiliser
  *     'title'       => 'foo',   // titre du formulaire à utiliser
  * )
  *
  * @access protected
  * @param array $params tableau de paramètres
  * @return void
  */
 public function __construct($params)
 {
     parent::__construct($params);
     $this->template = new Template();
     if (isset($params['url'])) {
         $this->url = $params['url'];
     }
     if ($this->action != GenericController::FEATURE_DELETE) {
         $this->form = new HTML_QuickForm($this->clsname . 'AddEdit');
     }
 }
 function __construct()
 {
     parent::__construct();
     $this->actions();
 }
Esempio n. 7
0
 function __construct()
 {
     parent::__construct();
     $this->template = 'mutt/views/index.php';
     $this->pageTitle = 'Welcome To Mutt-PHP';
 }