diff controllers/extractapp.php @ 81:f1f849d31272 extractapp

book_id as string
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 23 Apr 2015 14:58:27 +0200
parents 960ba96efce1
children 0141df465205
line wrap: on
line diff
--- a/controllers/extractapp.php	Tue Apr 21 16:41:36 2015 +0200
+++ b/controllers/extractapp.php	Thu Apr 23 14:58:27 2015 +0200
@@ -1,10 +1,31 @@
 <?php
+/* extractapp.php
+ * This file is part of Extraction-interface.
+ *
+ * Extraction-interface is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Extraction-interface is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Extraction-interface.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
 /** 
- * Extractapp is extended from the BaseController.
- * This is where we handle the processes for every action.
+ * Extractapp class is extended from the BaseController class.
+ * It sends commands to the ExtractappModel to process or update the ExtractappModel's state. 
+ * It can also pass the commands or data (from ExtractappModel) to the associated view (files in views/Extractapp/), 
+ * for example views/Extractapp/TaggingText.php , to change the view's presentation.
  * 
- * For example, there are five actions in Extractapp, tagging text, exporting a table,
- * editing the wordlist, and configurating tags in one topic.
+ * There are five actions in Extractapp: tagging text, exporting a table,
+ * editing the wordlist, editing the taglist, and configurating tags in one topic.
+ * Each action is one of the methods in Extractapp.
+ * 
 */
 
 class Extractapp extends BaseController {
@@ -46,10 +67,10 @@
                 break;   
             case 'SaveFullTextToLGService':
                 $viewmodel->messages['info'] .= "SaveFullTextToLGService! ";
-                $viewmodel->GetInfoFromPreviousPage($this->postdata);
+                $viewmodel->SetInfoFromPreviousPage($this->postdata);
                 $response = $viewmodel->SaveFullTextToLGService($this->postdata);
                 $viewmodel->UpdateInfoResponsedFromLGService($response);    // update file_id, branch_id, user_id
-                $viewmodel->GetTextFromFileId();     
+                $viewmodel->SetTextFromFileId();     
                 $this->ReturnView($viewmodel->StartTagging(), true); 
                 break;
 
@@ -61,9 +82,9 @@
                 break;
             case 'ReloadText':
                 $viewmodel->messages['info'] .= "Reload the latest text ";
-                $viewmodel->GetInfoFromPreviousPage($this->postdata);
+                $viewmodel->SetInfoFromPreviousPage($this->postdata);
                 $viewmodel->ReloadSetting();    // set file_id = current_fileId, current_fileId = 0
-                $viewmodel->GetTextFromFileId();
+                $viewmodel->SetTextFromFileId();
                 $this->ReturnView($viewmodel->StartTagging(), true);
                 break;
 
@@ -72,7 +93,7 @@
                 if ($this->postdata['topic']) {
                     $viewmodel->SetTopic($this->postdata['topic']);
                 }
-                $viewmodel->GetInfoFromPreviousPage($this->postdata);
+                $viewmodel->SetInfoFromPreviousPage($this->postdata);
                 $this->ReturnView($viewmodel->StartTagging(), true); 
                 break;
 
@@ -84,26 +105,26 @@
                 if (isset($this->postdata['fileId'])) {
                     if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) {
                         // --- Existing branch case ---
-                        $viewmodel->GetInfoFromPreviousPage($this->postdata);
+                        $viewmodel->SetInfoFromPreviousPage($this->postdata);
                         $viewmodel->SetBookMetadataBySectionId();
                         // get text by fileId, from LGService
-                        $viewmodel->GetTextFromFileId();
+                        $viewmodel->SetTextFromFileId();
                     }
 
                 } else if ($this->postdata['sectionId'] != 0 && $this->postdata['userId'] != 0) {
                     // --- New branch case ---
-                    $viewmodel->GetInfoFromPreviousPage($this->postdata);
+                    $viewmodel->SetInfoFromPreviousPage($this->postdata);
                     $viewmodel->SetBookMetadataBySectionId();
                     // get text by sectionId from LGService
-                    $viewmodel->GetTextFromSectionId();  
+                    $viewmodel->SetTextFromSectionId();  
 
                 } else if ($this->postdata['sectionId'] != 0) { 
-                    $viewmodel->GetTextFromLocal($this->postdata['sectionId']);
+                    $viewmodel->SetTextFromLocal($this->postdata['sectionId']);
                     $viewmodel->SetBookMetadataBySectionId();
 
                 } else if (is_numeric($this->urlvalues['id'])) {
                     // get text from local file system (for development stage only)
-                    $viewmodel->GetTextFromLocal($this->urlvalues['id']);
+                    $viewmodel->SetTextFromLocal($this->urlvalues['id']);
                     $viewmodel->SetBookMetadataBySectionId();
                     $this->ReturnView_localtest($viewmodel->StartTagging(), true); 
                     break;                    
@@ -137,8 +158,8 @@
                 break;
 
             default:    // from file
-                $viewmodel->GetInfoFromPreviousPage($this->postdata);
-                $viewmodel->GetTextFromFileId();
+                $viewmodel->SetInfoFromPreviousPage($this->postdata);
+                $viewmodel->SetTextFromFileId();
                 $this->ReturnView($viewmodel->ExportTable($this->postdata, true), true);
                 break;