import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

View File

@ -15,8 +15,9 @@
* @category Zend
* @package Zend_View
* @subpackage Helper
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Menu.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/**
@ -30,7 +31,7 @@ require_once 'Zend/View/Helper/Navigation/HelperAbstract.php';
* @category Zend
* @package Zend_View
* @subpackage Helper
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_View_Helper_Navigation_Menu
@ -313,32 +314,33 @@ class Zend_View_Helper_Navigation_Menu
$minDepth,
$maxDepth)
{
if (!$found = $this->findActive($container, $minDepth, $maxDepth)) {
if (!$active = $this->findActive($container, $minDepth - 1, $maxDepth)) {
return '';
}
$foundPage = $found['page'];
$foundDepth = $found['depth'];
// render children or siblings?
if (!$foundPage->hasPages()) {
// special case if active page is one below minDepth
if ($active['depth'] < $minDepth) {
if (!$active['page']->hasPages()) {
return '';
}
} else if (!$active['page']->hasPages()) {
// found pages has no children; render siblings
$foundPage = $foundPage->getParent();
} else if (is_int($maxDepth) && $foundDepth +1 > $maxDepth) {
$active['page'] = $active['page']->getParent();
} else if (is_int($maxDepth) && $active['depth'] +1 > $maxDepth) {
// children are below max depth; render siblings
$foundPage = $foundPage->getParent();
$active['page'] = $active['page']->getParent();
}
$ulClass = $ulClass ? ' class="' . $ulClass . '"' : '';
$html = $indent . '<ul' . $ulClass . '>' . self::EOL;
foreach ($foundPage as $page) {
if (!$this->accept($page)) {
foreach ($active['page'] as $subPage) {
if (!$this->accept($subPage)) {
continue;
}
$liClass = $page->isActive(true) ? ' class="active"' : '';
$liClass = $subPage->isActive(true) ? ' class="active"' : '';
$html .= $indent . ' <li' . $liClass . '>' . self::EOL;
$html .= $indent . ' ' . $this->htmlify($page) . self::EOL;
$html .= $indent . ' ' . $this->htmlify($subPage) . self::EOL;
$html .= $indent . ' </li>' . self::EOL;
}
@ -636,4 +638,4 @@ class Zend_View_Helper_Navigation_Menu
return $this->renderMenu($container);
}
}
}
}