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


PHP Annotation::get_append_to_webpages方法代码示例

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


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

示例1: _log

 /**
  * log區
  * @param Annotation $topic_annotation
  */
 private function _log($topic_annotation)
 {
     //log區-mobile瀏覽討論-action = 41
     $action = 41;
     // data: topic_id
     $log_webpage = $topic_annotation->get_append_to_webpages();
     $log_webpage_id = $log_webpage[0]->get_id();
     $log_topic_id = $topic_annotation->get_id();
     $log_user_id = get_context_user_id();
     $array_data = array('target_topic' => FALSE, 'topic_id' => $log_topic_id, 'order_by' => 'create', 'show_total_count' => TRUE);
     kals_mobile_log($this->db, $log_webpage_id, $action, array('memo' => $array_data, 'user_id' => $log_user_id));
     context_complete();
     //寫入db
 }
开发者ID:119155012,项目名称:kals,代码行数:18,代码来源:annotation_thread.php

示例2: index


//.........这里部分代码省略.........
     $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);
     $annotation2->update();
     $this->unit->run(TRUE, TRUE, '<h4>======================更新完畢======================</h4>');
     //----------------------------------------------------------------------
     $annotation3 = new Annotation($annotation2->get_id());
     $this->unit->run($annotation3->get_note(), $text2, '更新note,取出$annotation3之後,測試get_note()');
     $webpages = $annotation3->get_append_to_webpages();
     $this->unit->run(count($webpages), 1, '測試get_append_to_webpages()');
     $this->unit->run($webpages[0]->get_uri(), parse_uri($url), '測試get_append_to_webpages()是否相符');
     $topic = $annotation3->get_respond_to_topic();
     $this->unit->run($topic->get_id(), $annotation_topic_id, '測試respond_to_topic()');
     $coll = $annotation3->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(),應該只有找到一個,並且就是剛剛插入的那一個 | '.$annotation3->get_id());
     $this->unit->run($annotation2->get_id(), $annotation3->get_id(), 'annotation2跟3的id是否相同呢?應該一樣才是');
     $topic_respond_coll = $topic->get_topic_respond_coll();
     $this->unit->run($topic_respond_coll->length(), 1, '測試get_topic_responded_coll()的length');
     $this->unit->run($topic_respond_coll->get_item(0)->get_id(), $annotation3->get_id(), '測試get_topic_responded_coll()的length');
     $feature = $annotation3->get_feature(1);
     $this->unit->run($feature->get_value(), '2', '搜尋之後,get_feature->get_value()');
     $feature = $annotation3->get_feature(2);
     $this->unit->run($feature->get_value(), NULL, '搜尋之後,get_feature沒設定的id,應該會有屬性,但是沒有值');
     $feature = $annotation3->get_feature(3);
     $this->unit->run($feature, NULL, '搜尋之後,get_featur不再factory_item範圍內的id,應該直接是null');
     $score = $annotation3->get_score(0);
     $this->unit->run($score->get_name(), 'annotation.score.integrated', '搜尋之後,get_score->get_name()');
     $this->unit->run($score->get_score(), $score_number2, '搜尋之後,get_score->get_value()');
     $query = $this->db->select('score')->limit(1)->where('annotation_id', $annotation3->get_id())->get('score');
     $row = $query->row_array();
     $this->unit->run($row['score'], $score_number2, '以資料庫查看是否有存入score');
     $this->unit->run_false($annotation3->get_field('create_timestamp'), $annotation3->get_field('update_timestamp'), 'Annotation更新過後,create_timestamp跟update_timestamp應該要不同才對');
     $this->unit->run($annotation->get_like_count(), 1, '搜尋之後,like測試,已經加入user_like');
     $this->unit->run_false($annotation->get_user()->get_id(), $user_like->get_id(), '確認一下兩個標註應該是不同人吧?');
     //        $annotation->remove_like($user2);
     //        $this->unit->run($annotation->get_like_count()
     //                , 0
     //                , '搜尋之後,like測試,移除user2之後');
     //context_complete();
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     unit_test_report($this);
 }
开发者ID:119155012,项目名称:kals,代码行数:101,代码来源:ut_annotation.php

示例3: annotation_thread


//.........这里部分代码省略.........
             $new_res_annotation->set_respond_to_topic($topic_id);
         } else {
             echo 'no topic id';
         }
         //設定policy
         //echo 'start set policy';
         $policy_type = 1;
         /*$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)
                         {
                           //在這邊為該$annotation設定policy readable
                             $auth->policy_add_actor($ACTION_ANNOTATION_READ, $share_user);
                         }
                       }
                      else{
                         //清除該$annotation的policy
                         $auth->policy_remove_actor($ACTION_ANNOTATION_READ);
                      }*/
         //回傳標註
         $new_res_annotation->update();
         set_ignore_authorize(false);
         // 寫入DB(若note不為空才寫入)
         if (isset($note_massage) && $note_massage !== '') {
             context_complete();
         }
     }
     //log區-mobile瀏覽討論-action = 41
     $action = 41;
     // data: topic_id
     $log_webpage = $annotation->get_append_to_webpages();
     $log_webpage_id = $log_webpage[0]->get_id();
     $array_data = array('target_topic' => FALSE, 'topic_id' => $log_topic_id, 'order_by' => 'create', 'show_total_count' => TRUE);
     kals_mobile_log($this->db, $log_webpage_id, $action, array('memo' => $array_data, 'user_id' => $log_user_id));
     context_complete();
     //寫入db
     $data['log_webpage_id'] = $log_webpage_id;
     // type
     if ($type != 'annotation.type.custom') {
         $type_show = $this->lang->line("web_apps." . $type);
         $type_name = $type_show;
     }
     // css-type
     switch ($css_type) {
         case 1:
             $css_type = 'importance';
             break;
         case 2:
             $css_type = 'concept';
             break;
         case 3:
             $css_type = 'confusion';
             break;
         case 4:
             $css_type = 'question';
             break;
         case 5:
             $css_type = 'example';
             break;
         case 6:
             $css_type = 'summary';
             break;
         case 7:
开发者ID:119155012,项目名称:kals,代码行数:67,代码来源:mobile.php


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