示例#1
0
 public static function findOneRubrique($controller, $liste, $idMenu, $langue, $token, $idRubrique)
 {
     $rubriqueToModif = null;
     $rubriqueModel = new RubriqueModel();
     try {
         $rubriqueToModif = $rubriqueModel->findOne($idRubrique);
     } catch (\Exception $e) {
         SendLayout::traiteExceptionsOneRubrique($controller, $liste, $idMenu, $idRubrique, $langue, $token, $e);
     }
     return $rubriqueToModif;
 }
 public function rubriqueselectAction()
 {
     //Vérification token
     $token = VerifUser::tokenAction();
     $langue = $this->getEvent()->getRouteMatch()->getParam('langue');
     $rubriqueModel = new RubriqueModel();
     $data = null;
     $rubrique = null;
     //try catch du fetchAll des rubriques
     $listeRubriques = SendLayout::fetchAllRubriques($this, 0, $langue, $token);
     try {
         $rubrique = $rubriqueModel->findOne($this->getEvent()->getRouteMatch()->getParam('menu_id'));
     } catch (\Exception $e) {
         SendLayout::traiteExceptionsOneRubrique($this, $data, $this->getEvent()->getRouteMatch()->getParam('menu_id'), $this->getEvent()->getRouteMatch()->getParam('langue'), $token, $e->getMessage());
         return new ViewModel(array('rubrique' => null, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue'), $this->getEvent()->getRouteMatch()->getParam('langue'), 'exception' => $e->getMessage()));
     }
     SendLayout::sendGeneral($this, $listeRubriques, $rubrique['menu_id'], $langue, $token);
     return new ViewModel(array('rubrique' => $rubrique, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
 }
 public function rubriqueselectAction()
 {
     //$this->getResponse()->setStatusCode(404);
     $token = VerifUser::tokenAction();
     $rubriqueModel = new RubriqueModel();
     $data = null;
     $rubrique = null;
     try {
         $data = $rubriqueModel->fetchAll();
     } catch (\Exception $e) {
         SendLayout::traiteExceptionsAllRubriques($this, $data, 0, $this->getEvent()->getRouteMatch()->getParam('langue'), $token, $e->getMessage());
     }
     $this->layout()->setVariable('listeRubrique', $data);
     try {
         $rubrique = $rubriqueModel->findOne($this->getEvent()->getRouteMatch()->getParam('menu_id'));
     } catch (\Exception $e) {
         SendLayout::traiteExceptionsOneRubrique($this, $data, $this->getEvent()->getRouteMatch()->getParam('menu_id'), $this->getEvent()->getRouteMatch()->getParam('menu_id'), $this->getEvent()->getRouteMatch()->getParam('langue'), $token, $e->getMessage());
         return new ViewModel(array('rubrique' => null, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue'), $this->getEvent()->getRouteMatch()->getParam('langue'), 'exception' => $e->getMessage()));
     }
     $this->layout()->setVariable('menu_id', $rubrique['menu_id']);
     $this->layout()->setVariable('langue', $this->getEvent()->getRouteMatch()->getParam('langue'));
     $this->layout()->setVariable('token', $token);
     return new ViewModel(array('rubrique' => $rubrique, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
 }