Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
ShareRemembered.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  * ShareRemembered widget - allows deleting, sorting, search and share remembered links
12  *
13 **/
15 {
16 
17  /**
18  * Collection id for filtering pages
19  *
20  * @var string
21  **/
22  public $collection_id;
23 
24  /**
25  * Amount of displaying items on the page
26  *
27  * @var string
28  **/
29  public $pageSize = 4;
30 
31  /**
32  * If user can delete items
33  *
34  * @var string
35  **/
36  public $admin = false;
37 
38  /**
39  * Displayed page number
40  *
41  * @var string
42  **/
43  public $page = 0;
44 
45  /**
46  * Sort field and direction. If direction is ASC then only field name should be specified
47  *
48  * @var string
49  **/
50  public $sort = 'created.desc';
51 
52  /**
53  * Render widget
54  *
55  * @return void
56  **/
57  public function run()
58  {
59  $rememberedPage = new RememberedPage('search');
60  if(isset($_GET['RememberedPage'])){
61  $rememberedPage->attributes = $_GET['RememberedPage'];
62  }
63 
64  $this->collection_id = Yii::app()->getModule('remember')->getUserCollectionId();
65 
66  $this->render('ShareRemembered', array('model' => $rememberedPage));
67  }
68 
69  /**
70  * Return widget options as encrypted string. This is used for sending options via AJAX
71  *
72  * @return void
73  * @author Me
74  **/
75  public function getEncryptedOptions()
76  {
77  $data = array(
78  'collection_id' => $this->collection_id,
79  'pageSize' => $this->pageSize,
80  'admin' => intval($this->admin),
81  'page' => $this->page,
82  'sort' => $this->sort
83  );
84 
85  return EncryptHelper::encrypt(CJSON::encode($data));
86  }
87 }