comparison controllers/extractapp.php @ 95:9a29e9d28ece extractapp

new: create new topic
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 11 Nov 2015 14:12:55 +0100
parents b0cecc104639
children ce7e933b18b0
comparison
equal deleted inserted replaced
94:b0cecc104639 95:9a29e9d28ece
99 $this->ReturnView($viewmodel->StartTagging(), true); 99 $this->ReturnView($viewmodel->StartTagging(), true);
100 break; 100 break;
101 101
102 case 'ContinueTagging': 102 case 'ContinueTagging':
103 $viewmodel->messages['info'] .= "(Countinue tagging) "; 103 $viewmodel->messages['info'] .= "(Countinue tagging) ";
104 if ($this->postdata['topic']) { 104 $viewmodel->SetInfoFromPreviousPage($this->postdata);
105 $viewmodel->SetTopic($this->postdata['topic']); 105 $viewmodel->SetTextFromFileId(); // get text by fileId, from LGService
106 } 106 $viewmodel->SetTopic($this->postdata['topic']);
107 $viewmodel->SetInfoFromPreviousPage($this->postdata); 107
108 $this->ReturnView($viewmodel->StartTagging(), true); 108 $this->ReturnView($viewmodel->StartTagging(), true);
109 break; 109 break;
110 110
111 case 'CreateNewTopic':
112 $result = $viewmodel->CreateNewTopic($this->postdata);
113 if ($result == "error") {
114 $viewmodel->messages['error'] .= "Fail to create the new topic <br> ";
115 } else {
116 // then act like ContinueTagging
117 $viewmodel->messages['info'] .= "Created a new topic <br>";
118 $viewmodel->SetInfoFromPreviousPage($result);
119 $viewmodel->SetTextFromFileId(); // get text by fileId, from LGService
120 $viewmodel->SetTopic($result['topic']);
121
122 }
123 $this->ReturnView($viewmodel->StartTagging(), true);
124
125 break;
111 126
112 default: 127 default:
113 // This is where the first time user visit extraction interface from LGService 128 // This is where the first time user visit extraction interface from LGService
114 $viewmodel->messages['info'] .= "Welcome to Extraction Interface. "; 129 $viewmodel->messages['info'] .= "Welcome to Extraction Interface. ";
115 130
278 } 293 }
279 switch ($func) { 294 switch ($func) {
280 case 'Update': 295 case 'Update':
281 $viewmodel->UpdateTagsInTopic($this->postdata); 296 $viewmodel->UpdateTagsInTopic($this->postdata);
282 break; 297 break;
298 /*
283 case 'CreateNewTopic': 299 case 'CreateNewTopic':
284 $this->ReturnView($viewmodel->CreateNewTopic($this->postdata), true); 300 $result = $viewmodel->CreateNewTopic($this->postdata);
285 break; 301 if ($result == "error") {
302 echo "Fail to create the new topic. Please contact us.";
303 } else {
304 $this->ReturnView($viewmodel->ConfigTagsInTopic($result), true);
305 }
306 break;
307 */
286 default: 308 default:
287 $this->ReturnView($viewmodel->ConfigTagsInTopic($this->postdata), true); 309 $this->ReturnView($viewmodel->ConfigTagsInTopic($this->postdata), true);
288 break; 310 break;
289 } 311 }
290 } 312 }
291 313
292 314
293 315
294 316