Esempio n. 1
0
 public function get_custom_name()
 {
     if (is_null($this->custom_name)) {
         return parent::get_custom_name();
     } else {
         return $this->custom_name;
     }
 }
Esempio n. 2
0
 /**
  * 標註轉換成文字
  * @param Annotation_type $type
  */
 private function _get_type_name_lang($type)
 {
     $type_name_lang = $type->get_name();
     if ($type->is_basic()) {
         $type_name_lang = $this->lang->line("web_apps." . $type_name_lang);
     } else {
         if ($type_name_lang === "annotation.type.custom") {
             //$type_name_lang = "annotation.type.other";
             //$type_name_lang = $this->lang->line("web_apps.".$type_name_lang);
             $type_name_lang = $type->get_custom_name();
         }
     }
     return $type_name_lang;
 }
Esempio n. 3
0
 /**
  * 取得指定對象與標註類型回應標註的名單(自己用哪些類型標註回應誰)
  * 
  * @param Webpage $webpage
  * @param User $respond_to_user 
  * @param Annotation_type $annotation_type 如果是NULL,則不限定標註類型
  * @return array | user_id
  */
 public function get_respond_to_users($user, $webpage, $annotation_type = NULL)
 {
     $webpage_id = $webpage->get_id();
     //$type_id = $annotation_type->get_type_id();
     if ($annotation_type !== NULL) {
         $type_id = $annotation_type->get_type_id();
     }
     $user_id = $user->get_id();
     //--------
     //$this->db->distinct('respond_to.user_id');
     $this->db->select('respond_to.user_id');
     $this->db->from('annotation my_res');
     $this->db->join('webpage2annotation', 'webpage2annotation.annotation_id = my_res.annotation_id');
     $this->db->join('annotation respond_to', 'my_res.topic_id = respond_to.annotation_id');
     $this->db->where('webpage_id', $webpage_id);
     $this->db->where('my_res.user_id', $user_id);
     $this->db->where('my_res.topic_id IS NOT NULL');
     // 要加入未刪除的限制啊!
     $this->db->where('my_res.deleted', 'false');
     $this->db->where('respond_to.deleted', 'false');
     $this->db->where('respond_to.user_id <>', $user_id);
     if ($annotation_type !== NULL) {
         $this->db->where('my_res.annotation_type_id', $type_id);
     }
     $this->db->group_by('respond_to.user_id');
     $query = $this->db->get();
     $respond_user = array();
     foreach ($query->result() as $row) {
         $respond_user[] = $row->user_id;
     }
     return $respond_user;
 }