Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
NavigationTree Class Reference

Public Member Functions

 getTreeCacheTime ()
 getLatestUpdateTimestampCacheTime ()
 __construct ($startfolderId=0, $activeElement=0, $additionalParams=array(), $sortby="sortorder:asc")
 cleanUp ($user_id, $usePersonalisation=true)
 getFiltersList ()

Static Public Member Functions

static getUpdatetimestampByContentId ($startfolderId)
static extractBranch ($node=array(), $contentId= '')

Public Attributes

 $startfolderId = 0
 $activeElement = 0
 $data = array()
 $activePath = array()
 $lang
 $usePersonalisation = true
 $additionalParams = array()
 $sortby = "sortorder:asc"

Detailed Description

Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales.nosp@m.@gen.nosp@m.tics..nosp@m.com http://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.

Class for working with Gentics Content Connector

Definition at line 12 of file NavigationTree.php.

Constructor & Destructor Documentation

NavigationTree::__construct (   $startfolderId = 0,
  $activeElement = 0,
  $additionalParams = array(),
  $sortby = "sortorder:asc" 
)

Construction that will load nodes tree for given startfolderId and activePath for given activeElement

Parameters
integer$startfolderIdid of folder that must be treated as root
int$activeElementid
Returns

Definition at line 77 of file NavigationTree.php.

References $activeElement, and $startfolderId.

:asc")
{
if ($startfolderId != '' && (int)$startfolderId > 0) {
$this->lang = substr(Yii::app()->language, 0, 2);
$this->startfolderId = $startfolderId;
$this->activeElement = $activeElement;
$this->additionalParams = $additionalParams;
$this->sortby = $sortby;
$this->_loadData();
$this->_loadActivePath();
}
}

Member Function Documentation

NavigationTree::cleanUp (   $user_id,
  $usePersonalisation = true 
)

Filter tree by some schema

Parameters
integer$user_idId of the user to filter tree for
bool$usePersonalisationdefines if personalisation of received content should be performed
Returns
array

Definition at line 99 of file NavigationTree.php.

References $data, and getFiltersList().

{
//get filter fields from settings
$filters = $this->getFiltersList();
$this->usePersonalisation = $usePersonalisation;
//load tree data into local array
// apply filter here
if ($filters && $data) {
$data = $this->_unsetNodes($filters, $user_id, $data);
}
return $data;
}
static NavigationTree::extractBranch (   $node = array(),
  $contentId = '' 
)
static

Returnes branch with given id if exists

Parameters
array$nodecontains navigation tree
string$contentIdcontains id of content to search
Returns
array|bool searched node

Definition at line 322 of file NavigationTree.php.

Referenced by MainNavigationTreeTest\testExtractBranch().

{
if ($node['contentid'] == $contentId) {
return $node;
} elseif (!empty($node['children'])) {
foreach ($node['children'] as $childNode) {
if ($searchedNode = self::extractBranch($childNode, $contentId)) {
return $searchedNode;
}
}
}
return false;
}
NavigationTree::getFiltersList ( )

Filter tree by some schema

Returns
array|bool

Definition at line 172 of file NavigationTree.php.

Referenced by cleanUp().

{
if (Yii::app()->getModule('contentSource')->contentSource->usePersonalisation) {
$filters = Yii::app()->getModule('contentSource')->contentSource->personalisationFields;
return $filters;
}
return false;
}
static NavigationTree::getUpdatetimestampByContentId (   $startfolderId)
static

returnes array with active path for given $startfolderId

Parameters
varchar$startfolderIdcontentId to check timestamp
Returns
string|bool

Definition at line 303 of file NavigationTree.php.

References $data, and $startfolderId.

Referenced by NavigationWidget\createCacheKey().

{
$cacheId = 'navigation_' . $startfolderId;
if (($data = Yii::app()->cache->get($cacheId)) === false) {
return false;
} else {
return $data[(string)$startfolderId]['attributes']['updatetimestamp'];
}
}

Member Data Documentation

NavigationTree::$activeElement = 0

id of the root folder for current widget

Definition at line 25 of file NavigationTree.php.

Referenced by __construct().

NavigationTree::$activePath = array()

array that contains Ids for active categories

Definition at line 37 of file NavigationTree.php.

NavigationTree::$data = array()

array that contains categories tree

Definition at line 31 of file NavigationTree.php.

Referenced by cleanUp(), and getUpdatetimestampByContentId().

NavigationTree::$startfolderId = 0

id of the root folder for current widget

Definition at line 19 of file NavigationTree.php.

Referenced by __construct(), and getUpdatetimestampByContentId().


The documentation for this class was generated from the following file: