HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
UrlsViewController.php
Go to the documentation of this file.
1 <?php
2 
4 {
5  public $log;
6 
7  public function actionIndex()
8  {
9  $this->pageTitle = 'Resources';
10  Logger::log('');
11  $data = array();
12  $this->log = Logger::getTrace();
13  $this->render('index', array(
14  'dataProvider' => $data,
15  'log' => $this->log,
16  ));
17  }
18 
19  public function actionFind()
20  {
21  $this->pageTitle = 'Resources';
22  $request = Yii::app()->request;
23  $params = $request->getParam('form');
24  if (!isset($params['page']))
25  $params['page'] = '1';
26  $command = new UrlsView;
27  $userId = Yii::app()->user->id;
28  $data = $command->fetch($userId, $params);
29  if ($data['manError']['isError'] == true) {
30  Yii::app()->user->setFlash('error', 'Search ERROR: ' . $data['manError']['errorBody']);
31  $this->redirect('/UrlsView/index');
32  }
33  unset($data['manError']);
34  Yii::app()->user->setFlash('success', 'Search: SUCCESS');
35  $sort = new CSort;
36 
37  $sort->defaultOrder = 'urlMd5 DESC';
38  $sort->attributes = array('urlMd5');
39 
40  $itemsProvider = new CArrayDataProvider($data, array(
41  'keyField' => 'CDate',
42  'pagination' => false,
43 // 'sort' => $sort
44  ));
45  $this->log = Logger::getTrace();
46  $this->render('find', array(
47  'itemsProvider' => $itemsProvider,
48  'params' => $params
49  ));
50  }
51 
52  public function actionFindSingle()
53  {
54  $request = Yii::app()->request;
55  $params = $request->getParam('urlId');
56  $command = new UrlsView;
57  $userId = Yii::app()->user->id;
58  $data = $command->fetch($userId, $params, true);
59  if ($data['manError']['isError'] == true) {
60  Yii::app()->user->setFlash('error', 'View ERROR: ' . $data['manError']['errorBody']);
61  $this->redirect('/UrlsView/index');
62  }
63  unset($data['manError']);
64  $this->pageTitle = 'Resource - ' . $data[0][0]['urlMd5'];
65  Yii::app()->user->setFlash('success', 'View: SUCCESS');
66  $itemsProvider = new CArrayDataProvider($data[0], array(
67  'keyField' => 'tcDate',
68  'pagination' => array(
69  'pageSize' => 1
70  )
71  ));
72  $itemsProviderHl = new CArrayDataProvider($data[1], array(
73  'keyField' => 'tcDate',
74  'pagination' => array(
75  'pageSize' => 1
76  )
77  ));
78  $limitsProvider = $command->getLimits($userId);
79  $errorsProvider = $command->getErrorsTypes($userId);
80  $tagsProvider = $command->getTagsTypes($userId);
81  $contentParams = $command->getContentParams($data[0][0]);
82  $historyData = $command->getHistory();
83  $this->log = Logger::getTrace();
84  unset($command);
85  $dict = new Dictionary;
86  $descriptions = $dict->getDescriptions();
87  $this->render('single', array(
88  'itemsProvider' => $itemsProvider,
89  'itemsProviderHl' => $itemsProviderHl,
90  'limitsProvider' => $limitsProvider,
91  'errorsProvider' => $errorsProvider,
92  'tagsProvider' => $tagsProvider,
93  'params' => $params,
94  'contentParams' => $contentParams,
95  'descr' => $descriptions['URLS'],
96  'historyData'=>$historyData,
97  ));
98  }
99 
100  public function actionContent()
101  {
102  $userId = Yii::app()->user->id;
103  $contents = UrlsView::getContents($userId);
104  if ($contents['type'] == 'raw') {
105  $this->renderPartial('__contentRaw', array(
106  'data' => $contents['contents']
107  )
108  );
109  } elseif ($contents['type'] == 'processed') {
110  $this->renderPartial('__contentProcessed', array(
111  'data' => $contents['contents'],
112 // 'dataProvider' => new CArrayDataProvider($contents['contents'], array(
113 // 'keyField' => 'name'
114 // )
115 // )
116  )
117  );
118  }
119  }
120  public function actionHistory()
121  {
122 
123  }
124 }