Ejemplo n.º 1
0
 public function indexAction()
 {
     $rubriqueModel = new RubriqueModel();
     $data = $rubriqueModel->fetchAll();
     $this->layout()->setVariable('listeRubrique', $data);
     $this->layout()->setVariable('langue', 'fr');
     $this->layout()->setVariable('menu_id', $data[0]['menu_id']);
     $this->layout()->setVariable('rubrique', $data[0]);
     return new ViewModel(array('rubrique' => $data[0], 'langue' => 'fr'));
 }
Ejemplo n.º 2
0
 public function afficherPublicationAction()
 {
     $rubriqueModel = new RubriqueModel();
     $categorieModel = new CategorieModel();
     $publicationModel = new PublicationModel();
     $this->layout()->setVariable('listeRubrique', $rubriqueModel->fetchAll());
     $this->layout()->setVariable('langue', $this->getEvent()->getRouteMatch()->getParam('langue'));
     $this->layout()->setVariable('menu_id', 0);
     return new ViewModel(array('listePubli' => $publicationModel->fetchAll(), 'listeCateg' => $categorieModel->fetchAll(), 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
 }
Ejemplo n.º 3
0
 public function afficherPublicationAction()
 {
     // verification de connexion
     $token = VerifUser::tokenAction();
     // verification des rubriques
     $rubriqueModel = new RubriqueModel();
     $data = null;
     $rubrique = null;
     try {
         $data = $rubriqueModel->fetchAll();
     } catch (\Exception $e) {
         SendLayout::traiteExceptionsAllRubriques($this, $data, 'pbm', $this->getEvent()->getRouteMatch()->getParam('langue'), $token, $e->getMessage());
     }
     //verification des publications
     $publicationModel = new PublicationModel();
     $dataP = null;
     $publication = null;
     try {
         $dataP = $publicationModel->fetchAll();
         $dataP = $publicationModel->fetchAllByDate();
     } catch (\Exception $e) {
         $exceptionP = $e;
     }
     // verification des categories
     $categorieModel = new CategorieModel();
     $dataC = null;
     $categorie = null;
     try {
         $dataC = $categorieModel->fetchAll();
     } catch (\Exception $e) {
         $exceptionC = $e;
     }
     $this->layout()->setVariable('listeRubrique', $data);
     $this->layout()->setVariable('langue', $this->getEvent()->getRouteMatch()->getParam('langue'));
     $this->layout()->setVariable('menu_id', 'pbm');
     $this->layout()->setVariable('token', $token);
     if ($this->getEvent()->getRouteMatch()->getParam('trie') == 'categ') {
         $listeSup = $dataC;
     } elseif ($this->getEvent()->getRouteMatch()->getParam('trie') == 'date') {
         $listeSup = $dataP;
     }
     if (isset($listeSup)) {
         if (isset($exceptionP) && isset($exceptionC)) {
             return new ViewModel(array('trie' => $this->getEvent()->getRouteMatch()->getParam('trie'), 'excC' => $exceptionC, 'excP' => $exceptionP, 'listePubli' => $dataP, 'listeSup' => $listeSup, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
         } elseif (isset($exceptionC)) {
             return new ViewModel(array('trie' => $this->getEvent()->getRouteMatch()->getParam('trie'), 'excC' => $exceptionC, 'listePubli' => $dataP, 'listeSup' => $listeSup, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
         } elseif (isset($exceptionP)) {
             return new ViewModel(array('trie' => $this->getEvent()->getRouteMatch()->getParam('trie'), 'excP' => $exceptionP, 'listePubli' => $dataP, 'listeSup' => $listeSup, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
         } else {
             return new ViewModel(array('trie' => $this->getEvent()->getRouteMatch()->getParam('trie'), 'listePubli' => $dataP, 'listeSup' => $listeSup, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
         }
     } else {
         return new ViewModel(array('trie' => $this->getEvent()->getRouteMatch()->getParam('trie'), 'listePubli' => $dataP, 'msgError' => 'error', 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
     }
 }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
0
 public function rubriqueselectAction()
 {
     $rubriqueModel = new RubriqueModel();
     $data = $rubriqueModel->fetchAll();
     $this->layout()->setVariable('listeRubrique', $data);
     $rubrique = $rubriqueModel->findOne($this->getEvent()->getRouteMatch()->getParam('menu_id'));
     $this->layout()->setVariable('menu_id', $rubrique['menu_id']);
     $this->layout()->setVariable('rubrique', $rubrique);
     $this->layout()->setVariable('langue', $this->getEvent()->getRouteMatch()->getParam('langue'));
     return new ViewModel(array('rubrique' => $rubrique, 'langue' => $this->getEvent()->getRouteMatch()->getParam('langue')));
 }
Ejemplo n.º 6
0
 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')));
 }
Ejemplo n.º 7
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'));
 }
Ejemplo n.º 8
0
 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')));
 }
Ejemplo n.º 9
0
 public function deleteRubriqueAction()
 {
     //Token en brut pour tester -- Voir Mr. Salva
     $token = 'WU8nb/rCD6JgtiyxTW3ZP+s4n9Vg9liUllh5bZLoLQhAMMoCaHE72nYLQSsw12uhkgWJLDmgMmZVD+aIk6BsZw==';
     //-----------------------------------------------------------------------
     $rubriqueModel = new RubriqueModel();
     $listeRubrique = $rubriqueModel->fetchAll();
     $this->layout()->setVariable('listeRubrique', $listeRubrique);
     $this->layout()->setVariable('menu_id', 'admin');
     $langue = $this->getEvent()->getRouteMatch()->getParam('langue');
     $this->layout()->setVariable('langue', $langue);
     $idMenu = $this->getEvent()->getRouteMatch()->getParam('id_menu');
     $adminModel = new AdminModel();
     $adminModel->deleteRubrique($token, $idMenu);
     $this->redirect()->toRoute('admin', array('action' => 'index', 'langue' => $langue));
 }
 public function deletePublicationAction()
 {
     $token = VerifUser::tokenAction();
     if ($token == null) {
         $this->redirect()->toRoute('home');
     }
     $rubriqueModel = new RubriqueModel();
     $adminModel = new AdminModel();
     $langue = $this->getEvent()->getRouteMatch()->getParam('langue');
     $listeRubrique = null;
     $msgSuccess = null;
     try {
         $listeRubrique = $rubriqueModel->fetchAll();
     } catch (\Exception $e) {
         LayoutExceptions::traiteExceptionsAllRubriques($this, $listeRubrique, 'admin', $langue, $token, $e->getMessage());
     }
     try {
         $adminModel->deletePublication($token, $this->getEvent()->getRouteMatch()->getParam('id_publication'));
     } catch (\Exception $e) {
         $this->redirect()->toRoute('admin', array('action' => 'index', 'langue' => $langue, 'exSuppPublication' => $e->getMessage()));
     }
     $this->layout()->setVariable('listeRubrique', $listeRubrique);
     $this->layout()->setVariable('menu_id', 'admin');
     $this->layout()->setVariable('langue', $langue);
     $this->layout()->setVariable('token', $token);
     $msgSuccess = 'deletepublication';
     $this->redirect()->toRoute('admin', array('langue' => $langue), array('query' => array('successDltP' => $msgSuccess)));
 }
Ejemplo n.º 11
0
 public function indexAction()
 {
     $token = VerifUser::tokenAction();
     if ($token == null) {
         $this->redirect()->toRoute('home');
     }
     $successTab = $this->getSuccessAndErrors();
     $langue = $this->getEvent()->getRouteMatch()->getParam('langue');
     $rubriqueModel = new RubriqueModel();
     $publicationModel = new PublicationModel();
     $listeRubrique = null;
     $listePublications = null;
     try {
         $listeRubrique = $rubriqueModel->fetchAll();
     } catch (\Exception $e) {
         SendLayout::traiteExceptionsAllRubriques($this, $listeRubrique, 'admin', $langue, $token, $e->getMessage());
     }
     try {
         $listePublications = $publicationModel->fetchAll();
     } catch (\Exception $e) {
     }
     SendLayout::sendGeneral($this, $listeRubrique, 'admin', $langue, $token);
     return new ViewModel(array('listeRubrique' => $listeRubrique, 'listePublications' => $listePublications, 'langue' => $langue, 'successTab' => $successTab));
 }
Ejemplo n.º 12
0
 public function indexAction()
 {
     $token = VerifUser::tokenAction();
     if ($token == null) {
         $this->redirect()->toRoute('home');
     }
     $successTab = array();
     if (!empty($this->getRequest()->getQuery('successCrR', false))) {
         $successCrRub = $this->getRequest()->getQuery('successCrR', false);
     } else {
         $successCrRub = null;
     }
     if (!empty($this->getRequest()->getQuery('successCrP', false))) {
         $successCrPubli = $this->getRequest()->getQuery('successCrP', false);
     } else {
         $successCrPubli = null;
     }
     if (!empty($this->getRequest()->getQuery('successMdfR', false))) {
         $successModifRub = $this->getRequest()->getQuery('successMdfR', false);
     } else {
         $successModifRub = null;
     }
     if (!empty($this->getRequest()->getQuery('successMdfP', false))) {
         $successModifPubli = $this->getRequest()->getQuery('successMdfP', false);
     } else {
         $successModifPubli = null;
     }
     if (!empty($this->getRequest()->getQuery('successDltR', false))) {
         $successDeleteRub = $this->getRequest()->getQuery('successDltR', false);
     } else {
         $successDeleteRub = null;
     }
     if (!empty($this->getRequest()->getQuery('successDltP', false))) {
         $successDeletePubli = $this->getRequest()->getQuery('successDltP', false);
     } else {
         $successDeletePubli = null;
     }
     array_push($successTab, $successCrRub, $successCrPubli, $successModifRub, $successModifPubli, $successDeleteRub, $successDeletePubli);
     $langue = $this->getEvent()->getRouteMatch()->getParam('langue');
     $rubriqueModel = new RubriqueModel();
     $publicationModel = new PublicationModel();
     $listeRubrique = null;
     $listePublications = null;
     try {
         $listeRubrique = $rubriqueModel->fetchAll();
     } catch (\Exception $e) {
         LayoutExceptions::traiteExceptionsAllRubriques($this, $listeRubrique, 'admin', $langue, $token, $e->getMessage());
         return new ViewModel(array('listeRubrique' => $listeRubrique, 'listePublications' => $listePublications, 'langue' => $langue, 'exRubriques' => $e->getMessage()));
     }
     try {
         $listePublications = $publicationModel->fetchAll();
     } catch (\Exception $e) {
         return new ViewModel(array('listeRubrique' => $listeRubrique, 'listePublications' => $listePublications, 'langue' => $langue, 'exPublications' => $e->getMessage()));
     }
     SendLayout::sendGeneral($this, $listeRubrique, 'admin', $langue, $token);
     return new ViewModel(array('listeRubrique' => $listeRubrique, 'listePublications' => $listePublications, 'langue' => $langue, 'successTab' => $successTab));
 }