Mercurial > hg > extraction-interface
view develop/controllers/extractapp.php @ 13:cc36a20a68ab
automatically decide which rows (what data) should be shown in the exporting table based on the topic.
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 17 Feb 2015 15:25:11 +0100 |
parents | e82ca7375e93 |
children | ac77748bb813 |
line wrap: on
line source
<?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(), false); break; case 'SaveFullTextToLGService': echo "[Z] SaveFullTextToLGService! "; $viewmodel->GetInfoFromPreviousPage($this->postdata); $response = $viewmodel->SaveFullTextToLGService($this->postdata); $viewmodel->UpdateInfoByResponseFromLGService($response); // update file_id, branch_id, user_id $this->ReturnView($viewmodel->StartTagging(), false); break; case 'ContinueTagging': echo "[Z] (Countinue tagging) "; if ($this->postdata['topic']) { $viewmodel->SetTopic($this->postdata['topic']); } $viewmodel->GetInfoFromPreviousPage($this->postdata); $this->ReturnView($viewmodel->StartTagging(), false); break; default: // first time visit extraction interface from LGService // TODO: get the _post data from Jorge's service echo "[Z] Welcome to Extraction Interface. "; 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']); } else { var_dump($this->postdata); echo "wrong url!!"; return; } $this->ReturnView($viewmodel->StartTagging(), false); break; } } protected function ExportTable() { //$viewmodel = new ExtractappModel(); $viewmodel = $this->viewmodel; $this->ReturnView($viewmodel->ExportTable($this->postdata), false); } protected function EditWordlist() { // $viewmodel = new ExtractappModel(); $viewmodel = $this->viewmodel; switch ($this->postdata['func']) { case 'AddNewList': $this->ReturnView($viewmodel->AddNewList($this->postdata), false); break; case 'SaveWordlist': $this->ReturnView($viewmodel->SaveWordlist($this->postdata), false); break; default: // EditWordlist $this->ReturnView($viewmodel->EditWordlist($this->urlvalues), false); break; } } protected function EditTaglist() { //$viewmodel = new ExtractappModel(); $viewmodel = $this->viewmodel; switch ($this->postdata['func']) { case 'NewTagElement': $this->ReturnView($viewmodel->NewTagElement($this->postdata), false); break; case 'SaveTagElement': $this->ReturnView($viewmodel->SaveTagElement($this->postdata), false); break; case 'DeleteTag': $this->ReturnView($viewmodel->DeleteTag($this->postdata), false); break; default: // EditTaglist $this->ReturnView($viewmodel->EditTaglist($this->urlvalues), false); break; } } protected function ConfigTagsInTopic() { //$viewmodel = new ExtractappModel(); $viewmodel = $this->viewmodel; switch ($this->postdata['func']) { case 'somefunc': break; default: $this->ReturnView($viewmodel->ConfigTagsInTopic($this->postdata), false); break; } } protected function TestAction() { $viewmodel = new ExtractappModel(); $this->ReturnView($viewmodel->Test(), true); } } ?>