Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
PreviewController.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  *
11  * @author Vitalii Kovalchuk <vitaly.kovalchuk@oberig.com>
12  */
13 
14 /**
15  * tagcloud preview controller class
16  *
17  * @author Vitalii Kovalchuk <vitaly.kovalchuk@oberig.com>
18  *
19  */
20 class PreviewController extends Controller
21 {
22  /**
23  * default action used to show widget preview
24  *
25  * @return void
26  *
27  * @throws Exception
28  */
29  public function actionIndex()
30  {
31  $folderIds = Yii::app()->request->getQuery('folderIds', null);
32  $usePersonalisation = Yii::app()->request->getQuery('usePersonalisation', 'Y');
33 
34  if (empty($folderIds)) {
35  throw new Exception(TagcloudModule::t('TagcloudModule error: folderIds is required and can`t be blank'));
36  }
37 
38  preg_match_all('/([0-9]+)/', $folderIds, $folderIds);
39 
40  array_walk(
41  $folderIds[0],
42  function(&$item)
43  {
44  $item = '10002.'.$item;
45  }
46  );
47 
48  $this->widget(
49  'tagcloud.widgets.TagcloudWidget',
50  array(
51  'folderIds'=>$folderIds[0],
52  'usePersonalisation'=>($usePersonalisation == 'Y' ? true : false)
53  )
54  );
55  }
56 }