comparison classes/basemodel.php @ 97:c1bb174a22f3 extractapp

Topic synchronization with LGServices. Adaption for moving table from Gazetteer to LGService.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 16 Feb 2016 15:07:43 +0100
parents f1f849d31272
children
comparison
equal deleted inserted replaced
96:ce7e933b18b0 97:c1bb174a22f3
84 } 84 }
85 return $theValue; 85 return $theValue;
86 } 86 }
87 87
88 protected function GetWordlist() { 88 protected function GetWordlist() {
89 $query = sprintf("SELECT * FROM `wordlist` WHERE `systemName`='%s' ORDER BY `name` ASC", $this->systemNAME); 89 $query = sprintf("SELECT * FROM `Wordlist` ORDER BY `name` ASC");
90 $result = mysql_query($query); 90 $result = mysql_query($query);
91 if (!$result){ 91 if (!$result){
92 return json_encode("Failed during selecting wordlist table.");; 92 return json_encode("Failed during selecting Wordlist table.");;
93 } 93 }
94 return $result; 94 return $result;
95 } 95 }
96 96
97 /*
97 protected function GetSectionsById($section_id) { 98 protected function GetSectionsById($section_id) {
98 $query = sprintf("SELECT * FROM `sections_index` WHERE `id`=\"%s\"", $section_id); 99 $query = sprintf("SELECT * FROM `sections_index` WHERE `id`=\"%s\"", $section_id);
99 $result = mysql_query($query); 100 $result = mysql_query($query);
100 if (!$result){ 101 if (!$result){
101 echo json_encode("Failed during selecting sections_index table"); 102 echo json_encode("Failed during selecting sections_index table");
102 return; 103 return;
103 } 104 }
104 return $result; 105 return $result;
105 } 106 }
107 */
106 108
107 protected function GetTaglist() { 109 protected function GetTaglist() {
108 $query = sprintf("SELECT * FROM `taglist` WHERE `systemName`='%s' ORDER BY `tag` ASC", $this->systemNAME); 110 //$query = sprintf("SELECT * FROM `Taglist` WHERE `systemName`='%s' ORDER BY `tag` ASC", $this->systemNAME);
111 $query = sprintf("SELECT * FROM `Taglist` ORDER BY `tag` ASC");
109 $result = mysql_query($query); 112 $result = mysql_query($query);
110 if (!$result) { 113 if (!$result) {
111 return json_encode("Failed during selecting taglist table."); 114 return json_encode("Failed during selecting Taglist table.");
112 } 115 }
113 return $result; 116 return $result;
114 } 117 }
115 118
119 /*
116 protected function GetBooksById($bookId) { 120 protected function GetBooksById($bookId) {
117 $query = sprintf("SELECT * FROM `books` WHERE id=\"%s\"", $bookId); 121 $query = sprintf("SELECT * FROM `books` WHERE id=\"%s\"", $bookId);
118 $result = mysql_query($query); 122 $result = mysql_query($query);
119 if (!$result) { 123 if (!$result) {
120 return json_encode("Failed during selecting books table."); 124 return json_encode("Failed during selecting books table.");
121 } 125 }
122 return $result; 126 return $result;
123 } 127 }
128 */
129
130 protected function GetTagIdByTag($tag) {
131 $query = sprintf("SELECT * FROM `Taglist` WHERE `tag`='%s'", $tag);
132 $result = mysql_query($query);
133 if (!$result) {
134 return json_encode("Failed during selecting Taglist table.");
135 }
136 return $result["id"];
137 }
124 138
125 protected function GetTopicList() { 139 protected function GetTopicList() {
126 $query = sprintf("SELECT * FROM `topics`"); 140 //$query = sprintf("SELECT * FROM `topics`");
141 $query = sprintf("SELECT * FROM `Topic`");
127 $result = mysql_query($query); 142 $result = mysql_query($query);
128 if (!$result) { 143 if (!$result) {
129 return json_encode("Failed during selecting topics table."); 144 return json_encode("Failed during selecting Topic table.");
130 } 145 }
131 return $result; 146 return $result;
132 } 147 }
133 148
134 protected function GetTopicById($topic_id) { 149 protected function GetTopicById($topic_id) {
135 $query = sprintf("SELECT * FROM `topics` WHERE id=\"%s\"", $topic_id); 150 //$query = sprintf("SELECT * FROM `topics` WHERE id=\"%s\"", $topic_id);
151 $query = sprintf("SELECT * FROM `Topic` WHERE id=\"%s\"", $topic_id);
136 $result = mysql_query($query); 152 $result = mysql_query($query);
137 if (!$result) { 153 if (!$result) {
138 return json_encode("Failed during selecting topics table."); 154 return json_encode("Failed during selecting Topic table.");
139 } 155 }
140 return $result; 156 return $result;
141 } 157 }
142 158
143 159