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


PHP Annotation::get_note方法代码示例

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


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

示例1: index

 function index()
 {
     $url = 'http://www.plurk.com/p/6esun8#response-1799208331';
     $annotation = $this->annotation->find('annotation_id', 1017);
     $this->unit->run($annotation->get_id(), 1017, '接受推薦之前,原本的標註還在');
     $annotation = new Annotation(1017);
     $original_annotation_id = $annotation->get_id();
     $original_note = $annotation->get_note();
     $recommend_annotation = new Annotation(783);
     $recommend = new Annotation_recommend();
     $recommend->set_webpage($url);
     $recommend->set_recommended($annotation);
     $recommend->set_recommend_by($recommend_annotation);
     $recommend->update();
     $this->unit->run($recommend->get_id(), 'is_int', '確認recommend有儲存進去');
     $annotation = new Annotation(1017);
     $recommend = $annotation->get_recommend();
     $this->unit->run($recommend->get_id(), 'is_int', '能從annotation中取得recommend嗎?');
     $this->unit->run($recommend->get_recommend_by()->get_id(), $recommend_annotation->get_id(), '從recommend中取出的recommend_by,跟先前推薦的一樣嗎?');
     $tips = $recommend->get_tips_text_array();
     $this->unit->run(count($tips), 'is_int', '從recommend中取出的get_tips_text_array(),有提示嗎?');
     foreach ($tips as $key => $tip) {
         $this->unit->run($tip, 'is_string', '從recommend中取出的get_tips_text_array(),看一下第' . $key . '個提示');
     }
     //-----------------------------------------------
     $length = $annotation->get_scope_length();
     $recommend_length = $recommend_annotation->get_scope_length();
     $this->unit->run_false($length, $recommend_length, '測試看看,標註跟推薦標註兩個的長度應該不一樣才對');
     $recommend = $annotation->get_recommend();
     $annotation = $recommend->set_accept(TRUE);
     $length = $annotation->get_scope_length();
     $this->unit->run($length, $recommend_length, '接受推薦之後,標註跟推薦標註兩個的長度應該一樣才對');
     $this->unit->run_false($annotation->get_id(), $original_annotation_id, '接受推薦之後,這個標註應該跟上面的不一樣');
     $this->unit->run_false($annotation->get_score(0)->get_score() . '', '0', '接受推薦之後,修改過後的標註應該有分數?');
     $this->unit->run($annotation->get_note(), $original_note, '接受推薦之後,修改過後的標註應該有原本的筆記?');
     $recommend = $annotation->get_recommend();
     $this->unit->run($recommend, NULL, '接受推薦之後,標註就沒有推薦了');
     $annotation = $this->annotation->find('annotation_id', 1017);
     $this->unit->run($annotation, NULL, '接受推薦之後,原本的標註就被刪掉了才對');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this, __METHOD__);
 }
开发者ID:119155012,项目名称:kals,代码行数:45,代码来源:ut_recommend.php

示例2: index

 function index()
 {
     $url = 'http://www.plurk.com/p/67k6st#response-1739920625';
     $text1 = '[CODING D17] 晚上睡覺時天氣、室溫、冷氣、電扇、被子的厚度與蓋的方法,組合起來就可以預測隔天會不會一整天過敏。但我還沒有明顯地分辨出他們的關聯。';
     $text2 = '變項太多,這回歸的組合也不知道要排到什麼時候orz';
     $note = '「西瓜牛奶去冰的話可能沒有滿杯喔」由於店員這樣說,所以我改口跟他說不用去冰好了……結果還是一樣沒有滿杯orz';
     $email = 'puddingchen.35@gmail.com';
     $email_siroma = 'siroma@gmail.com';
     $scope1 = $this->annotation_scope->create_scope(3, 20, $text1, $url);
     $scope2 = $this->annotation_scope->create_scope(26, 40, $text2, $url);
     $scope_coll = new Annotation_scope_collection();
     $scope_coll->add_scope($scope1);
     $scope_coll->add_scope($scope2);
     $len = $scope_coll->get_scope_length();
     $user = $this->user->create_user($url, $email);
     $user_siroma = $this->user->create_user($url, $email_siroma);
     $annotation = $this->annotation->create_annotation($user, $scope_coll);
     $this->unit->run($annotation->get_id(), 9999, '是否有正確地存入資料庫?');
     $scope_coll2 = $annotation->get_scopes();
     $this->unit->run($scope_coll2->get_scope_length(), $len, '測試get_scopes()');
     $annotation->set_note($note);
     $this->unit->run($annotation->get_note(), $note, '測試get_note()');
     $annotation->set_type(3);
     $type = $annotation->get_type();
     $this->unit->run($type->get_name(), 'annotation.type.confusion', '測試get_type()');
     $user = $annotation->get_user();
     $this->unit->run($user->get_email(), $email, '測試get_user()');
     $this->unit->run($user->get_email(), $email, '測試get_user()');
     $annotation_topic = $this->annotation->create_annotation($user_siroma, $scope2);
     $annotation_topic_id = $annotation_topic->get_id();
     $annotation->set_respond_to_topic($annotation_topic);
     $topic = $annotation->get_respond_to_topic();
     $this->unit->run($topic->get_id(), $annotation_topic_id, '測試respond_to_topic()');
     //來測試respond_to_coll
     $scope3 = $this->annotation_scope->create_scope(104, 135, $note, $url);
     $annotation_respond = $this->annotation->create_annotation($user_siroma, $scope3);
     //$annotation_coll = new Annotation_collection($annotation_respond);
     $annotation->set_respond_to_coll($annotation_respond);
     $coll = $annotation->get_respond_to_coll();
     $this->unit->run($coll->length(), 1, '測試respond_to_coll()的length');
     ///$this->unit->run($coll->get_item(0)->get_id()
     //        , $annotation_respond->get_id()
     //        , '測試respond_to_coll()的get_id() | '.$annotation->get_id());
     $annotation->set_feature(1, 1);
     $feature = $annotation->get_feature(1);
     $this->unit->run($feature->get_name(), 'annotation.feature.location', 'set_feature之後又get_feature->get_name()');
     $this->unit->run($feature->get_value(), '1', 'set_feature之後又get_feature->get_value()');
     $annotation->set_feature(1, 2);
     $feature = $annotation->get_feature(1);
     $this->unit->run($feature->get_value(), '2', '再一次set_feature之後又get_feature->get_value()');
     $score_number = 2.36978;
     $score_number2 = 1.36978;
     $annotation->set_score(0, $score_number);
     $score = $annotation->get_score(0);
     $this->unit->run($score->get_name(), 'annotation.score.integrated', 'set_score之後又get_score->get_name()');
     $this->unit->run($score->get_score(), $score_number, 'set_score之後又get_score->get_value()');
     $annotation->set_score(0, $score_number2);
     $score = $annotation->get_score(0);
     $this->unit->run($score->get_score(), $score_number2, '再一次set_score之後又get_score->get_score()');
     $email_like = 'siroma@gmail.com';
     $user_like = $this->user->create_user($url, $email_like);
     $this->unit->run_false($user->get_id(), $user_like->get_id(), '建立一個user_like,跟user不同人吧?');
     $this->unit->run_false($annotation->get_user()->get_id(), $user_like->get_id(), 'user_like,跟標註的作者user不同人吧?');
     $this->unit->run($annotation->get_like_count(), 0, 'like測試,加入user_like之前 get_like_count()');
     $annotation->add_like($user_like);
     $this->unit->run($annotation->get_like_count(), 1, 'like測試,加入user_like之後 get_like_count()');
     $annotation->remove_like($user_like);
     $this->unit->run($annotation->get_like_count(), 0, 'like測試,移除user_like之後 get_like_count()');
     $annotation->add_like($user_like);
     $this->unit->run($annotation->get_like_count(), 1, 'like測試,再加入user_like之後 get_like_count()');
     $this->unit->run($annotation->get_user()->get_unread_notification_count(), 1, '更新之前,到底annotation的作者收到幾封未讀通知呢?應該是有like的一封');
     $annotation->update();
     $this->unit->run(TRUE, TRUE, '======================更新完畢======================');
     $this->unit->run($user_siroma->get_unread_notification_count(), 1, '更新之後,由於user_siroma被設為topic跟respond的對象,所以user_siroma應該只會收到1封通知');
     $db = $this->db;
     $db->from('annotation2like_count');
     $db->where('annotation_id', $annotation->get_id());
     $db->select('like_count');
     $query = $db->get();
     $row = $query->row_array();
     $like_count = intval($row['like_count']);
     $this->unit->run($like_count, 1, '測試annotation2like_count');
     //----------------------------------------------------------------------------
     //搜尋看看吧
     $id = $annotation->get_id();
     $annotation2 = new Annotation($id);
     $scope_coll3 = $annotation2->get_scopes();
     $this->unit->run($annotation2->get_id(), $id, '$annotation2的id是否跟當初設定的相同?');
     $this->unit->run($scope_coll3->get_scope_length(), $len, '取出$annotation2之後,測試scopes');
     $this->unit->run($scope_coll3->length(), 2, '取出$annotation2之後,測試scopes有幾個');
     $this->unit->run($scope_coll3->get_anchor_speech(), $scope_coll2->get_anchor_speech(), '取出$annotation2之後,測試scopes的get_anchor_speech()');
     $this->unit->run($annotation2->get_note(), $note, '取出$annotation2之後,測試note');
     $type2 = $annotation2->get_type();
     $this->unit->run($type2->get_name(), 'annotation.type.confusion', '取出$annotation2之後,測試type');
     $user2 = $annotation2->get_user();
     $this->unit->run($user2->get_email(), $email, '取出$annotation2之後,測試get_user()');
     $text2 = '雖然這邊太吵了應該聽不到尖叫聲,不過應該是會有人間叫';
     $this->unit->run($annotation2->get_like_count(), 1, '搜尋之後,like測試,已經加入user_like');
     $this->unit->run_false($annotation2->get_user()->get_id(), $user_like->get_id(), '確認一下兩個標註應該是不同人吧?');
     $annotation2->set_note($text2);
//.........这里部分代码省略.........
开发者ID:119155012,项目名称:kals,代码行数:101,代码来源:ut_annotation.php

示例3: _get_topic_annotation_attr

 /**
  * 準備好topic的Annotation資料
  * @param Annotation $annotation
  * @param Array $data
  * @return Array
  */
 private function _get_topic_annotation_attr($annotation)
 {
     $topic_id = $annotation->get_id();
     //$annotation_id = $annotation->get_id();
     //$log_topic_id = $annotation_id;
     $anchor_text = $annotation->get_anchor_text();
     $annotation_user_name = $annotation->get_user()->get_name();
     //$user_id = $annotation->get_user()->get_id();
     $annotation_type = $annotation->get_type();
     $type_classname = $annotation_type->get_classname();
     $note = $annotation->get_note();
     $timestamp = $annotation->get_update_timestamp();
     // send data -annotation topic
     $topic_annotation_array = array();
     $topic_annotation_array["topic_id"] = $topic_id;
     //$data["annotation_self_id"] = $annotation_self_id;
     $topic_annotation_array["anchor_text"] = $anchor_text;
     $topic_annotation_array["user_name"] = $annotation_user_name;
     $topic_annotation_array["type_name_lang"] = $this->_get_type_name_lang($annotation_type);
     $topic_annotation_array["type_classname"] = $type_classname;
     $topic_annotation_array["note"] = $note;
     $topic_annotation_array["timestamp"] = $this->_convert_timestamp_to_date($timestamp);
     $login_user_id = get_context_user_id();
     $topic_annotation_array["is_my"] = FALSE;
     if (isset($login_user_id) && $annotation->get_user()->get_id() === $login_user_id) {
         $topic_annotation_array["is_my"] = TRUE;
     }
     return $topic_annotation_array;
 }
开发者ID:119155012,项目名称:kals,代码行数:35,代码来源:annotation_thread.php

示例4: _setup_annotation

 /**
  *
  * @param Annotation $annotation
  * @param Object $data
  * @param String $callback
  */
 private function _setup_annotation(&$annotation, $data)
 {
     //$this->output->enable_profiler(TRUE);
     $url = $this->url;
     $user = $this->user;
     $auth = $this->authorize_manager;
     //設定標註細節
     //test_msg('設定標註細節');
     //type
     if (isset($data->type)) {
         if (is_string($data->type)) {
             $data->type = trim($data->type);
             if ($data->type !== '') {
                 $data->type = urldecode($data->type);
             } else {
                 //如果是空白的話,則視為自訂
                 $data->type = 7;
             }
         }
         $annotation->set_type($data->type);
     }
     //note
     if (isset($data->note) && $data->note != '') {
         $note = $data->note;
         if (is_string($note)) {
             $note = urldecode($note);
         }
         $annotation->set_note($note);
     } else {
         $note = $annotation->get_note();
         if (isset($note) && $note !== '') {
             $annotation->set_note(NULL);
         }
     }
     if (isset($data->image_spot_position)) {
         //test_msg("image_spot_position");
         $annotation->set_feature_image_spot_position($data->image_spot_position);
         //test_msg("image_spot_position 完成");
     }
     //        //設定respond
     //        //test_msg('設定respond');
     //topic
     //            if (isset($data->topic))
     //            {
     //                //理論上topic只會有一個,並設定他的ID
     //                $topic_id = $data->topic->annotation_id;
     //                $annotation->set_respond_to_topic($topic_id);
     //            }
     //
     //            //respond_coll
     //            if (isset($data->respond_to_coll))
     //            {
     //                $respond_to_annotations = array();
     //                foreach ($data->respond_to_coll AS $respond_to)
     //                {
     //                    $respond_to_annotation_id = $respond_to->annotation_id;
     //                    $respond_to_annotation = new Annotation($respond_to_annotation_id);
     //                    $respond_to_annotations[] = $respond_to_annotation;
     //                }
     //                $annotation->set_respond_to_coll($respond_to_annotations);
     //            }
     //-----------------------
     //設定policy
     //test_msg('設定policy');
     $policy_type = 1;
     if (isset($data->policy_type)) {
         $policy_type = $data->policy_type;
     }
     // 1    public
     // 2    private    private特別是指只有自己能閱讀
     // 3    share
     $share_user_coll = NULL;
     if ($policy_type === 1) {
         //什麼都不用作
     } else {
         if ($policy_type === 2) {
             $share_user_coll = array($user);
         } else {
             if ($policy_type === 3) {
                 $share_list = $data->share_list;
                 $share_user_coll = array();
                 foreach ($share_list as $share_user_data) {
                     $share_user_id = $share_user_data->id;
                     $share_user = new User($share_user_id);
                     array_push($share_user_coll, $share_user);
                 }
             }
         }
     }
     $this->load->library('policy/Authorize_manager');
     $ACTION_ANNOTATION_READ = 5;
     $auth->set_resource($annotation);
     if (is_array($share_user_coll)) {
         foreach ($share_user_coll as $share_user) {
//.........这里部分代码省略.........
开发者ID:119155012,项目名称:kals,代码行数:101,代码来源:image_spot.php

示例5: 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

示例6: import

 /**
  * 匯入。當推薦標註更改時,把原本的資料匯入,除了範圍、使用者之外
  * @param Annotation $annotation
  * @return Annotation
  */
 public function import(Annotation $annotation)
 {
     $this->set_type($annotation->get_type());
     $this->set_note($annotation->get_note());
     $featrues_type_id = $this->feature_coll->get_types_id();
     foreach ($featrues_type_id as $feature_type_id) {
         $value = $annotation->get_feature($feature_type_id)->get_value();
         if (isset($value)) {
             $this->set_feature($feature_type_id, $value);
         }
     }
     return $this;
 }
开发者ID:119155012,项目名称:kals,代码行数:18,代码来源:Annotation.php

示例7: _print_respond_annotation_table

 /**
  * 輸出Respond Annotation的資料
  * @param Annotation $annotation
  * @return string
  */
 private function _print_respond_annotation_table($annotation)
 {
     $annotation_id = $annotation->get_id();
     $text = '<a name="annotation_' . $annotation_id . '" id="annotation_' . $annotation_id . '"></a><table class="annotation_table respond" cellspacing="0" cellpadding="0" border="0" align="center"><tbody>';
     //第一列
     //
     // 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);
     $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>';
     $note = $annotation->get_note();
     $respond_to_coll = $annotation->get_respond_to_coll();
     $respond_to_text = '';
     foreach ($respond_to_coll as $respond_to_annotation) {
         if ($respond_to_text != '') {
             $respond_to_text .= '; ';
         }
         $respond_to_id = $respond_to_annotation->get_id();
         $respond_to_email = $respond_to_annotation->get_user()->get_email();
         $respond_to_text .= '<a href="#annotation_' . $respond_to_id . '">' . $respond_to_email . '#' . $respond_to_id . "</a>";
     }
     if ($respond_to_text != '') {
         $text .= '<tr><td><table border="1" width="100%" cellpadding="0" cellspacing="0"><tbody><tr><th>回應對象</th><td>' . $respond_to_text . '</td></tr></tbody></table></td></tr>';
     }
     if ($note != '') {
         $text .= '<tr><td><table class="note" width="100%" border="1" cellpadding="0" cellspacing="0"><tbody><tr><td>' . $note . '</td></tr></tbody></table></td></tr>';
     }
     $text .= '</tbody></table>' . "\n\n";
     return $text;
 }
开发者ID:119155012,项目名称:kals,代码行数:45,代码来源:exp201012annotation.php


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