Example #1
0
 public function indexAction()
 {
     VerifUser::setTokenToDisconnect();
     $rubriqueModel = new RubriqueModel();
     $data = null;
     $cptActif = 0;
     $data = SendLayout::fetchAllRubriques($this, 'autre', 'fr', null);
     $this->layout()->setVariable('listeRubrique', $data);
     $this->layout()->setVariable('langue', 'fr');
     $this->layout()->setVariable('token', null);
     if (!empty($this->getRequest()->getQuery('erreur', false))) {
         return new ViewModel(array('langue' => 'fr', 'erreur' => $this->getRequest()->getQuery('erreur', false)));
     } else {
         //affichage de la vue
         //return new ViewModel(array('rubrique'=>$data[0],'langue'=>'fr'));
         if (!empty($data)) {
             foreach ($data as $d) {
                 if ($d['actif'] == 1) {
                     $cptActif++;
                     $this->layout()->setVariable('menu_id', $d['menu_id']);
                     return new ViewModel(array('rubrique' => $d, 'langue' => 'fr'));
                 }
             }
         }
         if (empty($data) || $cptActif == 0) {
             $this->layout()->setVariable('menu_id', 'pbm');
             $this->redirect()->toRoute('publications', array('langue' => 'fr'));
         }
     }
 }
Example #2
0
 public function disconnectAction()
 {
     VerifUser::setTokenToDisconnect();
     $token = VerifUser::tokenAction();
     if ($token == null) {
         $this->redirect()->toRoute('home');
     }
     $rubriqueModel = new RubriqueModel();
     $listeRubrique = null;
     try {
         $listeRubrique = $rubriqueModel->fetchAll();
     } catch (\Exception $e) {
         LayoutExceptions::traiteExceptionsAllRubriques($this, $listeRubrique, 'admin', $this->getEvent()->getRouteMatch()->getParam('langue'), $e->getMessage());
     }
     $this->layout()->setVariable('listeRubrique', $listeRubrique);
     $this->layout()->setVariable('menu_id', 0);
     $this->layout()->setVariable('langue', $this->getEvent()->getRouteMatch()->getParam('langue'));
     $this->layout()->setVariable('token', $token);
     $this->redirect()->toRoute('home');
 }
Example #3
0
 public function indexAction()
 {
     VerifUser::setTokenToDisconnect();
     $rubriqueModel = new RubriqueModel();
     $data = null;
     try {
         $data = $rubriqueModel->fetchAll();
     } catch (Exception $e) {
         LayoutExceptions::traiteExceptionsAllRubriques($this, $data, 'pbm', 'fr', $e->getMessage());
         //$this->redirect()->toRoute('publications', array('action' => 'afficherPublication', 'langue' => 'fr'));
         /*$this->layout()->setVariable('listeRubrique', $data);
           $this->layout()->setVariable('menu_id', 'pbm');
           $this->layout()->setVariable('langue', 'fr');
           $this->layout()->setVariable('exception', $e->getMessage());*/
         return new ViewModel(array('rubrique' => null, 'langue' => 'fr', 'exception' => $e->getMessage()));
     }
     $this->layout()->setVariable('listeRubrique', $data);
     $this->layout()->setVariable('langue', 'fr');
     $this->layout()->setVariable('menu_id', $data[0]['menu_id']);
     return new ViewModel(array('rubrique' => $data[0], 'langue' => 'fr'));
 }