Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
ItemWidget.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 item
11  */
13 {
14  /**
15  * @var integer the id of item
16  */
17  public $item_id;
18  /**
19  * @var string the title of item
20  */
21  public $title;
22  /**
23  * @var float the price of item
24  */
25  public $price;
26  /**
27  * @var string the email address of responsible admin
28  */
29  public $admin_email;
30  /**
31  * @var int the id of page where the item is located
32  */
33  public $page_id;
34  /**
35  * @var string the name of css class of item container
36  */
37  public $class;
38  /**
39  * @var int the value to be used as default quantity
40  */
41  public $default_quantity = 1;
42  /**
43  * @var string link to the checkout page to redirect to shoppingcart page
44  */
45  public $shoppingcart_link = false;
46  /**
47  * @var string link to the item page
48  */
49  public $item_referrer = false;
50  /**
51  * Override base init. For skipping scripts and css init.
52  *
53  * @return void
54  */
55  public function init()
56  {
57 
58  }
59  /**
60  * Render ItemWidget view
61  *
62  * @return void
63  */
64  public function run()
65  {
66  $model=new Item;
67 
68  $titleVisible = $this->title;
69  $priceVisible = $this->price;
70 
71  $model->title = EncryptHelper::encrypt($this->title);
72  $model->quantity = $this->default_quantity;
73  $model->price = EncryptHelper::encrypt($this->price);
74  $model->admin_email = EncryptHelper::encrypt($this->admin_email);
75  $model->item_id = EncryptHelper::encrypt($this->item_id);
76  $model->page_id = EncryptHelper::encrypt($this->page_id);
77  $model->item_referrer = $this->item_referrer;
78 
79  $checksum = $model->getItemChecksum(true);
80  $this->render('ItemWidget', array('model'=>$model, 'titleVisible'=>$titleVisible,'priceVisible'=>$priceVisible, 'checksum'=>$checksum));
81  }
82 }