本文整理汇总了PHP中Topxia\Common\Paginator::getCurrentPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginator::getCurrentPage方法的具体用法?PHP Paginator::getCurrentPage怎么用?PHP Paginator::getCurrentPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topxia\Common\Paginator
的用法示例。
在下文中一共展示了Paginator::getCurrentPage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showAction
public function showAction(Request $request, $courseId, $threadId)
{
list($course, $member) = $this->buildLayoutDataWithTakenAccess($request, $courseId);
$user = $this->getCurrentUser();
if ($member && !$this->getCourseService()->isMemberNonExpired($course, $member)) {
$isMemberNonExpired = false;
} else {
$isMemberNonExpired = true;
}
$thread = $this->getThreadService()->getThread($course['id'], $threadId);
if (empty($thread)) {
throw $this->createNotFoundException("话题不存在,或已删除。");
}
$paginator = new Paginator($request, $this->getThreadService()->getThreadPostCount($course['id'], $thread['id']), 30);
$posts = $this->getThreadService()->findThreadPosts($thread['courseId'], $thread['id'], 'default', $paginator->getOffsetCount(), $paginator->getPerPageCount());
if ($thread['type'] == 'question' && $paginator->getCurrentPage() == 1) {
$elitePosts = $this->getThreadService()->findThreadElitePosts($thread['courseId'], $thread['id'], 0, 10);
} else {
$elitePosts = array();
}
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($posts, 'userId'));
$this->getThreadService()->hitThread($courseId, $threadId);
$isManager = $this->getCourseService()->canManageCourse($course['id']);
$lesson = $this->getCourseService()->getCourseLesson($course['id'], $thread['lessonId']);
return $this->render("TopxiaWebBundle:CourseThread:show.html.twig", array('course' => $course, 'member' => $member, 'lesson' => $lesson, 'thread' => $thread, 'author' => $this->getUserService()->getUser($thread['userId']), 'posts' => $posts, 'elitePosts' => $elitePosts, 'users' => $users, 'isManager' => $isManager, 'isMemberNonExpired' => $isMemberNonExpired, 'paginator' => $paginator));
}
示例2: showAction
public function showAction(Request $request, $courseId, $id)
{
$user = $this->getCurrentUser();
if (!$user->isLogin()) {
return $this->createMessageResponse('info', '你好像忘了登录哦?', null, 3000, $this->generateUrl('login'));
}
$course = $this->getCourseService()->getCourse($courseId);
if (empty($course)) {
throw $this->createNotFoundException("课程不存在,或已删除。");
}
if (!$this->getCourseService()->canTakeCourse($course)) {
return $this->createMessageResponse('info', "您还不是课程《{$course['title']}》的学员,请先购买或加入学习。", null, 3000, $this->generateUrl('course_show', array('id' => $courseId)));
}
list($course, $member) = $this->getCourseService()->tryTakeCourse($courseId);
if ($member && !$this->getCourseService()->isMemberNonExpired($course, $member)) {
// return $this->redirect($this->generateUrl('course_threads',array('id' => $courseId)));
$isMemberNonExpired = false;
} else {
$isMemberNonExpired = true;
}
$thread = $this->getThreadService()->getThread($course['id'], $id);
if (empty($thread)) {
throw $this->createNotFoundException();
}
$paginator = new Paginator($request, $this->getThreadService()->getThreadPostCount($course['id'], $thread['id']), 30);
$posts = $this->getThreadService()->findThreadPosts($thread['courseId'], $thread['id'], 'default', $paginator->getOffsetCount(), $paginator->getPerPageCount());
if ($thread['type'] == 'question' and $paginator->getCurrentPage() == 1) {
$elitePosts = $this->getThreadService()->findThreadElitePosts($thread['courseId'], $thread['id'], 0, 10);
} else {
$elitePosts = array();
}
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($posts, 'userId'));
$this->getThreadService()->hitThread($courseId, $id);
$isManager = $this->getCourseService()->canManageCourse($course['id']);
$lesson = $this->getCourseService()->getCourseLesson($course['id'], $thread['lessonId']);
return $this->render("TopxiaWebBundle:CourseThread:show.html.twig", array('course' => $course, 'lesson' => $lesson, 'thread' => $thread, 'author' => $this->getUserService()->getUser($thread['userId']), 'posts' => $posts, 'elitePosts' => $elitePosts, 'users' => $users, 'isManager' => $isManager, 'isMemberNonExpired' => $isMemberNonExpired, 'paginator' => $paginator));
}
示例3: smsBillAction
public function smsBillAction(Request $request)
{
try {
$api = CloudAPIFactory::create('root');
$loginToken = $this->getAppService()->getLoginToken();
$account = $api->get('/accounts');
$result = $api->get('/bills', array('type' => 'sms', 'page' => 1, 'limit' => 20));
$paginator = new Paginator($this->get('request'), $result["total"], 20);
$result = $api->get('/bills', array('type' => 'sms', 'page' => $paginator->getCurrentPage(), 'limit' => $paginator->getPerPageCount()));
$bills = $result['items'];
} catch (\RuntimeException $e) {
return $this->render('TopxiaAdminBundle:EduCloud:api-error.html.twig', array());
}
return $this->render('TopxiaAdminBundle:EduCloud:sms-bill.html.twig', array('account' => $account, 'token' => isset($loginToken) && isset($loginToken["token"]) ? $loginToken["token"] : '', 'bills' => $bills, 'paginator' => $paginator));
}