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; $msgError = null; $listeRubrique = SendLayout::fetchAllRubriques($this, 'admin', $langue, $token); try { $adminModel->deletePublication($token, $this->getEvent()->getRouteMatch()->getParam('id_publication')); } catch (\Exception $e) { $msgError = 'errordeletepublication'; } //Envoi des variables au layout SendLayout::sendGeneral($this, $listeRubrique, 'admin', $langue, $token); if (isset($msgError)) { $this->redirect()->toRoute('admin', array('action' => 'index', 'langue' => $langue), array('query' => array('errorDltP' => $msgError))); } else { $msgSuccess = 'deletepublication'; $this->redirect()->toRoute('admin', array('langue' => $langue), array('query' => array('successDltP' => $msgSuccess))); } }
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))); }