Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
_branch.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  */
10 
11  if (!$this->isBreadcrumb || $lvl==1) {
12 ?>
13  <ul class="<?php echo $this->cssClass; ?> lvl<?php echo $lvl; ?>">
14 <?php
15  }
16 
17  foreach ($branch as $index => $item) {
18  if ($this->isBreadcrumb && !(in_array($item['contentid'], $this->activePath))){
19  continue;
20  }
21  ?>
22  <li>
23  <?php
24  $name = NavigationTree::getBranchName($item, $this->lang);
25  $url = NavigationTree::getStartpageUrl($item, $this->lang);
26  $excludeURLs = Yii::app()->getModule('navigation')->excludeURLs;
27  // If startpageurl is one those that should be excluded or empty - exclude it
28  if (empty($url) || in_array($url, $excludeURLs)) {
29  unset($branch[$index]);
30  continue;
31  }
32 
33  $hasChildrenClass = !empty($item['children']) ? 'has-children' : '';
34  if (strpos($url, 'http') === false) {
35  if (in_array($item['contentid'], $this->activePath)) {
36  echo CHtml::link($name, Yii::app()->createUrl($url), array('class'=>'active '.$hasChildrenClass));
37  } else {
38  echo CHtml::link($name, Yii::app()->createUrl($url), array('class'=>$hasChildrenClass));
39  }
40  } else {
41  echo CHtml::link($name, $url, array('class'=>$hasChildrenClass));
42  }
43 
44  /* if current node has children and children's lvl does not go out of maxLvl - then show it */
45  if (isset($item['children']) && (in_array($item['contentid'], $this->activePath) || $this->isSitemap) && ($this->maxLvl == 0 || $lvl < $this->maxLvl)) {
46  $this->render('_branch', array('branch'=>$item['children'], 'lvl'=>($lvl+1)));
47  }
48  ?>
49  </li>
50  <?php
51  }
52  if (!$this->isBreadcrumb || $lvl==1) {
53 ?>
54 </ul>
55 <?php
56  }
57 ?>