20 private $_personalisationAttributes;
22 private $_cachePrefix =
'content_';
43 return $this->_source->contentFile($this->
getPath());
55 $this->_attributes = $attributes;
56 if ($this->_source->usePersonalisation) {
57 Yii::app()->cache->set($this->_cachePrefix . $this->_path, $attributes, Yii::app()->getModule(
'contentSource')->cacheTime);
70 if ($this->_attributes === null && $this->_source->usePersonalisation) {
71 $this->_attributes = Yii::app()->cache->get($this->_cachePrefix . $this->_path);
72 if ($this->_attributes ===
false) {
73 $attributes = $this->_source->getRepositoryApi()->getContentAttributes($this->_path, $this->_source->getRequestedAttributes());
74 if ($attributes !==
false) {
77 $this->_attributes =
false;
82 return $this->_attributes;
92 if ($this->_personalisationAttributes === null) {
93 $this->_personalisationAttributes = array();
95 foreach ($this->_source->personalisationFields as $pf) {
96 if (isset($attributes[$pf]) && is_array($attributes[$pf])) {
97 $this->_personalisationAttributes = array_merge($this->_personalisationAttributes, $attributes[$pf]);
102 return $this->_personalisationAttributes;
116 $this->_source = $source;
117 $this->_path = $path;
118 if ($attributes !== null) {
132 if ($this->_source->usePersonalisation) {
133 $hasAccess = Yii::app()->getModule(
'personalisation')->rule->checkAccess($user->id, $this->getPersonalisationAttributes());
134 Yii::trace(
"Check personalisation access. Result: [$hasAccess].".print_r($this->
getPersonalisationAttributes(),
true),
'personalisation');