Пример #1
0
 /**
  * 取得自己喜愛的標註list
  * @param Webpage $webpage
  * @return Annotation_collection
  */
 public function get_like_to_annotation($user, Webpage $webpage)
 {
     $webpage_id = $webpage->get_id();
     // use to test
     //$user_id = 2002;
     $user_id = $user->get_id();
     //--------
     $this->db->select('annotation2like.annotation_id');
     $this->db->from('annotation2like');
     $this->db->join('webpage2annotation', 'webpage2annotation.annotation_id = annotation2like.annotation_id');
     $this->db->where('user_id', $user_id);
     $this->db->where('webpage_id', $webpage_id);
     // 要加入未刪除的限制啊!
     $this->db->where("canceled", "false");
     $query = $this->db->get();
     //$count = $query->num_rows();
     $like_to = new Annotation_collection();
     foreach ($query->result() as $row) {
         $like_to->add_item(new Annotation($row->annotation_id));
         //$like_to[] = new Annotation($row->annotation_id);
     }
     return $like_to;
     //return $count;
 }