本文整理汇总了PHP中CommentModel::getPager方法的典型用法代码示例。如果您正苦于以下问题:PHP CommentModel::getPager方法的具体用法?PHP CommentModel::getPager怎么用?PHP CommentModel::getPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommentModel
的用法示例。
在下文中一共展示了CommentModel::getPager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CommentList
/**
*
*/
public function CommentList($item_id, $page_number, $page_size, $cur_controller, $cur_action, $item_name, $params, $allowComment = 1)
{
$userModel = new UserModel();
$info = array();
if ((int) $page_size <= 0) {
$page_size = self::DEFAULT_COMMENT_PER_PAGE;
}
$request = Project::getRequest();
$user = Project::getUser()->getDbUser();
$isAdmin = $user->user_type_id == 1 ? true : false;
$user_id = (int) Project::getUser()->getDbUser()->id;
$info['cur_controller'] = $cur_controller;
$info['cur_action'] = $cur_action;
$info['item_name'] = $item_name;
$info['add_comment_element_id'] = $item_id;
$info['add_comment_id'] = 0;
$info['isAdmin'] = $isAdmin;
$info['user_id'] = $user_id;
$info['default_avatar'] = $userModel->getUserAvatar($user_id);
$requested_user_id = (int) Project::getUser()->getShowedUser()->id;
$model = new CommentModel($item_name . '_comment', $item_name . '_id', 0);
$pager = new DbPager($page_number, $page_size);
$model->setPager($pager);
$list = $model->loadByItem($item_id);
foreach ($list as &$item) {
if ($user_id > 0 && ($user_id === $requested_user_id || (int) $item['user_id'] === $user_id || $isAdmin)) {
$item['del_link'] = $request->createUrl("BaseComment", "DeleteComment", array($item_id, $item['id'], $item_name));
} else {
$item['del_link'] = false;
}
}
$info['add_comment_url'] = $request->createUrl('BaseComment', 'AddComment');
$info['change_comment_url'] = $request->createUrl('BaseComment', 'EditComment');
$info['comment_list'] = $list;
$pager_view = new SitePagerView();
$info['comment_list_pager'] = $pager_view->show2($model->getPager(), $cur_controller, $cur_action, $params);
$info['user_moods'] = $userModel->getAllUserMoods($user_id);
$info['user_avatars'] = $userModel->getAllUserAvatars($user_id);
$info['allowComment'] = $allowComment;
$this->_view->CommentList($info);
return $this->_view->parse();
}