18 public $folderIds = array();
23 public $tplString =
'';
47 public $perPage = null;
53 public $baseHref =
'';
58 public $usePersonalisation =
true;
62 public $gccRequestParams;
87 if (!empty($_GET[
'folderIds']) && !empty($_GET[
'tag'])) {
88 preg_match_all(
'/([0-9]+)/', $_GET[
'folderIds'], $folderIds);
94 $item =
'10002.'.$item;
98 $this->folderIds = $folderIds[0];
105 $gccRequestParams = null;
106 if(isset($this->gccRequestParams)){
107 $gccRequestParams = $this->gccRequestParams;
110 if(isset($this->sorting)){
111 $sorting = $this->sorting;
114 if (!empty($this->folderIds) && !empty($this->tplString)) {
115 $content =
new PersonalizedContent($this->folderIds, $this->usePersonalisation, $tag, $gccRequestParams , $sorting);
117 throw new Exception(
'PersonalizedContentWidget error: folderIds and tplString are required parameters and can`t be blank ');
121 $this->offset = (int)Yii::app()->request->getQuery(
'offset', 0);
123 if (!empty($content->data)) {
124 $this->totalQty = count($content->data);
125 $this->perPage = (isset($this->perPage) && $this->perPage > 0)? $this->perPage : Yii::app()->getModule(
'personalizedContent')->perPage;
128 if ($this->offset>=$this->totalQty || $this->offset<0) {
133 $content->data = array_slice($content->data, $this->offset, $this->perPage);
135 $this->lang = substr(Yii::app()->language, 0, 2);
136 $this->render(
'PersonalizedContentWidget', array(
'contentList'=>$content->data));
147 $this->baseHref = Yii::app()->request->pathInfo;
149 if (!empty(Yii::app()->request->queryString)) {
150 $getParams = explode(
'&', Yii::app()->request->queryString);
153 foreach ($getParams as $param) {
154 $param = explode(
'=', $param);
155 if ($param[0]==
'offset') {
158 $params[] = $param[0].
'='.$param[1];
160 if (!empty($params)) {
161 $this->baseHref .=
'?'.implode(
'&', $params).
'&';
163 $this->baseHref .=
'?';
166 $this->baseHref .=
'?';
169 $this->baseHref = Yii::app()->CreateUrl($this->baseHref);