# HG changeset patch # User Zoe Hong # Date 1427387146 -3600 # Node ID f9594c240826a679f8eece381e711e4b4bba0a77 # Parent 94064f625650a3f4ea0357c0241607d9c91afbed get/update text after saving, for xml file consistency diff -r 94064f625650 -r f9594c240826 controllers/extractapp.php --- a/controllers/extractapp.php Thu Mar 26 16:23:33 2015 +0100 +++ b/controllers/extractapp.php Thu Mar 26 17:25:46 2015 +0100 @@ -27,6 +27,8 @@ $viewmodel->GetInfoFromPreviousPage($this->postdata); $response = $viewmodel->SaveFullTextToLGService($this->postdata); $viewmodel->UpdateInfoByResponseFromLGService($response); // update file_id, branch_id, user_id + // TODO: GetTextFromFileId?? reload saved file from LGService, necessary! + $viewmodel->GetTextFromFileId(); $this->ReturnView($viewmodel->StartTagging(), true); break; @@ -55,10 +57,14 @@ if ($this->postdata['fileId'] != 0) { // ($this->postdata['branchId'] != 0) { // get text from fileId, from LGService - $viewmodel->GetTextFromFileId($this->postdata); + $viewmodel->GetInfoFromPreviousPage($this->postdata); + $viewmodel->GetTextFromFileId(); + } else if ($this->postdata['sectionId'] != 0 && $this->postdata['userId'] != 0) { // get text from sectionId from LGService - $viewmodel->GetTextFromSectionId($this->postdata); + $viewmodel->GetInfoFromPreviousPage($this->postdata); + $viewmodel->GetTextFromSectionId(); + } else if ($this->postdata['sectionId'] != 0) { $viewmodel->GetTextFromLocal($this->postdata['sectionId']); diff -r 94064f625650 -r f9594c240826 models/extractapp.php --- a/models/extractapp.php Thu Mar 26 16:23:33 2015 +0100 +++ b/models/extractapp.php Thu Mar 26 17:25:46 2015 +0100 @@ -17,7 +17,8 @@ } - public function GetTextFromFileId($_postdata) { + public function GetTextFromFileId() { // remove $_postdata as input + /* $this->file_id = $_postdata['fileId']; $branch_id = $_postdata['branchId']; $section_id = $_postdata['sectionId']; @@ -29,6 +30,7 @@ $this->section_name = $_postdata['sectionName']; $this->book_id = $_postdata['bookId']; $this->book_name = $_postdata['bookName']; + */ // get from URL with file_id $lg_text_url = $this->get_text_from_fileId_url.$this->file_id; @@ -50,7 +52,8 @@ } - public function GetTextFromSectionId($_postdata) { + public function GetTextFromSectionId() { // remove $_postdata as input + /* $section_id = $_postdata['sectionId']; $this->section_id = $section_id; $this->user_id = $_postdata['userId']; @@ -58,14 +61,16 @@ $this->section_name = $_postdata['sectionName']; $this->book_id = $_postdata['bookId']; $this->book_name = $_postdata['bookName']; + */ // get from URL with file_id - $lg_text_url = $this->get_text_from_sectionId_url.$section_id; + // $lg_text_url = $this->get_text_from_sectionId_url.$section_id; + $lg_text_url = $this->get_text_from_sectionId_url.$this->section_id; $lg_text = file_get_contents($lg_text_url); // TODO: get book_meta from $_postdata and set $this->book_meta: book_id,book_name,author,year,pagenumber $book_meta = array(); - array_push($book_meta, array($this->book_id,$this->book_name,"NULL","NULL","NULL")); // missing author,year,pagenumber + array_push($book_meta, array($this->book_id,$this->book_name,"no_data","no_data","no_data")); // missing author,year,pagenumber $this->book_meta = $book_meta;