本文整理匯總了PHP中comment::get_pagination方法的典型用法代碼示例。如果您正苦於以下問題:PHP comment::get_pagination方法的具體用法?PHP comment::get_pagination怎麽用?PHP comment::get_pagination使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類comment
的用法示例。
在下文中一共展示了comment::get_pagination方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
}
}
}
}
break;
case 'delete':
$result = $comment->delete($commentid);
if ($result === true) {
echo json_encode(array('client_id' => $client_id, 'commentid' => $commentid));
} else {
if ($result == COMMENT_ERROR_INSUFFICIENT_CAPS) {
$err->error = get_string('nopermissiontoeditcomment');
echo json_encode($err);
} else {
if ($result == COMMENT_ERROR_DB) {
$err->error = get_string('dbupdatefailed');
echo json_encode($err);
}
}
}
break;
case 'get':
default:
$ret = array();
$comments = $comment->get_comments($page);
$ret['list'] = $comments;
$ret['pagination'] = $comment->get_pagination($page);
$ret['client_id'] = $client_id;
echo json_encode($ret);
exit;
}
示例2: array
echo json_encode($result);
die;
}
}
break;
case 'delete':
$comment_record = $DB->get_record('comments', array('id' => $commentid));
if ($manager->can_delete($commentid) || $comment_record->userid == $USER->id) {
if ($manager->delete($commentid)) {
$result = array('client_id' => $client_id, 'commentid' => $commentid);
echo json_encode($result);
die;
}
}
break;
case 'get':
default:
if ($manager->can_view()) {
$comments = $manager->get_comments($page);
$result = array('list' => $comments, 'count' => $manager->count(), 'pagination' => $manager->get_pagination($page), 'client_id' => $client_id);
echo json_encode($result);
die;
}
break;
}
if (!isloggedin()) {
// tell user to log in to view comments
echo json_encode(array('error' => 'require_login'));
}
// ignore request
die;
示例3: comment
$args->ignore_permission = $ignore_permission;
$manager = new comment($args);
} else {
die;
}
// process ajax request
switch ($action) {
case 'add':
$result = $manager->add($content);
if (!empty($result) && is_object($result)) {
$result->count = $manager->count();
$result->client_id = $client_id;
echo json_encode($result);
}
break;
case 'delete':
$result = $manager->delete($commentid);
if ($result === true) {
echo json_encode(array('client_id' => $client_id, 'commentid' => $commentid));
}
break;
case 'get':
default:
$result = array();
$comments = $manager->get_comments($page);
$result['list'] = $comments;
$result['count'] = $manager->count();
$result['pagination'] = $manager->get_pagination($page);
$result['client_id'] = $client_id;
echo json_encode($result);
}