41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
class Application_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
|
|
{
|
|
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
|
{
|
|
$module = $request->getModuleName();
|
|
$controller = $request->getControllerName();
|
|
$action = $request->getActionName();
|
|
|
|
if ($module == 'default' && $controller == 'index' && $action = 'index') {
|
|
return;
|
|
}
|
|
|
|
// --- initialisation
|
|
$menu = null;
|
|
|
|
$continue = true;
|
|
if ($request->getControllerName()=='print') {
|
|
$continue = false;
|
|
}
|
|
|
|
$layout = Zend_Layout::getMVCInstance();
|
|
$view = $layout->getView();
|
|
if ($continue) {
|
|
$auth = Zend_Auth::getInstance();
|
|
if ($auth->hasIdentity()) {
|
|
$identity = $auth->getIdentity();
|
|
|
|
// --- Params User
|
|
$view->UserProfil = $identity->profil;
|
|
$view->UserModeEdit = $identity->modeEdition;
|
|
|
|
// --- Menu Edition
|
|
if ($view->UserModeEdit) {
|
|
$menu = array();
|
|
}
|
|
}
|
|
}
|
|
$view->MenuEdit = $menu;
|
|
}
|
|
} |