Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
NavigationWidget.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 // cacheId includes current widget settings, updatetimestamp for given content and current user personalisation settings
12 $cacheId = $this->createCacheKey();
13 
14 if ($this->beginCache($cacheId, array('duration' => Yii::app()->getModule('navigation')->cacheTime))) {
15 
16  $data = $tree->cleanUp(Yii::app()->user->id, $this->usePersonalisation);
17 
18  /* if $this->hideFirstLevel is true then we should show children of current node's children */
19  if ($this->hideFirstLevel && !empty($data['children'])) {
20  $fakeChildren = array();
21  foreach ($data['children'] as &$node) {
22  if (!empty($node['children']) && in_array($node['contentid'], $this->activePath)) {
23  $fakeChildren = array_merge($fakeChildren, $node['children']);
24  break;
25  }
26  }
27 
28  if (!empty($fakeChildren)) {
29  $this->render('_branch', array('branch' => $fakeChildren, 'lvl' => 1));
30  }
31 
32  } else if (!empty($data['children'])) {
33  $this->render('_branch', array('branch' => $data['children'], 'lvl' => 1));
34  }
35 
36  $this->endCache();
37 }
38 ?>