Mercurial > hg > extraction-interface
comparison controllers/extractapp.php @ 47:886f43b26ee2 extractapp
move/remove develop folder
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 17 Mar 2015 10:54:13 +0100 |
parents | |
children | f9594c240826 |
comparison
equal
deleted
inserted
replaced
46:b3ca5d2b4d3f | 47:886f43b26ee2 |
---|---|
1 <?php | |
2 | |
3 class Extractapp extends BaseController { | |
4 protected function Index() { | |
5 $viewmodel = new ExtractappModel(); | |
6 $this->ReturnView($viewmodel->Index(), true); | |
7 } | |
8 protected $viewmodel; | |
9 | |
10 | |
11 public function __construct($action, $urlvalues, $postdata){ | |
12 parent::__construct($action, $urlvalues, $postdata); | |
13 $this->viewmodel = new ExtractappModel(); | |
14 } | |
15 | |
16 protected function TaggingText() { | |
17 //$viewmodel = new ExtractappModel(); | |
18 $viewmodel = $this->viewmodel; | |
19 | |
20 switch ($this->postdata['func']) { | |
21 case 'SaveFullText': | |
22 $viewmodel->SaveFullText($this->postdata); | |
23 $this->ReturnView($viewmodel->StartTagging(), true); | |
24 break; | |
25 case 'SaveFullTextToLGService': | |
26 $viewmodel->messages .= "SaveFullTextToLGService! "."<br>"; | |
27 $viewmodel->GetInfoFromPreviousPage($this->postdata); | |
28 $response = $viewmodel->SaveFullTextToLGService($this->postdata); | |
29 $viewmodel->UpdateInfoByResponseFromLGService($response); // update file_id, branch_id, user_id | |
30 $this->ReturnView($viewmodel->StartTagging(), true); | |
31 break; | |
32 | |
33 case 'SmartRegexLoad': | |
34 $viewmodel->SmartRegexLoad($this->postdata['topic_id']); | |
35 break; | |
36 case 'SmartRegexSave': | |
37 $viewmodel->SmartRegexSave($this->postdata); | |
38 break; | |
39 case 'Reload': | |
40 // $viewmodel->Reload(); | |
41 break; | |
42 | |
43 case 'ContinueTagging': | |
44 $viewmodel->messages .= "(Countinue tagging) "."<br>"; | |
45 if ($this->postdata['topic']) { | |
46 $viewmodel->SetTopic($this->postdata['topic']); | |
47 } | |
48 $viewmodel->GetInfoFromPreviousPage($this->postdata); | |
49 $this->ReturnView($viewmodel->StartTagging(), true); | |
50 break; | |
51 | |
52 | |
53 default: // first time visit extraction interface from LGService | |
54 $viewmodel->messages .= "Welcome to Extraction Interface. "."<br>"; | |
55 | |
56 if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) { | |
57 // get text from fileId, from LGService | |
58 $viewmodel->GetTextFromFileId($this->postdata); | |
59 } else if ($this->postdata['sectionId'] != 0 && $this->postdata['userId'] != 0) { | |
60 // get text from sectionId from LGService | |
61 $viewmodel->GetTextFromSectionId($this->postdata); | |
62 } else if ($this->postdata['sectionId'] != 0) { | |
63 $viewmodel->GetTextFromLocal($this->postdata['sectionId']); | |
64 | |
65 } else if (is_numeric($this->urlvalues['id'])) { | |
66 // get text from local file system (for development stage only) | |
67 $viewmodel->GetTextFromLocal($this->urlvalues['id']); | |
68 $this->ReturnView_localtest($viewmodel->StartTagging(), true); | |
69 break; | |
70 | |
71 } else { | |
72 $viewmodel->messages .= "wrong url!!"; | |
73 return; | |
74 } | |
75 | |
76 $this->ReturnView($viewmodel->StartTagging(), true); | |
77 break; | |
78 } | |
79 | |
80 | |
81 | |
82 } | |
83 | |
84 protected function ExportTable() { | |
85 //$viewmodel = new ExtractappModel(); | |
86 $viewmodel = $this->viewmodel; | |
87 $this->ReturnView($viewmodel->ExportTable($this->postdata), true); | |
88 | |
89 } | |
90 | |
91 protected function EditWordlist() { | |
92 // $viewmodel = new ExtractappModel(); | |
93 $viewmodel = $this->viewmodel; | |
94 switch ($this->postdata['func']) { | |
95 case 'AddNewList': | |
96 $this->ReturnView($viewmodel->AddNewList($this->postdata), true); | |
97 break; | |
98 case 'SaveWordlist': | |
99 $this->ReturnView($viewmodel->SaveWordlist($this->postdata), true); | |
100 break; | |
101 default: // EditWordlist | |
102 | |
103 $this->ReturnView($viewmodel->EditWordlist(), true); | |
104 break; | |
105 } | |
106 } | |
107 | |
108 | |
109 protected function EditTaglist() { | |
110 //$viewmodel = new ExtractappModel(); | |
111 $viewmodel = $this->viewmodel; | |
112 switch ($this->postdata['func']) { | |
113 case 'NewTagElement': | |
114 $this->ReturnView($viewmodel->NewTagElement($this->postdata), true); | |
115 break; | |
116 case 'SaveTagElement': | |
117 $this->ReturnView($viewmodel->SaveTagElement($this->postdata), true); | |
118 break; | |
119 case 'DeleteTag': | |
120 $this->ReturnView($viewmodel->DeleteTag($this->postdata), true); | |
121 break; | |
122 default: // EditTaglist | |
123 $this->ReturnView($viewmodel->EditTaglist($this->postdata), true); | |
124 break; | |
125 } | |
126 } | |
127 | |
128 | |
129 protected function ConfigTagsInTopic() { | |
130 //$viewmodel = new ExtractappModel(); | |
131 $viewmodel = $this->viewmodel; | |
132 switch ($this->postdata['func']) { | |
133 case 'Update': | |
134 $viewmodel->UpdateTagsInTopic($this->postdata); | |
135 break; | |
136 default: | |
137 $this->ReturnView($viewmodel->ConfigTagsInTopic($this->postdata), true); | |
138 break; | |
139 } | |
140 } | |
141 | |
142 protected function TestAction() { | |
143 $viewmodel = new ExtractappModel(); | |
144 $this->ReturnView($viewmodel->Test(), true); | |
145 } | |
146 | |
147 | |
148 | |
149 | |
150 } | |
151 | |
152 | |
153 ?> |