Mercurial > hg > extraction-interface
diff develop/models/extractapp.php @ 11:3d6fba07bfbd
implemented for topic tag. tagging with topic tag (main tag) indicating each row when export to html.
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 11 Feb 2015 12:33:59 +0100 |
parents | 54a235d43694 |
children | e82ca7375e93 |
line wrap: on
line diff
--- a/develop/models/extractapp.php Tue Feb 10 16:20:29 2015 +0100 +++ b/develop/models/extractapp.php Wed Feb 11 12:33:59 2015 +0100 @@ -13,6 +13,7 @@ private function Initialize($_urlvalues) { $this->SetSectionId($_urlvalues); + } // === for tagging === @@ -42,6 +43,7 @@ $data['section_id'] = $section_id; $data['topiclistArray'] = $topiclistArray; $data['default_topic_id'] = $this->GetTopic(); + $data['topic_tag'] = $this->GetTopicTag($this->GetTopic()); return $data; @@ -76,8 +78,8 @@ public function ExportTable($urlvalues, $postdata) { $this->Initialize($urlvalues); $content = $postdata['content']; + $topic = $postdata['topic']; - // outputTableArray: $section_id = $this->GetSectionId(); @@ -91,8 +93,10 @@ $outputTableArray = array(); - $taglistArray = $this->GetTaglistArray(); + //$taglistArray = $this->GetTaglistArray(); + $taglistArray = $this->GetTaglistByTopicID($topic); + $outputTableArray[0]=array(); $outputTableArray[0][0]=array(); $outputTableArray[0][1]=array(); @@ -151,11 +155,29 @@ $value = preg_replace("/</u", "<", $value); $outputTableArray[$count]["full"] = $value; } + /* + echo "<br>"."DEBUG: outputTableArray:"."<br>"; + var_dump($outputTableArray); + */ foreach ( $outputTableArray as $arrayIndex => $arrayValue ) { - if ( !isset($arrayValue[0]["person"]) ) { - unset($outputTableArray[$arrayIndex]); + // 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 + if ($topic == 1) { + if ( !isset($arrayValue[0]["person"]) ) { + unset($outputTableArray[$arrayIndex]); + } + } else if ($topic == 2) { + + // for object topic + if ( !isset($arrayValue[0]["object"]) ) { // only the record with the tag of 'object' will become a row + unset($outputTableArray[$arrayIndex]); + } } + } @@ -240,7 +262,9 @@ } // === for config topic === - + public function ConfigTagsInTopic($urlvalues, $postdata) { + + } private function GetTaglistByTopicID($topic_id) { $taglistArray = array(); @@ -284,11 +308,20 @@ $topiclistArray = array(); $result = $this->GetTopiclist(); while ($row = mysql_fetch_assoc($result)) { - array_push($topiclistArray, array('id'=>$row['id'],'name'=>$row['name'])); + array_push($topiclistArray, array('id'=>$row['id'],'name'=>$row['name'],'tag'=>$row['tag'])); } return $topiclistArray; } + + private function GetTopicTag($topic_id) { + $result = $this->GetTopicByID($topic_id); + $row = mysql_fetch_assoc($result); + $tag = $row['tag']; + return $tag; + + } + // =========================== // === for manage wordlist === @@ -469,7 +502,6 @@ } return $taglistArray; - } private function GetWordlistArray() {