comparison 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
comparison
equal deleted inserted replaced
8:da10158c6d0a 9:584b1623e9ef
23 $section_id = $this->GetSectionId(); 23 $section_id = $this->GetSectionId();
24 24
25 $stringInput = $this->GetSectionContent(); 25 $stringInput = $this->GetSectionContent();
26 26
27 $taglistArray = $this->GetTaglistArray(); 27 $taglistArray = $this->GetTaglistArray();
28 // test for GetTaglistByTopicID:
29 // $taglistArray = $this->GetTaglistByTopicID(1);
30
28 31
29 $wordlistArray = $this->GetWordlistArray(); 32 $wordlistArray = $this->GetWordlistArray();
30 33
31 $data = array(); 34 $data = array();
32 $data['stringInput'] = $stringInput; 35 $data['stringInput'] = $stringInput;
229 $queryInsert = sprintf("DELETE FROM `taglist` WHERE `id` = %s", stripslashes($postdata['id'])); 232 $queryInsert = sprintf("DELETE FROM `taglist` WHERE `id` = %s", stripslashes($postdata['id']));
230 $resultInsert = mysql_query($queryInsert); 233 $resultInsert = mysql_query($queryInsert);
231 } 234 }
232 235
233 } 236 }
237
238
239 // TODO: get taglist by choosen topic
240 private function GetTaglistByTopicID($topic_id) {
241 $taglistArray = "";
242
243 $query = "SELECT * FROM topic_tag_relation WHERE topic_id=".$topic_id;
244 $result = mysql_query($query);
245 if (!$result) {
246 return json_encode("Failed during selecting topics table.");
247 }
248
249 while ($row = mysql_fetch_assoc($result)) {
250 $tag_id = $row['tag_id'];
251 $query = "SELECT * FROM taglist WHERE id=".$tag_id;
252 $tag_result = mysql_query($query);
253 if ($tag_result) {
254 return json_encode("Failed during selecting taglist table.");
255 }
256 $row = mysql_fetch_assoc($tag_result));
257 $taglistArray[] = array( $row['id'], $row['name'], $row['tag'], $row['color'] );
258 // array_push($taglistArray, array( $row['id'], $row['name'], $row['tag'], $row['color'] ));
259 }
260
261
262 return $taglistArray;
263
264
265
266
267
268 }
234 // =========================== 269 // ===========================
235 270
236 // === for manage wordlist === 271 // === for manage wordlist ===
237 public function EditWordlist($urlvalues) { 272 public function EditWordlist($urlvalues) {
238 $this->Initialize($urlvalues); 273 $this->Initialize($urlvalues);