Mercurial > hg > extraction-interface
diff develop/models/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 diff
--- a/develop/models/extractapp.php Mon Feb 16 16:51:39 2015 +0100 +++ b/develop/models/extractapp.php Tue Feb 17 15:25:11 2015 +0100 @@ -8,7 +8,7 @@ return array("Index Value 1", "Value 2", "Value 3"); } - protected $section_id, $data_path, $file_id, $branch_id, $user_id, $lg_tex; + protected $section_id=0, $data_path, $file_id=0, $branch_id=0, $user_id=0, $lg_text=""; private function Initialize($_urlvalues) { $this->SetSectionId($_urlvalues); @@ -186,7 +186,7 @@ } - public function UpdateInfoByResonseFromLGService($response) { + public function UpdateInfoByResponseFromLGService($response) { $response_file = $response["file"]; $response_branch = $response["branch"]; @@ -288,19 +288,15 @@ } // === for export table === - public function ExportTable($urlvalues, $postdata) { + public function ExportTable($postdata) { // $this->Initialize($urlvalues); + $content = $postdata['content']; $topic = $postdata['topic']; + $section_id = $this->section_id; - // outputTableArray: - // $section_id = $this->GetSectionId(); - $section_id = $this->section_id; - if (!$section_id) { - //$this->Initialize($urlvalues); - $section_id = $this->GetSectionId(); - } + // TODO: this should be get from LGServic: sectionName, bookId, bookName $section_info = $this->GetSectionInfo(); $sectionName = $section_info['sectionName']; @@ -308,11 +304,12 @@ $books_info = $this->GetBooksInfo($bookId); $bookName = $books_info['bookName']; + // ===== + $outputTableArray = array(); //$taglistArray = $this->GetTaglistArray(); - $taglistArray = $this->GetTaglistByTopicID($topic); $outputTableArray[0]=array(); @@ -377,13 +374,17 @@ echo "<br>"."DEBUG: outputTableArray:"."<br>"; var_dump($outputTableArray); */ + + $topic_tag = $this->GetTopicTag($topic); foreach ( $outputTableArray as $arrayIndex => $arrayValue ) { // output each row which the topic tag - // e.g. the original version is for 'person' - - // TODO: choose topic tag based on the topic - // for person topic + // e.g. the original version is for 'person' + if ( !isset($arrayValue[0][$topic_tag]) ) { + unset($outputTableArray[$arrayIndex]); + } + + /* if ($topic == 1) { if ( !isset($arrayValue[0]["person"]) ) { unset($outputTableArray[$arrayIndex]); @@ -395,10 +396,10 @@ unset($outputTableArray[$arrayIndex]); } } + */ } - $data = array(); $data['outputTableArray'] = $outputTableArray; @@ -565,7 +566,6 @@ // === for manage wordlist === public function EditWordlist($urlvalues) { - //$this->Initialize($urlvalues); $result = $this->GetWordlist(); $wordlistArray = array(); while ($row = mysql_fetch_assoc($result)) {