Skip to content

Commit

Permalink
Various navigation tree fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
roccivic committed Oct 30, 2012
1 parent 1191cab commit 89da93a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions libraries/navigation/NavigationTree.class.php
Expand Up @@ -242,6 +242,7 @@ private function _buildPath()
*/
private function _buildPathPart($path, $type2, $pos2, $type3, $pos3)
{
$retval = true;
if (count($path) > 1) {
array_shift($path); // remove 'root'
$db = $this->_tree->getChild($path[0]);
Expand Down Expand Up @@ -478,7 +479,6 @@ public function groupTree($node = null)
}
$this->groupNode($node);
foreach ($node->children as $child) {
$this->groupNode($child);
$this->groupTree($child);
}
}
Expand Down Expand Up @@ -704,7 +704,10 @@ private function _renderNode($node, $recursive = -1, $class = '')
{
$retval = '';
$paths = $node->getPaths();
if ($node->hasSiblings() || isset($_REQUEST['results'])) {
if ($node->hasSiblings()
|| isset($_REQUEST['results'])
|| $node->realParent() === false
) {
if ( $node->type == Node::CONTAINER
&& count($node->children) == 0
&& $GLOBALS['is_ajax_request'] != true
Expand Down Expand Up @@ -841,7 +844,7 @@ private function _renderNode($node, $recursive = -1, $class = '')
$link = vsprintf($node->links['icon'], $args);
$retval .= "<a$linkClass href='$link'>{$node->icon}</a>";
} else {
$retval .= "<a>{$node->icon}</a>";
$retval .= "<a href='#'>{$node->icon}</a>";
}
$retval .= "</div>";
}
Expand Down
6 changes: 5 additions & 1 deletion libraries/navigation/Nodes/Node.class.php
Expand Up @@ -239,7 +239,11 @@ public function parents($self = false, $containers = false, $groups = false)
public function realParent()
{
$retval = $this->parents();
return $retval[0];
if (count($retval) > 0) {
return $retval[0];
} else {
return false;
}
}

/**
Expand Down

0 comments on commit 89da93a

Please sign in to comment.