comparison models/extractapp.php @ 65:f9ae94a9b041 extractapp

New: adding topic names: name_en, name_ch, name_pinyin
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 02 Apr 2015 11:45:09 +0200
parents 3395385476d1
children e71a437ae49f
comparison
equal deleted inserted replaced
64:ca6bf3532830 65:f9ae94a9b041
314 $text .= "</tagitem>\n"; 314 $text .= "</tagitem>\n";
315 } 315 }
316 316
317 // text_content 317 // text_content
318 $text .= $text_content; 318 $text .= $text_content;
319 $text .= "\n</text>"; 319 $text .= "</text>";
320 320
321 return $text; 321 return $text;
322 } 322 }
323 public function SaveFullTextToLGService($_postdata) { 323 public function SaveFullTextToLGService($_postdata) {
324 // save tagged text (full text) by Jorge's API to lg service 324 // save tagged text (full text) by Jorge's API to lg service
348 //$require = preg_replace("/<br>/u", "\n", $require); 348 //$require = preg_replace("/<br>/u", "\n", $require);
349 349
350 350
351 if ($_postdata['branchId'] == 0) { 351 if ($_postdata['branchId'] == 0) {
352 // -- new branch case 352 // -- new branch case
353 $require = "<text_content>\n".$require."</text_content>\n"; 353 $require = "<text_content>".$require."</text_content>\n";
354 } 354 }
355 $require = $this->AppendMetaData($require); 355 $require = $this->AppendMetaData($require);
356 356
357 //saving in my local machine in developing phrase 357 //saving in my local machine in developing phrase
358 if ($AT_LOCAL) { 358 if ($AT_LOCAL) {
737 // === for config topic === 737 // === for config topic ===
738 public function ConfigTagsInTopic($postdata) { 738 public function ConfigTagsInTopic($postdata) {
739 $topic = $postdata['topic']; 739 $topic = $postdata['topic'];
740 $result = $this->GetTopicByID($topic); 740 $result = $this->GetTopicByID($topic);
741 $row = mysql_fetch_assoc($result); 741 $row = mysql_fetch_assoc($result);
742 $topic_name = $row['name']; 742 $topic_name_en = $row['name_en'];
743 $topic_name_ch = $row['name_ch'];
744 $topic_name_pinyin = $row['name_pinyin'];
743 745
744 /* 746 /*
745 $query = "SELECT taglist.*, topic_tag_relation.topic_id FROM taglist LEFT JOIN topic_tag_relation ON taglist.id = topic_tag_relation.tag_id ORDER BY `topic_id`"; 747 $query = "SELECT taglist.*, topic_tag_relation.topic_id FROM taglist LEFT JOIN topic_tag_relation ON taglist.id = topic_tag_relation.tag_id ORDER BY `topic_id`";
746 $result = mysql_query($query); 748 $result = mysql_query($query);
747 if (!$result) { 749 if (!$result) {
811 813
812 814
813 $data = array(); 815 $data = array();
814 //$data['taglistArray'] = $taglistArray; 816 //$data['taglistArray'] = $taglistArray;
815 $data['topic'] = $topic; 817 $data['topic'] = $topic;
816 $data['topic_name'] = $topic_name; 818 $data['topic_name'] = array('name_en'=>$topic_name_en,'name_ch'=>$topic_name_ch,'name_pinyin'=>$topic_name_pinyin);
817 819
818 $data['tag_intopic'] = $tag_intopic; 820 $data['tag_intopic'] = $tag_intopic;
819 $data['tag_others'] = $tag_others; 821 $data['tag_others'] = $tag_others;
820 822
821 return $data; 823 return $data;
962 964
963 private function GetTopiclistArray() { 965 private function GetTopiclistArray() {
964 $topiclistArray = array(); 966 $topiclistArray = array();
965 $result = $this->GetTopiclist(); 967 $result = $this->GetTopiclist();
966 while ($row = mysql_fetch_assoc($result)) { 968 while ($row = mysql_fetch_assoc($result)) {
967 array_push($topiclistArray, array('id'=>$row['id'],'name'=>$row['name'],'tag'=>$row['tag'])); 969 //array_push($topiclistArray, array('id'=>$row['id'],'name'=>$row['name'],'tag'=>$row['tag']));
970 array_push($topiclistArray, array('id'=>$row['id'],'tag'=>$row['tag'],'name_en'=>$row['name_en'],'name_ch'=>$row['name_ch'],'name_pinyin'=>$row['name_pinyin'],));
968 } 971 }
969 return $topiclistArray; 972 return $topiclistArray;
970 } 973 }
971 974
972 975
978 981
979 } 982 }
980 private function GetTopicName($topic_id) { 983 private function GetTopicName($topic_id) {
981 $result = $this->GetTopicByID($topic_id); 984 $result = $this->GetTopicByID($topic_id);
982 $row = mysql_fetch_assoc($result); 985 $row = mysql_fetch_assoc($result);
983 $name = $row['name']; 986 //$name = $row['name'];
987 $name = array('name_en'=>$row['name_en'], 'name_ch'=>$row['name_ch'], 'name_pinyin'=>$row['name_pinyin']);
984 return $name; 988 return $name;
985 989
986 } 990 }
987 991
988 992