Mercurial > hg > extraction-interface
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/controllers/extractapp.php Tue Mar 17 10:54:13 2015 +0100 @@ -0,0 +1,153 @@ +<?php + +class Extractapp extends BaseController { + protected function Index() { + $viewmodel = new ExtractappModel(); + $this->ReturnView($viewmodel->Index(), true); + } + protected $viewmodel; + + + public function __construct($action, $urlvalues, $postdata){ + parent::__construct($action, $urlvalues, $postdata); + $this->viewmodel = new ExtractappModel(); + } + + protected function TaggingText() { + //$viewmodel = new ExtractappModel(); + $viewmodel = $this->viewmodel; + + switch ($this->postdata['func']) { + case 'SaveFullText': + $viewmodel->SaveFullText($this->postdata); + $this->ReturnView($viewmodel->StartTagging(), true); + break; + case 'SaveFullTextToLGService': + $viewmodel->messages .= "SaveFullTextToLGService! "."<br>"; + $viewmodel->GetInfoFromPreviousPage($this->postdata); + $response = $viewmodel->SaveFullTextToLGService($this->postdata); + $viewmodel->UpdateInfoByResponseFromLGService($response); // update file_id, branch_id, user_id + $this->ReturnView($viewmodel->StartTagging(), true); + break; + + case 'SmartRegexLoad': + $viewmodel->SmartRegexLoad($this->postdata['topic_id']); + break; + case 'SmartRegexSave': + $viewmodel->SmartRegexSave($this->postdata); + break; + case 'Reload': + // $viewmodel->Reload(); + break; + + case 'ContinueTagging': + $viewmodel->messages .= "(Countinue tagging) "."<br>"; + if ($this->postdata['topic']) { + $viewmodel->SetTopic($this->postdata['topic']); + } + $viewmodel->GetInfoFromPreviousPage($this->postdata); + $this->ReturnView($viewmodel->StartTagging(), true); + break; + + + default: // first time visit extraction interface from LGService + $viewmodel->messages .= "Welcome to Extraction Interface. "."<br>"; + + if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) { + // get text from fileId, from LGService + $viewmodel->GetTextFromFileId($this->postdata); + } else if ($this->postdata['sectionId'] != 0 && $this->postdata['userId'] != 0) { + // get text from sectionId from LGService + $viewmodel->GetTextFromSectionId($this->postdata); + } else if ($this->postdata['sectionId'] != 0) { + $viewmodel->GetTextFromLocal($this->postdata['sectionId']); + + } else if (is_numeric($this->urlvalues['id'])) { + // get text from local file system (for development stage only) + $viewmodel->GetTextFromLocal($this->urlvalues['id']); + $this->ReturnView_localtest($viewmodel->StartTagging(), true); + break; + + } else { + $viewmodel->messages .= "wrong url!!"; + return; + } + + $this->ReturnView($viewmodel->StartTagging(), true); + break; + } + + + + } + + protected function ExportTable() { + //$viewmodel = new ExtractappModel(); + $viewmodel = $this->viewmodel; + $this->ReturnView($viewmodel->ExportTable($this->postdata), true); + + } + + protected function EditWordlist() { + // $viewmodel = new ExtractappModel(); + $viewmodel = $this->viewmodel; + switch ($this->postdata['func']) { + case 'AddNewList': + $this->ReturnView($viewmodel->AddNewList($this->postdata), true); + break; + case 'SaveWordlist': + $this->ReturnView($viewmodel->SaveWordlist($this->postdata), true); + break; + default: // EditWordlist + + $this->ReturnView($viewmodel->EditWordlist(), true); + break; + } + } + + + protected function EditTaglist() { + //$viewmodel = new ExtractappModel(); + $viewmodel = $this->viewmodel; + switch ($this->postdata['func']) { + case 'NewTagElement': + $this->ReturnView($viewmodel->NewTagElement($this->postdata), true); + break; + case 'SaveTagElement': + $this->ReturnView($viewmodel->SaveTagElement($this->postdata), true); + break; + case 'DeleteTag': + $this->ReturnView($viewmodel->DeleteTag($this->postdata), true); + break; + default: // EditTaglist + $this->ReturnView($viewmodel->EditTaglist($this->postdata), true); + break; + } + } + + + protected function ConfigTagsInTopic() { + //$viewmodel = new ExtractappModel(); + $viewmodel = $this->viewmodel; + switch ($this->postdata['func']) { + case 'Update': + $viewmodel->UpdateTagsInTopic($this->postdata); + break; + default: + $this->ReturnView($viewmodel->ConfigTagsInTopic($this->postdata), true); + break; + } + } + + protected function TestAction() { + $viewmodel = new ExtractappModel(); + $this->ReturnView($viewmodel->Test(), true); + } + + + + +} + + +?>