Gestion pages active et affichage du menu pour les pages invisible
This commit is contained in:
parent
3694bd6515
commit
6c9989f936
@ -2,15 +2,18 @@
|
||||
<div class="sidebar-nav navbar-collapse">
|
||||
<ul id="side-menu" class="nav in">
|
||||
<li class="sidebar-head"><strong><?=$this->MenuLabel?></strong></li>
|
||||
<?php foreach ($this->navigation()->getContainer() as $page) {?>
|
||||
<li class="<?php if ($page->isActive(true)) { echo 'active'; } ?>">
|
||||
<a href="<?=$page->getHref()?>" class="<?php if ($page->isActive(true)) { echo 'active'; } ?>">
|
||||
<?=$page->label?><?php if ($page->hasPages()) {?><span class="fa arrow"></span><?php }?></a>
|
||||
<?php if ($page->hasPages()) {?>
|
||||
<?php foreach ($this->navigation()->getContainer() as $p) {?>
|
||||
<?php $pageVisibleNb = count($p->findAllBy('visible', true));?>
|
||||
<li class="<?php if ($p->isActive(true)) { echo 'active'; } ?>">
|
||||
<a href="<?=$p->getHref()?>" class="<?php if ($p->isActive(true)) { echo 'active'; } ?>">
|
||||
<?=$p->label?><?php if ($pageVisibleNb > 0) {?><span class="fa arrow"></span><?php }?></a>
|
||||
<?php if ($pageVisibleNb > 0) {?>
|
||||
<ul class="nav nav-second-level collapse" aria-expanded="false">
|
||||
<?php foreach ( $page->getPages() as $child ) {?>
|
||||
<?php foreach ( $p->getPages() as $child ) {?>
|
||||
<?php if ($child->isVisible()) {?>
|
||||
<li><a class="<?php if ($child->isActive(true)) { echo 'active'; } ?>" href="<?=$child->getHref()?>">
|
||||
<?=$child->label?></a></li>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<?php }?>
|
||||
|
@ -55,7 +55,6 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
$view->MenuLabel = 'Administration';
|
||||
$config = include APPLICATION_PATH . '/configs/menu.admin.php';
|
||||
$this->container = new Zend_Navigation($config);
|
||||
$this->setParentActive();
|
||||
$view->navigation($this->container);
|
||||
$view->headLink()
|
||||
->appendStylesheet('/libs/metisMenu/metisMenu.min.css', 'all');
|
||||
@ -68,7 +67,6 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
$view->MenuLabel = 'Recherche';
|
||||
$config = include APPLICATION_PATH . '/configs/menu.search.php';
|
||||
$this->container = new Zend_Navigation($config);
|
||||
$this->setParentActive();
|
||||
$view->navigation($this->container);
|
||||
$view->headLink()
|
||||
->appendStylesheet('/libs/metisMenu/metisMenu.min.css', 'all');
|
||||
@ -81,7 +79,6 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
$view->MenuLabel = 'Mon compte';
|
||||
$config = include APPLICATION_PATH . '/configs/menu.user.php';
|
||||
$this->container = new Zend_Navigation($config);
|
||||
$this->setParentActive();
|
||||
$view->navigation($this->container);
|
||||
$view->headLink()
|
||||
->appendStylesheet('/libs/metisMenu/metisMenu.min.css', 'all');
|
||||
@ -94,7 +91,6 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
$view->MenuLabel = 'Informations légales';
|
||||
$config = include APPLICATION_PATH . '/configs/menu.legal.php';
|
||||
$this->container = new Zend_Navigation($config);
|
||||
$this->setParentActive();
|
||||
$this->setPageParams($request);
|
||||
$view->navigation($this->container);
|
||||
$view->headLink()
|
||||
@ -163,23 +159,11 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
|
||||
|
||||
Zend_Registry::get('firebug')->info('PLUGIN MENU - END');
|
||||
}
|
||||
|
||||
protected function setParentActive()
|
||||
{
|
||||
if ($this->container->hasPages()) {
|
||||
foreach($this->container->getPages() as $head) {
|
||||
// Active on parent if children
|
||||
if ($head->hasChildren()) {
|
||||
foreach($head->getPages() as $page) {
|
||||
if ($page->isActive()) {
|
||||
$head->setActive();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set specific page params
|
||||
* @param Zend_Controller_Request_Abstract $request
|
||||
*/
|
||||
protected function setPageParams($request)
|
||||
{
|
||||
if ($this->container->hasPages()) {
|
||||
|
Loading…
Reference in New Issue
Block a user