Mode edition avec gestion du menu
This commit is contained in:
parent
4eb3e053ed
commit
ddead1404d
@ -5,11 +5,18 @@
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right navbar-top-links">
|
||||
<?php if ($this->MenuInput !== null) {?>
|
||||
<?php if ($this->UserModeEdit == 1) {?>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle sd-edit" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
||||
Mode Edition <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<?php if (count($this->MenuInput) > 0) {?>
|
||||
<?php foreach ($this->MenuInput as $item) {?>
|
||||
<li><a <?php if (array_key_exists('class', $item)) {?>class="<?=$item['class']?>"<?php }?>
|
||||
<?php if (array_key_exists('title', $item)) {?>title="<?=$item['title']?>"<?php }?>
|
||||
href="<?=$item['href']?>"><?=$item['label']?></a></li>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php }?>
|
||||
|
@ -29,20 +29,42 @@ class Application_Controller_Plugin_Input extends Zend_Controller_Plugin_Abstrac
|
||||
$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->MenuInput = $menu;
|
||||
}
|
||||
$view->UserModeEdit = ($identity->modeEdition === true) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
Zend_Registry::get('firebug')->info('PLUGIN INPUT - END');
|
||||
}
|
||||
|
||||
public function postDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$module = $request->getModuleName();
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
if ($request->isXmlHttpRequest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (in_array($module, array('default', 'auth'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
Zend_Registry::get('firebug')->info('PLUGIN INPUT - START');
|
||||
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if ($layout->isEnabled()) {
|
||||
$view = $layout->getView();
|
||||
// --- Menu Edition
|
||||
if ($view->UserModeEdit) {
|
||||
if (count($view->InputLinks) > 0) {
|
||||
$view->MenuInput = $view->InputLinks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Zend_Registry::get('firebug')->info('PLUGIN INPUT - END');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user