Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
LastRemembered.php
1 <?php
2 
3 /**
4  * Gentics Portal.Node PHP
5  * Author & Copyright (c) by Gentics Software GmbH
6  * sales@gentics.com
7  * http://www.gentics.com
8  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
9  * You must not use this software without a valid license agreement.
10  *
11  * Last remembered widget - displays last N remembered pages
12  *
13  **/
15 {
16  /**
17  * Collection id for filtering pages
18  *
19  * @var string
20  **/
21  public $collection_id;
22 
23  /**
24  * Amount of displaying items
25  *
26  * @var string
27  **/
28  public $count = 4;
29 
30  /**
31  * Find pages, display
32  *
33  **/
34  public function run()
35  {
36  if($this->collection_id === null){
37  $this->collection_id = Yii::app()->getModule('remember')->getUserCollectionId();
38  }
39  $criteria = new CDbCriteria();
40  $criteria->compare('collection_id', $this->collection_id);
41  $criteria->order = 'created DESC';
42  $criteria->limit = $this->count;
43 
44  $pages = RememberedPage::model()->findAll($criteria);
45  if(count($pages)){
46  $this->render('LastRemembered', array('pages'=>$pages));
47  }
48  }
49 }