本文整理汇总了PHP中Annotation::export_data方法的典型用法代码示例。如果您正苦于以下问题:PHP Annotation::export_data方法的具体用法?PHP Annotation::export_data怎么用?PHP Annotation::export_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Annotation
的用法示例。
在下文中一共展示了Annotation::export_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_annotation
public function get_annotation($json, $callback)
{
$data = json_to_array($json);
$annotation_id = $data["annotation_id"];
//test_msg($annotation_id);
$annotation = new Annotation($annotation_id);
$data = array('annotation' => $annotation->export_data());
$this->_display_jsonp($data, $callback);
}
示例2: Annotation
function list_annotation($json, $callback = NULL)
{
$enable_profiler = FALSE;
if ($enable_profiler === TRUE) {
$this->output->enable_profiler(TRUE);
}
if (is_string($json)) {
$data = json_to_object($json);
} else {
$data = $json;
}
$user = get_context_user();
$url = $this->url;
$search = new Search_annotation_collection();
$search_id = null;
if (isset($data->limit)) {
$search_id = new Search_annotation_id_collection();
}
// 1 [ topic id ]
if (isset($data->topic_id) && isset($data->target_topic) && $data->target_topic === TRUE) {
$annotation = new Annotation($data->topic_id);
$output_data = array('annotation_collection' => array($annotation->export_data()), 'totally_loaded' => true);
return $this->_display_jsonp($output_data, $callback);
} else {
if (isset($data->topic_id) && isset($data->target_topic) && $data->target_topic === FALSE) {
$search->set_target_topic_id($data->topic_id);
if (isset($search_id)) {
$search_id->set_target_topic_id($data->topic_id);
}
}
}
// 2 [ scope ]
//test_msg('2 [ scope ]', is_null($data->scope));
//如果沒有設定範圍,則直接回傳空值
//if (is_null($data->scope))
//{
// //return $this->_create_null_list($callback);
//}
if (isset($data->scope)) {
$scope_coll_data = $data->scope;
//test_msg('2 [ scope ] 2', is_null($data->scope));
$scope_coll = $this->annotation_scope_collection->import_webpage_search_data($url, $scope_coll_data);
//test_msg($scope_coll->export_json());
$search->set_overlap_scope($scope_coll);
if (isset($search_id)) {
$search_id->set_overlap_scope($scope_coll);
}
//test_msg('2 [ scope ] 3', is_null($data->scope));
}
// 3 [ target like ]
// 4 [ target my ]
//test_msg('3 [ target like ] 4 [ target my ]');
if ((isset($data->target_like) or isset($data->target_my)) && is_null($user)) {
return $this->_create_null_list($callback);
}
if (isset($data->target_like)) {
$search->set_target_like($data->target_like, $user);
if (isset($search_id)) {
$search_id->set_target_like($data->target_like, $user);
}
}
if (isset($data->target_my)) {
if ($data->target_my === TRUE) {
$search->set_target_user($user);
if (isset($search_id)) {
$search_id->set_target_user($user);
}
} else {
$search->set_exclude_user($user);
if (isset($search_id)) {
$search_id->set_exclude_user($user);
}
}
}
// 5 [ target_topic ]
if (isset($data->target_topic)) {
$search->set_target_topic($data->target_topic);
if (isset($search_id)) {
$search_id->set_target_topic($data->target_topic);
}
}
// 6 [ order by ]
// 6 [ is_desc]
//test_msg('6 [ order by ]', isset($data->order_by));
//test_msg('6 [ order by ] direction', $data->direction);
$order_id = 1;
$default_direction = TRUE;
if (isset($data->order_by)) {
if ($data->order_by == 'update') {
$order_id = 6;
$default_direction = TRUE;
} else {
if ($data->order_by == 'create') {
$order_id = 7;
$default_direction = TRUE;
} else {
// 依照分數排序
$order_id = 1;
$default_direction = TRUE;
}
//.........这里部分代码省略.........