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

Public Member Functions

 __construct ($folderIds=array(), $usePersonalisation=true, $tag= '', $gccRequestParams=null, $sorting=null)
 getFiltersList ()
 loadMaxUpdatetimestamp ()

Public Attributes

 $folderIds
 $gccRequestParams
 $lang
 $tag
 $data = array()
 $sorting
 $usePersonalisation = true

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 PersonalizedContent.php.

Constructor & Destructor Documentation

PersonalizedContent::__construct (   $folderIds = array(),
  $usePersonalisation = true,
  $tag = '',
  $gccRequestParams = null,
  $sorting = null 
)

Construction that will load nodes tree for given $folderIds

Parameters
array$folderIdscontains folder IDs of content to show
bool$usePersonalisationdetermines if personalization should be performed
string$tagcontent tag
Returns

Definition at line 61 of file PersonalizedContent.php.

{
//Yii::app()->cache->flush();
if (!empty($folderIds)) {
$this->lang = substr(Yii::app()->language, 0, 2);
$this->gccRequestParams = isset($gccRequestParams)? $gccRequestParams : Yii::app()->getModule('personalizedContent')->gccRequestParams;
$this->sorting = isset($sorting)? $sorting : Yii::app()->getModule('personalizedContent')->sorting;
$this->usePersonalisation = $usePersonalisation;
$this->tag = $tag;
$this->folderIds = $folderIds;
sort($this->folderIds);
$this->_loadData();
$this->_cleanUp(Yii::app()->user->id);
} else {
return false;
}
}

Member Function Documentation

PersonalizedContent::getFiltersList ( )

Filter tree by some schema

Returns
array|bool

Definition at line 160 of file PersonalizedContent.php.

{
if (Yii::app()->getModule('contentSource')->contentSource->usePersonalisation) {
$filters = Yii::app()->getModule('contentSource')->contentSource->personalisationFields;
return $filters;
}
return false;
}
PersonalizedContent::loadMaxUpdatetimestamp ( )

extracts max updatetimestamp from array of CMS objects

Returns
int|bool

Definition at line 232 of file PersonalizedContent.php.

{
$timestampCacheId = 'persContent_UTS_'.md5(implode(',', $this->folderIds).$this->lang.$this->gccRequestParams.$this->sorting.$this->tag);
//try to get $maxTimestamp from cache
if (($maxTimestamp = Yii::app()->cache->get($timestampCacheId)) === false) {
$params = array(
'filter' => 'object.obj_type==10007 AND object.hideinoverview != 1 AND object.languagecode=="'.$this->lang.'" AND (object.folder_id=="'.implode('" OR object.folder_id=="', $this->folderIds).'")',
'type' => 'php',
'sorting' => $this->sorting,
);
if (!empty($this->tag)) {
$params['filter'] .= 'AND object.tagging LIKE "*'.$this->tag.'*"';
}
$params = Yii::app()->getComponent('repositoryApi')->addAdditionalParameters($params, 'contentRepositorySearch');
$timestamps = Yii::app()->repositoryApi->request(
$params,
array('updatetimestamp')
);
$timestamps = unserialize($timestamps);
if (isset($timestamps['status']) && $timestamps['status']=='ok') {
unset($timestamps['status']);
$maxTimestamp = 0;
foreach ($timestamps as $id=>$contentFolder) {
if (isset($contentFolder['attributes']['updatetimestamp']) && $contentFolder['attributes']['updatetimestamp'] > $maxTimestamp) {
$maxTimestamp = $contentFolder['attributes']['updatetimestamp'];
}
}
Yii::app()->cache->set($timestampCacheId, $maxTimestamp, Yii::app()->getModule('personalizedContent')->cacheTime);
} else {
$maxTimestamp = false;
}
}
return $maxTimestamp;
}

Member Data Documentation

PersonalizedContent::$data = array()

array that contains categories tree

Definition at line 40 of file PersonalizedContent.php.


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