51 lines
1.7 KiB
PHP

<?php
class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
{
/**
* Créer le menu en fonction des besoins et des paramètres en entrée
* @param Zend_Controller_Request_Abstract $request
*/
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
$siret = $request->getParam('siret', null);
$id = $request->getParam('id', 0);
if (empty($siret) && empty($id)) {
require_once 'Scores/SessionEntreprise.php';
$session = new SessionEntreprise($siret, $id);
$siret = $session->getSiret();
$id = $session->getId();
}
$layout = Zend_Layout::getMVCInstance();
if ($layout->isEnabled() && $request->getControllerName()!='print')
{
//Génération du menu
require_once 'Scores/Menu.php';
$computeMenu = new Menu($siret, $id);
$menu = $computeMenu->getMenu();
$view = $layout->getView();
$view->navigation($menu);
//Génération identifiant Menu
$view->menuId = $computeMenu->getIdMenu($request->getControllerName(), $request->getActionName());
//Gestion affichage Lien Print / PDF / XML
require_once 'Scores/PagePrint.php';
$page = new PagePrint($request->getControllerName(), $request->getActionName());
if ($page->exportable('print')){
$view->print = $page->filename('print', $request->getParams());
}
if ($page->exportable('pdf')){
$view->pdf = $page->filename('pdf', $request->getParams());
}
if ($page->exportable('xml')){
$view->xml = $page->filename('xml', $request->getParams());
}
}
//Icone d'aide
if ($layout->isEnabled() && $request->getControllerName()!='recherche')
{
$view->aide = true;
}
}
}