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


PHP Annotation::get_user方法代码示例

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


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

示例1: index

 function index()
 {
     $url = $this->url;
     $webpage = $this->webpage->create($url);
     $tutor = $webpage->get_tutor();
     $annotation = new Annotation(1017);
     $user = $annotation->get_user();
     $unread_count = $user->get_unread_notification_count();
     $this->unit->run($unread_count, 'is_int', '先看一下user的未讀通知有幾封');
     $tutor->setup_recommend($annotation);
     $recommend = $annotation->get_recommend();
     $this->unit->run($recommend->get_id(), 'is_int', '有取得建議');
     $recommend_annotation = $recommend->get_recommend_by();
     $this->unit->run($recommend_annotation, NULL, '沒有推薦標註');
     $tips = $recommend->get_tips_text_array();
     $this->unit->run_false(count($tips), 0, '有建議');
     //------------------------------------------------
     $recommend_annotation = new Annotation(783);
     $recommend_annotation->set_score(0, 3);
     $recommend_annotation->update();
     $scope = new Annotation_scope(129);
     $recommend_scope = new Annotation_scope_collection();
     $recommend_scope->add_scope($scope);
     $annotation->set_recommend_scopes($recommend_scope);
     $tutor->setup_recommend($annotation);
     $recommend->reload();
     $recommend_annotation = $recommend->get_recommend_by();
     $this->unit->run($recommend_annotation->get_id(), 783, '有找到推薦標註');
     $this->unit->run($user->get_unread_notification_count(TRUE), $unread_count + 2, '因為新增了兩次推薦,所以應該有兩封通知?');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this, __METHOD__);
 }
开发者ID:119155012,项目名称:kals,代码行数:35,代码来源:ut_tutor.php

示例2: _post_update

 protected function _post_update()
 {
     parent::_post_update();
     //假如是喜歡的話……
     $canceled = $this->get_field('canceled');
     if ($canceled === FALSE or $canceled == 'FALSE' or $canceled == 'f') {
         $annotation_id = intval($this->get_field('annotation_id'));
         $user_id = intval($this->get_field('user_id'));
         if ($annotation_id != 0 && $user_id != 0) {
             $this->_CI_load('library', 'kals_resource/Annotation', 'annotation');
             $this->_CI_load('library', 'kals_actor/User', 'user');
             $trigger_resource = new Annotation($annotation_id);
             $association_user = $trigger_resource->get_user();
             $trigger_actor = new User($user_id);
             $this->_CI_load('library', 'kals_actor/Notification_liked', 'notification_liked');
             $notification = $this->CI->notification_liked->create_notification($association_user, $trigger_resource, $trigger_actor);
             if (is_null($notification)) {
                 handle_error($this->lang->line('notification.liked.create_notification.exception'));
             }
         }
     }
     //if ($canceled == FALSE OR $canceled == 'FALSE')
 }
开发者ID:119155012,项目名称:kals,代码行数:23,代码来源:Annotation_like.php

示例3: json

 function json()
 {
     $annotation = new Annotation(1017);
     $user = $annotation->get_user();
     $this->unit->run($user->export_json(), 'is_string', '測試user->export_json()');
     $this->unit->run($annotation->export_json(), 'is_string', '測試annotation->export_json()');
     unit_test_report($this, __METHOD__);
 }
开发者ID:119155012,项目名称:kals,代码行数:8,代码来源:ut_annotation.php

示例4: _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

示例5: array


//.........这里部分代码省略.........
                }
                if ($to_index < $s_index) {
                    //echo $to_index.'-'.$s_index.'!<br />';
                    //{
                    //$set_next_s_index = true;
                    //$sentence_to_index = $last_s_index;
                    $sentence_to_index = $s_index;
                    break;
                    //}
                }
                //echo '['.$s.":".$from_index.'-'.$to_index.'-'.$s_index.'-'.$last_s_index.'|'.$sentence_from_index.'-'.$sentence_to_index.'?'.($sentence_from_index == null).'-'.($to_index < $s_index).']<br />';
                $last_s_index = $s_index;
            }
            //找完了,範圍是
            //$sentense_from_index
            //$sentense_to_index
            //建立搜尋範圍
            $s = new Annotation_scope();
            //$s->set_index($sentence_from_index, $sentence_to_index);
            $s->set_index($from_index, $to_index);
            $s->set_webpage($this->obs_webpage_id);
            $sentence_search_scope = new Annotation_scope_collection();
            $sentence_search_scope->add_scope($s);
            //echo $sentence_search_scope->length().'-'.$this->obs_webpage_id.'|';
            $sentence_consensus_count = '--';
            //if ($from_index == 1)
            //{
            $search = new Search_annotation_user_collection();
            //只算人頭
            $search->set_check_authorize(false);
            $search->set_limit(NULL);
            $search->set_overlap_scope($sentence_search_scope);
            $search->set_exclude_annotation($annotation_id);
            $search->set_exclude_user($annotation->get_user());
            $search->set_target_newer_create($this->obs_epoch_from);
            $search->set_target_older_create($this->obs_epoch_to);
            $search->set_target_topic(true);
            $sentence_consensus_count = $search->length();
            /*
                            $this->unit->run($search->length()
                            , 0
                            , '測試搜尋 '. $annotation_id . ': '. $sentence_from_index.'-'.$from_index.'-'.$to_index.'-'.$sentence_to_index);
            */
            /*
                        }
                        else
                        {
                            //continue;
                        }*/
            if (isset($consensus_count[$email]) == false) {
                $consensus_count[$email] = 0;
                $annotation_count[$email] = 0;
                $consensus_max[$email] = 0;
                $consensus_min[$email] = $count;
            }
            $annotation_count[$email]++;
            $consensus_count[$email] += $count;
            if ($count > $consensus_max[$email]) {
                $consensus_max[$email] = $count;
            }
            if ($count < $consensus_min[$email]) {
                $consensus_min[$email] = $count;
            }
            $total_annotation_count++;
            $total_count += $count;
            if ($count > $total_max) {
开发者ID:119155012,项目名称:kals,代码行数:67,代码来源:exp201012.php

示例6: _delete_annotation

 /**
  * 
  * @param Annotation $annotation
  * @return Boolean
  */
 private function _delete_annotation($annotation)
 {
     $annotation_id = $annotation->get_id();
     $annotation_user = $annotation->get_user();
     //test_msg('delete', $annotation_user->get_id());
     if (is_null($annotation_user->get_id())) {
         $data = show_error('No annotation.');
         return $this->_display_jsonp($data, $callback);
     }
     $user = $this->user;
     if ($user->equals($annotation_user) === FALSE) {
         $data = show_error('Permission deny.');
         return $this->_display_jsonp($data, $callback);
     }
     $action = "image_spot.delete";
     kals_log($this->db, $action, $annotation_id);
     set_ignore_authorize(true);
     $annotation->delete();
     context_complete();
     set_ignore_authorize(false);
 }
开发者ID:119155012,项目名称:kals,代码行数:26,代码来源:image_spot.php

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

示例8: _post_update

 protected function _post_update()
 {
     $this->scope_coll->update();
     $this->respond_to_coll->update();
     $this->feature_coll->update();
     $this->score_coll->update();
     $this->like_coll->update();
     //假如有topic的話……
     $topic_id = $this->get_field('topic_id');
     if ($topic_id !== NULL && $topic_id !== '') {
         $this->_CI_load('library', 'kals_actor/User', 'user');
         $trigger_resource = $this;
         $association_resource = new Annotation($topic_id);
         $association_user = $association_resource->get_user();
         if (FALSE === $this->respond_to_coll->exists_user($association_user)) {
             $trigger_actor = $this->get_user();
             $this->_CI_load('library', 'kals_actor/Notification_responded', 'notification_responded');
             $notification = $this->CI->notification_responded->create_notification($association_user, $trigger_resource, $trigger_actor);
             if (is_null($notification)) {
                 handle_error($this->lang->line('notification.responded.create_notification.exception'));
             }
         }
         //if (FALSE === $this->respond_to_coll->exists_user($association_user))
     }
     //if ($topic_id !== NULL && $topic_id !== '')
 }
开发者ID:119155012,项目名称:kals,代码行数:26,代码来源:Annotation.php

示例9: recommend_reject

 public function recommend_reject($json, $callback)
 {
     $annotation_id = $json;
     $annotation = new Annotation($annotation_id);
     $annotation_user = $annotation->get_user();
     $user = $this->user;
     if ($annotation_user->equals($user) == false) {
         $data = create_json_excpetion('Set Annnotation Recommend Error', 'You cannot set annotation recommend whick is not yours.');
         return $this->_display_jsonp($data, $callback);
     }
     $recommend = $annotation->get_recommend();
     //log區
     $array_data = $recommend->get_id();
     $action = 26;
     $user_id = NULL;
     if (isset($user)) {
         $user_id = $user->get_id();
     }
     kals_log($this->db, $action, array('memo' => $array_data, 'user_id' => $user_id));
     set_ignore_authorize(true);
     $recommend->set_accept(FALSE);
     set_ignore_authorize(false);
     context_complete();
     $data = TRUE;
     return $this->_display_jsonp($data, $callback);
 }
开发者ID:119155012,项目名称:kals,代码行数:26,代码来源:annotation_setter.php

示例10: _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

示例11: _find_recommend_annotation

 private function _find_recommend_annotation(Annotation $annotation)
 {
     $scope_coll = $annotation->get_scopes();
     $user = $annotation->get_user();
     $recommend_scope = $annotation->get_recommend_by_scopes();
     if (is_null($recommend_scope)) {
         $recommend_scope = $scope_coll;
     }
     $target_over_score = $this->_get_recommend_by_threshold();
     $this->_CI_load('library', 'search/Search_order_score', 'search_order_score');
     $order_type_id = $this->CI->search_order_score->get_type_id();
     $this->_CI_load('library', 'search/Search_annotation_collection', 'search_annotation_collection');
     $search = new Search_annotation_collection();
     $search->set_limit(1);
     $search->add_order($order_type_id, TRUE);
     $search->set_overlap_scope($recommend_scope);
     $search->set_exclude_scope($scope_coll);
     $search->set_exclude_user($user);
     $search->set_target_over_score($target_over_score);
     if ($search->length() == 1) {
         return $search->get_item(0);
     } else {
         return NULL;
     }
 }
开发者ID:119155012,项目名称:kals,代码行数:25,代码来源:Annotation_tutor.php


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