示例#1
0
 public function not_accept()
 {
     $url = 'http://www.plurk.com/p/6esun8#response-1799208331';
     $annotation = $this->annotation->find('annotation_id', 1017);
     $annotation = new Annotation(1017);
     $original_annotation_id = $annotation->get_id();
     $recommend = new Annotation_recommend();
     $recommend->set_webpage($url);
     $recommend->set_recommended($annotation);
     $recommend->update();
     $annotation = new Annotation(1017);
     $recommend = $annotation->get_recommend();
     //-----------------------------------------------
     $length = $annotation->get_scope_length();
     $recommend = $annotation->get_recommend();
     $annotation = $recommend->set_accept(FALSE);
     $length = $annotation->get_scope_length();
     $this->unit->run($annotation->get_scope_length(), $length, '拒絕推薦之後,由於並沒有改變標註,所以長度還是一樣');
     $this->unit->run($annotation->get_id(), $original_annotation_id, '拒絕推薦之後,這個標註應該跟上面的一樣');
     $recommend = $annotation->get_recommend();
     $this->unit->run($recommend, NULL, '拒絕推薦之後,標註就沒有推薦了');
     $annotation = $this->annotation->find('annotation_id', 1017);
     $this->unit->run($annotation->get_id(), 'is_int', '拒絕推薦之後,原本的標註仍在');
     //        $this->unit->run($test_result
     //                , $expected_result
     //                , $test_name);
     //context_complete();
     unit_test_report($this, __METHOD__);
 }
示例#2
0
 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);
 }