当前位置: 首页>>代码示例>>PHP>>正文


PHP Annotation::get_feature_location方法代码示例

本文整理汇总了PHP中Annotation::get_feature_location方法的典型用法代码示例。如果您正苦于以下问题:PHP Annotation::get_feature_location方法的具体用法?PHP Annotation::get_feature_location怎么用?PHP Annotation::get_feature_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Annotation的用法示例。


在下文中一共展示了Annotation::get_feature_location方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: annotation_thread

 /**
  * annotation_thread
  * @param type  $annotation_id
  */
 public function annotation_thread($annotation_id)
 {
     //載入libary
     $this->load->library('kals_resource/Webpage');
     $this->load->library('kals_resource/Annotation');
     $this->load->library('scope/Scope_anchor_text');
     $this->load->library('search/Search_annotation_collection');
     // 語系
     $this->lang->load('kals_web_apps');
     // 接收-送回應值
     // 用post接收textarea的值:array
     $data = array();
     if (isset($_POST["note_text"])) {
         $note_massage = $_POST["note_text"];
         $data["note_massage"] = $note_massage;
     }
     // radio-type
     if (isset($_POST["annotation_type"])) {
         $anno_type = $_POST["annotation_type"];
         $data['pop_type'] = $anno_type;
     }
     $annotation_self_id = $annotation_id;
     // check topic id
     $is_topic_id = NULL;
     if (isset($annotation_id)) {
         $topic_array = $this->db->query("SELECT topic_id\n                                   FROM annotation\n                                   WHERE annotation_id ='" . $annotation_id . "'");
         foreach ($topic_array->result_array() as $row) {
             $is_topic_id = $row['topic_id'];
         }
     }
     if ($is_topic_id !== NULL) {
         //is respond id
         $annotation_id = $is_topic_id;
     }
     //echo 'annotation_id ='.$annotation_id.'/';
     //echo 'topic_id = '.$is_topic_id.'/';
     // $login_test = $this->session->userdata('logged_in');
     //echo 'loggin = '.$login_test.'/';
     // $annotation_id
     $annotation = new Annotation($annotation_id);
     $annotation_id = $annotation->get_id();
     $log_topic_id = $annotation_id;
     $anchor_text = $annotation->get_anchor_text();
     $user = $annotation->get_user()->get_name();
     $user_id = $annotation->get_user()->get_id();
     $type = $annotation->get_type()->get_name();
     $css_type = $annotation->get_type()->get_type_id();
     $note = $annotation->get_note();
     $timestamp = $annotation->get_update_timestamp();
     //$log_user_id = $this->session->userdata('user_id');
     //echo $this->session->userdata('user_id').'??';
     //echo $this->session->userdata('logged_in').'??';
     $login_user = get_context_user();
     $log_user_id = NULL;
     $logged_id = FALSE;
     if (isset($login_user)) {
         $log_user_id = $login_user->get_id();
         $logged_id = TRUE;
     }
     // 如果有回應值才要做新增的動作
     if (isset($note_massage) && isset($anno_type)) {
         // 開始新增標註回應
         //先將權限設成管理者
         set_ignore_authorize(true);
         //取得參考網址(全文網址)資料($url)跟現在登入(session)的user
         //$user_now = $this->session->userdata('user_id');
         $user_now = get_context_user();
         //建立範圍(使用topic_id取得)
         $scope_coll = $annotation->get_scopes();
         //開始建立回應標註
         $new_res_annotation = $annotation->create_annotation($user_now, $scope_coll);
         $type_id = $anno_type;
         //設定標註細節
         //echo 'set annotation detail ->';
         //type
         if (isset($type_id)) {
             $new_res_annotation->set_type($type_id);
         } else {
             echo 'no type_id';
         }
         set_ignore_authorize(true);
         //note
         if (isset($note_massage) && $note_massage !== '') {
             $new_res_annotation->set_note($note_massage);
         } else {
             echo 'no note_msg';
         }
         //標註錨點範圍的特徵(feature location)
         $feature_location = $annotation->get_feature_location();
         if (isset($feature_location)) {
             $new_res_annotation->set_feature_location($feature_location);
         } else {
             echo 'no feature_location';
         }
         //設定respond_topic_id
         $topic_id = $annotation_id;
//.........这里部分代码省略.........
开发者ID:119155012,项目名称:kals,代码行数:101,代码来源:mobile.php

示例2: get_feature

 protected function get_feature(Annotation $annotation)
 {
     $feature = $annotation->get_feature_location();
     //test_msg('lang location get_feature ' . $annotation->get_id(), $feature);
     return $feature;
 }
开发者ID:119155012,项目名称:kals,代码行数:6,代码来源:Language_variable_location.php

示例3: _print_annotation_table

 /**
  * 輸出Annotation的資料
  * @param Annotation $annotation
  * @return string
  */
 private function _print_annotation_table($annotation, &$last_scope)
 {
     $annotation_id = $annotation->get_id();
     $text = '<a name="annotation_' . $annotation_id . '" id="annotation_' . $annotation_id . '"></a><table class="annotation_table"  cellspacing="0" cellpadding="0"><tbody>';
     $scope_collection = $annotation->get_scopes();
     $scope = $scope_collection->get_item(0);
     $from_index = $scope->get_from_index();
     $to_index = $scope->get_to_index();
     if (is_null($last_scope) or !($last_scope[0] == $from_index and $last_scope[1] == $to_index)) {
         $last_scope = array($from_index, $to_index);
         $scope_length = $annotation->get_scope_length();
         $from_to = $from_index;
         if ($from_index != $to_index) {
             $from_to .= '-' . $to_index;
         }
         $anchor_text = $annotation->get_anchor_text();
         $speech = $annotation->get_anchor_speech();
         $speech_list = '';
         foreach ($speech as $s) {
             if ($speech_list != '') {
                 $speech_list .= ', ';
             }
             $speech_list .= $s;
         }
         if ($speech_list == '') {
             $speech_list = '(剖析失敗)';
         }
         //位置
         $location = $annotation->get_feature_location();
         $location_list = '';
         foreach ($location as $l) {
             if ($location_list != '') {
                 $location_list .= ', ';
             }
             $name = '其他';
             $l = intval($l);
             if ($l == 4) {
                 $name = '結尾';
             } else {
                 if ($l == 0) {
                     $name = '開頭';
                 } else {
                     if ($l == 1) {
                         $name = '接近開頭';
                     } else {
                         if ($l == 3) {
                             $name = '接近結尾';
                         } else {
                             if ($l == 5) {
                                 $name = '只有一句';
                             } else {
                                 if ($l == 2) {
                                     $name = '三句中間一句';
                                 }
                             }
                         }
                     }
                 }
             }
             $location_list .= $name . '(' . $l . ')';
         }
         if ($location_list == '') {
             $location_list = '其他';
         }
         $text .= '<tr> <td> <table class="anchor_row" border="1" cellpadding="0" cellspacing="0"><tbody>' . '<tr><th>範圍</th><td>' . $from_to . ' (' . $scope_length . '字)</td><th>詞性(' . count($speech) . ')</th><td>' . $speech_list . '</td><th>位置</th><td>' . $location_list . '</td></tr>' . '<tr><th>錨點文字</th><td colspan="5">' . $anchor_text . '</td></tr>' . '</tbody></table> </td> </tr>';
     }
     //第一列
     //
     // email 發表日期 修改日期 被喜愛 被共識 被回應 編號
     $email = $annotation->get_user()->get_email();
     $print_email = substr($email, 0, 8);
     $print_email = '<a href="' . site_url('/admin_apps/exp201012annotation/email_list/' . $this->_find_email_key($email)) . '">' . $print_email . '</a>';
     //類別
     $type_name = $annotation->get_type()->get_name();
     $type_name_lang = $this->lang->line('web_apps.' . $type_name);
     $type_name_classname = substr($type_name, strrpos($type_name, '.') + 1);
     $create_timestamp = $annotation->get_create_timestamp();
     //2010-12-08 23:17:10.984+08
     //01234567890123456789
     $create_timestamp = $this->_trim_timestamp($create_timestamp);
     $update_timestamp = $annotation->get_update_timestamp();
     $update_timestamp = $this->_trim_timestamp($update_timestamp);
     $liked_count = $annotation->get_like_count();
     $consensus_count = $annotation->get_consensus_count();
     $topic_respond_count = $annotation->get_topic_respond_coll()->length();
     $text .= '<tr> <td> <table class="row" border="1" cellpadding="0" cellspacing="0"><tbody><tr>' . '<th class="email">' . $print_email . '</th>' . '<th class="type ' . $type_name_classname . '">' . $type_name_lang . '</th>' . '<th>建立日期:</th><td class="date">' . $create_timestamp . '</td>' . '<th>修改日期:</th><td class="date">' . $update_timestamp . '</td>' . '<td class="annotation_id">#' . $annotation_id . '</td>' . '</tr></tbody></table> </td> </tr>';
     //第二列
     //  標註類別 位置 分數 建議的ID 推薦的ID 接受建議間隔
     //分數
     $score = $annotation->get_score(0)->get_score();
     //是否有建議?顯示建議的ID
     $query = $this->db->select('recommend_id, accept, (checked_timestamp - annotation.create_timestamp) as check_interval, recommend_by_annotation_id')->from('recommend join annotation on recommended_annotation_id = annotation.annotation_id')->where('recommended_annotation_id', $annotation_id)->get();
     $recommend_table;
     if ($query->num_rows() == 0) {
         $recommend_table = '沒有建議';
//.........这里部分代码省略.........
开发者ID:119155012,项目名称:kals,代码行数:101,代码来源:exp201012annotation.php


注:本文中的Annotation::get_feature_location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。