当前位置: 首页>>代码示例>>PHP>>正文


PHP Paginator::getCurrentPage方法代码示例

本文整理汇总了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));
 }
开发者ID:nanyi,项目名称:EduSoho,代码行数:26,代码来源:CourseThreadController.php

示例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));
 }
开发者ID:styling,项目名称:LeesPharm,代码行数:37,代码来源:CourseThreadController.php

示例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));
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:15,代码来源:EduCloudController.php


注:本文中的Topxia\Common\Paginator::getCurrentPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。