當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。