comparison develop/models/extractapp.php @ 45:3d6b8fb7335d extractapp

lock the topic tag when edit tag list
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Fri, 13 Mar 2015 14:47:23 +0100
parents c245d54eab9f
children b3ca5d2b4d3f
comparison
equal deleted inserted replaced
43:807d3bb33da7 45:3d6b8fb7335d
713 713
714 $topic_id = $_postdata['topic_id']; 714 $topic_id = $_postdata['topic_id'];
715 $result = $this->GetTaglistByTopicID($topic_id); 715 $result = $this->GetTaglistByTopicID($topic_id);
716 716
717 $taglistArray = array(); 717 $taglistArray = array();
718
718 foreach ($result as $row) { 719 foreach ($result as $row) {
719 $taglistArray[$row[0]] = array($row[1], $row[2], $row[3]); 720 $taglistArray[$row[0]] = array($row[1], $row[2], $row[3]);
720 //$taglistArray[$row['id']] = array($row['name'], $row['tag'], $row['color']); 721 //$taglistArray[$row['id']] = array($row['name'], $row['tag'], $row['color']);
721 // TODO: the format is not good, so I use $row[0], $row[1],... This could be changed some time. 722 // TODO: the format is not good, so I use $row[0], $row[1],... This could be changed some time.
722 } 723 }
723 724
724 /* 725 $topic_tag_name = $this->GetTopicTag($topic_id);
725 //$result = $this->GetTaglist(); 726
726 $taglistArray = array(); 727 $query = "SELECT id FROM taglist WHERE taglist.tag='".$topic_tag_name."'";
727 while ($row = mysql_fetch_assoc($result)) { 728 $result = mysql_query($query);
728 $taglistArray[$row['id']] = array($row['name'], $row['tag'], $row['color']); 729 if (!$result) {
729 } 730 echo json_encode(mysql_error());
730 */ 731 }
732 $row = mysql_fetch_assoc($result);
733 $topic_tag_id = $row['id'];
731 734
732 $data = array(); 735 $data = array();
733 $data['taglistArray'] = $taglistArray; 736 $data['taglistArray'] = $taglistArray;
734 $data['topic_id'] = $topic_id; 737 $data['topic_id'] = $topic_id;
735 $data['largest_id'] = $largest_id; 738 $data['largest_id'] = $largest_id;
739 $data['topic_tag_id'] = $topic_tag_id;
736 740
737 741
738 return $data; 742 return $data;
739 743
740 } 744 }