diff develop/models/extractapp.php @ 9:584b1623e9ef

TOC correction list page updated
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 09 Feb 2015 18:59:24 +0100
parents 63e08b98032f
children 54a235d43694
line wrap: on
line diff
--- a/develop/models/extractapp.php	Mon Feb 09 12:28:09 2015 +0100
+++ b/develop/models/extractapp.php	Mon Feb 09 18:59:24 2015 +0100
@@ -25,6 +25,9 @@
         $stringInput = $this->GetSectionContent();
 
         $taglistArray = $this->GetTaglistArray();
+        // test for GetTaglistByTopicID: 
+        // $taglistArray = $this->GetTaglistByTopicID(1);
+
 
         $wordlistArray = $this->GetWordlistArray();
 
@@ -231,6 +234,38 @@
         }
 
     }
+
+
+    // TODO: get taglist by choosen topic
+    private function GetTaglistByTopicID($topic_id) {
+        $taglistArray = "";
+
+        $query = "SELECT * FROM topic_tag_relation WHERE topic_id=".$topic_id;
+        $result = mysql_query($query);
+        if (!$result) {
+            return json_encode("Failed during selecting topics table.");
+        }
+
+        while ($row = mysql_fetch_assoc($result)) {
+            $tag_id = $row['tag_id'];
+            $query = "SELECT * FROM taglist WHERE id=".$tag_id;
+            $tag_result = mysql_query($query);
+            if ($tag_result) {
+                return json_encode("Failed during selecting taglist table.");
+            }
+            $row = mysql_fetch_assoc($tag_result));
+            $taglistArray[] = array( $row['id'], $row['name'], $row['tag'], $row['color'] );
+            // array_push($taglistArray, array( $row['id'], $row['name'], $row['tag'], $row['color'] ));
+        }
+
+
+        return $taglistArray;
+
+
+
+
+
+    }
     // =========================== 
 
     // === for manage wordlist ===