本文整理汇总了PHP中Annotation::create_annotation方法的典型用法代码示例。如果您正苦于以下问题:PHP Annotation::create_annotation方法的具体用法?PHP Annotation::create_annotation怎么用?PHP Annotation::create_annotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Annotation
的用法示例。
在下文中一共展示了Annotation::create_annotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
//.........这里部分代码省略.........