HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
SiteNewController.php
Go to the documentation of this file.
1 <?php
2 
4 {
5  public $log;
6 
7  public function init()
8  {
9  Yii::app()->attachEventHandler('onError',array($this,'handleError'));
10  }
11 
12  public function handleError(CEvent $event)
13  {
14  if($event instanceof CErrorEvent) {
15  if(stripos($event->message, "include(TagsReaperFormAPI.php)") !== false)
16  {
17  $event->handled = true;
18  $this->renderPartial('//system/error500', array(
19  'customData' => 'Module TagsReaperUI is not installed, or corrupted...',
20  'modal'=>true
21  ));
22  }
23  }
24  }
25 
26  public function actionIndex()
27  {
28  $this->log = Logger::getTrace();
29  $command = new SiteNew;
30  $defaultProperties = $command->getDefaultProps();
31  $defaults = $command->getDefaults();
32  $dict = new Dictionary;
33  $descriptions = $dict->getDescriptions();
34  unset($dict);
35  unset($command);
36  $this->render("siteNew", array(
37  'log' => $this->log,
38  'model' => new SiteNew,
39  'defaults' => $defaults,
40  'props' => $defaultProperties,
41  'descr' =>$descriptions['SITES'],
42  ));
43  }
44 
45  public function actionNew()
46  {
47  $command = new SiteNew;
48  $command->addNewSite();
49  $userId = Yii::app()->user->id;
50  $pattern = $command->getUrlsArray()[0];
51  $state = Yii::app()->getRequest()->getPost('state');
52  $this->log = Logger::getTrace();
53  $this->redirect("/SitesView/find?uid=$userId&pattern=$pattern&state=$state&limit=10&sortBy=UDate&sortDirection=DESC&yt1=Submit&pN=1");
54  unset($command);
55  }
56  public function actionToolPicker()
57  {
58  $this->renderPartial('__scrapingForm');
59  }
60  public function actionGetTProps() {
61  $command = new SiteNew;
62  $propsArr = CJSON::encode($command->getTProps());
63  echo $propsArr;
64  }
65 }