コード例 #1
0
ファイル: annotation_getter.php プロジェクト: 119155012/kals
 /**
  * 取得tooltip指定的標註
  * @param int $annotation_index 標註的位置
  * @param string $callback
  */
 public function tooltip($annotation_index, $callback)
 {
     // -------------
     // 搜尋
     //$annotation_index = 100000;
     $search = new Search_annotation_collection();
     // 限定範圍
     $search->set_overlap_scope_index($annotation_index, $annotation_index);
     // 依照分數排序,由高到低
     $search->add_order(1, TRUE);
     // 只輸出一份
     //$search->set_limit(1);
     // 限定該網頁
     $search->set_target_referer_webpage();
     //--------------
     // 轉換資料
     //$annotation = new Annotation();
     //$annotation = null;
     $annotation = null;
     $output_data = array();
     $result = null;
     foreach ($search as $search_annotation) {
         $annotation = $search_annotation;
         $result = $annotation->get_id();
         $output_data["annotation"] = $annotation->export_data();
         break;
     }
     $output_data["count"] = $search->length();
     //--------------
     // 記錄
     $action = 35;
     $log_note = array('index' => $annotation_index, 'result' => $result);
     kals_log($this->db, $action, $log_note);
     context_complete();
     // -------------
     // 輸出
     return $this->_display_jsonp($output_data, $callback);
 }