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 $item) {
18  if ($this->isBreadcrumb && !(in_array($item['contentid'], $this->activePath))){
19  continue;
20  }
21  ?>
22  <li>
23  <?php
24  $name = !empty($item['attributes']['name_'.$this->lang]) ? $item['attributes']['name_'.$this->lang] : $item['attributes']['name'];
25  $url = isset($item['attributes']['startpageurl_'.$this->lang]) ? $item['attributes']['startpageurl_'.$this->lang] : (isset($item['attributes']['startpageurl']) ? $item['attributes']['startpageurl'] : '');
26 
27  $hasChildrenClass = !empty($item['children']) ? 'has-children' : '';
28  if (strpos($url, 'http') === false) {
29  if (in_array($item['contentid'], $this->activePath)) {
30  echo CHtml::link($name, Yii::app()->createUrl($url), array('class'=>'active '.$hasChildrenClass));
31  } else {
32  echo CHtml::link($name, Yii::app()->createUrl($url), array('class'=>$hasChildrenClass));
33  }
34  } else {
35  echo CHtml::link($name, $url, array('class'=>$hasChildrenClass));
36  }
37 
38  /* if current node has children and children's lvl does not go out of maxLvl - then show it */
39  if (isset($item['children']) && (in_array($item['contentid'], $this->activePath) || $this->isSitemap) && ($this->maxLvl == 0 || $lvl < $this->maxLvl)) {
40  $this->render('_branch', array('branch'=>$item['children'], 'lvl'=>($lvl+1)));
41  }
42  ?>
43  </li>
44  <?php
45  }
46  if (!$this->isBreadcrumb || $lvl==1) {
47 ?>
48 </ul>
49 <?php
50  }
51 ?>