本文整理汇总了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);
}