HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
SitesViewController.php
Go to the documentation of this file.
1 <?php
2 
4 {
5  public $log;
6 
7  public function actionIndex(){
8  $this->pageTitle = 'Find sites';
9  Logger::log('');
10  $userId = Yii::app()->user->id;
11  $data = array();
12  $command = new SitesView;
13  $command->dccCheck($userId);
14  $this->log = Logger::getTrace();
15  $command->rmTmpData();
16  $this->render('index', array(
17  'dataProvider' => $data,
18  'log' => $this->log
19  ));
20  }
21 
22  public function actionFind($uid, $limit, $state, $pattern, $pN, $sortBy, $sortDirection)
23  {
24  $this->pageTitle = 'Find sites';
25  $command = new SitesView;
26  $userId = Yii::app()->user->id;
27  $command->createRequest($pattern, $state, $limit, $uid, $pN, $sortBy, $sortDirection);
28  $data = $command->findSite($userId, false);
29  if ($data['manError']['isError'] == true) {
30  Yii::app()->user->setFlash('error', 'Search ERROR: ' . $data['manError']['errorBody']);
31  $this->redirect('/');
32  }
33  unset($data['manError']);
34  Yii::app()->user->setFlash('success', 'Search: SUCCESS');
35  $itemsProvider = new CArrayDataProvider($data, array(
36  'pagination' => array(
37  'pageSize' => $limit
38  )
39  ));
40  $this->log = Logger::getTrace();
41  $command->rmTmpData();
42  $this->render('find', array(
43  'itemsProvider' => $itemsProvider,
44  'log' => $this->log,
45  'pattern' => $pattern,
46  'uid' => $uid,
47  'limit' => $limit,
48  'page' => $pN,
49  'state' => $state,
50  'sortBy' => $sortBy,
51  'sortDirection' => $sortDirection
52  ));
53  }
54 
55  public function actionFindSingle($siteId, $n = 0)
56  {
57  $this->pageTitle = 'Site - ' . $siteId;
58  $data = array();
59  $command = new SitesView;
60  $userId = Yii::app()->user->id;
61  $reqFile = $command->createRequestSingle($userId, $siteId);
62  $itemsProvider = $command->findSite($userId, $reqFile, $n);
63  $resFile = $command->responseFile;
64  $filtersProvider = $command->getFilters($userId, $resFile, $n);
65  $propsProvider = $command->getProperties($userId, $resFile, $n);
66  $limitsProvider = $command->getLimits($userId, $resFile, $n);
67  $errorsProvider = $command->getErrorsTypes($userId, $resFile, $n);
68  $this->log = Logger::getTrace();
69  Yii::app()->user->setFlash('success', 'View: SUCCESS');
70  $dict = new Dictionary;
71  $descriptions = $dict->getDescriptions();
72  $command->rmTmpData();
73  unset($dict);
74  unset($command);
75  $this->render('findSingle', array(
76  'itemsProvider' => $itemsProvider,
77  'filtersProvider' => $filtersProvider,
78  'propsProvider' => $propsProvider,
79  'limitsProvider' => $limitsProvider,
80  'errorsProvider' => $errorsProvider,
81  'descr'=>$descriptions['SITES'],
82  'n' => $n,
83  'log' => print_r($this->log, true)
84  ));
85  }
86  public function actionIntegrityCheckRequest()
87  {
88  $siteId = Yii::app()->request->getParam('id');
89  $command = new SitesView();
90  $res = $command->integrityCheck($siteId);
91  if (isset($res['code']) && $res['code'] == 0) {
92  $this->renderPartial('__integrityCheckOk');
93  } else {
94  $this->renderPartial('__integrityCheckFail', array(
95  'itemsProvider' => new CArrayDataProvider($res, array(
96  'keyField' => 'Sites',
97  'pagination' => false
98  )),
99  'id' => $siteId
100  ));
101  }
102  }
103  public function actionIntegrityCheck()
104  {
105  $this->renderPartial('__integrityCheckModal', array(
106  'id' => Yii::app()->request->getParam('id')
107  ));
108  }
109  public function actionIntegrityFix()
110  {
111  $command = new SiteUpdate();
112  $command->updateSiteInfo(null, 0);
113  return true;
114  }
115  public function actionGetTProps() {
116  $command = new SiteNew;
117  $propsArr = CJSON::encode($command->getTProps());
118  echo $propsArr;
119  }
120 }