本文整理汇总了PHP中Annotation::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Annotation::update方法的具体用法?PHP Annotation::update怎么用?PHP Annotation::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Annotation
的用法示例。
在下文中一共展示了Annotation::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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__);
}
示例2: Annotation
function time2()
{
$id = 783;
$text2 = '變項太多,這回歸的組合也不知道要排到什麼時候orz';
$annotation = new Annotation(783);
$this->unit->run($annotation->get_field('create_timestamp'), 'is_string', 'create_timestamp');
$this->unit->run($annotation->get_field('update_timestamp'), 'is_string', 'update_timestamp');
$this->unit->run_false(substr($annotation->get_field('create_timestamp'), 0, 19), substr($annotation->get_field('update_timestamp'), 0, 19), 'create_timestamp == update_timestamp');
sleep(5);
$annotation->set_note($text2);
$annotation->update();
$annotation->reload();
$this->unit->run($annotation->get_field('create_timestamp'), 'is_string', 'create_timestamp');
$this->unit->run($annotation->get_field('update_timestamp'), 'is_string', 'update_timestamp');
$this->unit->run_false(substr($annotation->get_field('create_timestamp'), 0, 19), substr($annotation->get_field('update_timestamp'), 0, 19), 'create_timestamp != update_timestamp');
context_complete();
unit_test_report($this);
}
示例3: create_annotation
public function create_annotation($user_id, $scope_coll, $do_update = TRUE)
{
$this->_load_user();
$user_id = $this->CI->user->filter_id($user_id);
$annotation = new Annotation();
$annotation->set_scopes($scope_coll);
$annotation->set_user($user_id);
if ($do_update) {
$annotation->update();
}
if (is_null($annotation->get_id())) {
show_error("Annotation create fail. scope_coll: " . $scope_coll . "; user_id: " . $user_id);
}
return $annotation;
}