Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
ItemListWidget.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  *
10  * Widget for view items in users cart
11  */
13 {
14  /**
15  * @var string the title which shows above item list
16  */
17  public $title;
18  /**
19  * @var integer id of the customer
20  */
21  public $user_id;
22  /**
23  * @var integer number of displayed items
24  */
25  public $count;
26  /**
27  * @var string name of css class of unsorted list
28  */
29  public $class;
30  /**
31  * @var string link to the shoppingcart page
32  */
33  public $shoppingcart_link;
34  /**
35  * @var boolean boolean the flag which determines when item names are references
36  */
37  public $link_items_to_page;
38  /**
39  * Override base init. For skipping scripts and css init.
40  *
41  * @return void
42  */
43  public function init()
44  {
45  Yii::app()->user->setState('shoppingcart_link',$this->shoppingcart_link);
46  }
47 
48  /**
49  * Render ItemListWidget view
50  *
51  * @return void
52  */
53  public function run()
54  {
55  $order_id = Order::getOrder(true);
56 
57  if($order_id){
58  $model = Item::model()->findAll(array('condition'=>'order_id=:order_id','limit'=>$this->count,'params'=>array(':order_id'=>$order_id)));
59  }else{
60  $model = array();
61  }
62 
63  $this->render('ItemListWidget', array('model'=>$model));
64  }
65 }