Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
GooglesitemapsWidget.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 viewing navigation tree
11  */
12 
14 {
15  /**
16  * @var string $rootfolderId contains the ID of the rootfolder.
17  */
18  public $rootfolderId;
19 
20  /**
21  * @var string $hostParam can be set to build absolute Urls (eg 'http://www.gentics.com')
22  */
23  public $hostParam;
24 
25  /**
26  * @var array $contentTypes contains the Type Id's which content to show (10007,10008,ect)
27  */
28  public $contentTypes;
29 
30  /**
31  * @var string $hideParam contains the Name of the object Parameter which is can be set to not show content
32  */
33  public $hideParam;
34 
35  /**
36  * @var string $containerParam contains the Name of the object Parameter which will be checked against the value to show the content
37  */
38  public $containerParam;
39 
40  /**
41  * @var string $containerParamValue contains the value the object Parameter need to have to show the content
42  */
43  public $containerParamValue;
44 
45  /**
46  * @var string $outputFormatValue sets the choosen Output Format in the View
47  */
48  public $outputFormatValue;
49 
50  /**
51  * @var int the number of seconds in which the cached value will expire. 0 means never expire.
52  */
53  public $cacheTime;
54 
55  /**
56  * language
57  * @var lang
58  */
59  public $lang = '';
60 
61  /**
62  * Base href for current page
63  * @var int
64  */
65  public $baseHref = '';
66 
67  /**
68  * @var string GCC request params. Comma separated.
69  */
70  public $gccRequestParams;
71 
72  /**
73  * @var string $sorting contains sorting expression
74  */
75  public $sorting;
76  /**
77  * Initializes the widget.
78  *
79  * @return void
80  */
81  public function init()
82  {
83  //die('this is init');
84  }
85 
86  /**
87  * renders view
88  *
89  * @throws Exception
90  * @return void
91  */
92  public function run()
93  {
94 
95  /*
96  * Get values from widget option for Googlesitemaps
97  * if it is set otherwise it will be taken from module
98  */
99  $rootfolderId = "";
100  if(isset($this->rootfolderId)){
101  $rootfolderId = $this->rootfolderId;
102  }
103  $hostParam = null;
104  if(isset($this->hostParam)){
105  $hostParam = $this->hostParam;
106  }
107  $contentTypes = null;
108  if(isset($this->contentTypes)){
109  $contentTypes = $this->contentTypes;
110  }
111  $hideParam = null;
112  if(isset($this->hideParam)){
113  $hideParam = $this->hideParam;
114  }
115  $containerParam = null;
116  if(isset($this->containerParam)){
117  $containerParam = $this->containerParam;
118  }
119  $containerParamValue = null;
120  if(isset($this->containerParamValue)){
121  $containerParamValue = $this->containerParamValue;
122  }
123  $outputFormatValue = "";
124  if(isset($this->outputFormatValue)){
125  $outputFormatValue = $this->outputFormatValue;
126  }
127  $cacheTime = null;
128  if(isset($this->cacheTime)){
129  $cacheTime = $this->cacheTime;
130  }
131  $gccRequestParams = null;
132  if(isset($this->gccRequestParams)){
133  $gccRequestParams = $this->gccRequestParams;
134  }
135  $sorting = null;
136  if(isset($this->sorting)){
137  $sorting = $this->sorting;
138  }
139 
140  if ($rootfolderId != "") {
141  $content = new Googlesitemaps($rootfolderId, $hostParam, $contentTypes, $hideParam, $containerParam , $containerParamValue, $outputFormatValue, $cacheTime, $gccRequestParams , $sorting);
142  } else {
143  throw new Exception('GooglesitemapsWidget error: rootfoldweId is a required parameter and can`t be blank ');
144  }
145 
146  if (!empty($content->data)) {
147  $this->lang = substr(Yii::app()->language, 0, 2);
148  $this->render('GooglesitemapsWidget', array('contentList'=>$content->data,'lvl' => 1,'hostParam'=>$content->hostParam,'outputFormat'=>$content->outputFormatValue));
149  }
150  }
151 }