本文整理汇总了PHP中Topxia\Common\Paginator::getPerPageCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginator::getPerPageCount方法的具体用法?PHP Paginator::getPerPageCount怎么用?PHP Paginator::getPerPageCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topxia\Common\Paginator
的用法示例。
在下文中一共展示了Paginator::getPerPageCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request, $status)
{
$courses = $this->getCourseService()->searchCourses(array('type' => 'live', 'status' => 'published'), $sort = 'latest', 0, 1000);
$courseIds = ArrayToolkit::column($courses, 'id');
$courses = ArrayToolkit::index($courses, 'id');
$conditions['type'] = "live";
switch ($status) {
case 'coming':
$conditions['startTimeGreaterThan'] = time();
break;
case 'end':
$conditions['endTimeLessThan'] = time();
break;
case 'underway':
$conditions['startTimeLessThan'] = time();
$conditions['endTimeGreaterThan'] = time();
break;
}
$conditions['courseIds'] = $courseIds;
$conditions['status'] = 'published';
$paginator = new Paginator($request, $this->getCourseService()->searchLessonCount($conditions), 20);
if ($status == 'end') {
$lessons = $this->getCourseService()->searchLessons($conditions, array('startTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
} else {
$lessons = $this->getCourseService()->searchLessons($conditions, array('startTime', 'ASC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
}
return $this->render('TopxiaAdminBundle:LiveCourse:index.html.twig', array('status' => $status, 'lessons' => $lessons, 'courses' => $courses, 'paginator' => $paginator));
}
示例2: pointsBillAction
public function pointsBillAction(Request $request)
{
$user = $this->getCurrentUser();
$conditions = array('userId' => $user['id']);
$conditions['startTime'] = 0;
$conditions['endTime'] = time();
switch ($request->get('lastHowManyMonths')) {
case 'oneWeek':
$conditions['startTime'] = $conditions['endTime'] - 7 * 24 * 3600;
break;
case 'twoWeeks':
$conditions['startTime'] = $conditions['endTime'] - 14 * 24 * 3600;
break;
case 'oneMonth':
$conditions['startTime'] = $conditions['endTime'] - 30 * 24 * 3600;
break;
case 'twoMonths':
$conditions['startTime'] = $conditions['endTime'] - 60 * 24 * 3600;
break;
case 'threeMonths':
$conditions['startTime'] = $conditions['endTime'] - 90 * 24 * 3600;
break;
}
$paginator = new Paginator($request, $this->getPointsService()->searchFlowsCount($conditions), 20);
$cashes = $this->getPointsService()->searchFlows($conditions, array('ID', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$conditions['type'] = 'inflow';
$amountInflow = $this->getPointsService()->analysisAmount($conditions);
$conditions['type'] = 'outflow';
$amountOutflow = $this->getPoinsService()->analysisAmount($conditions);
return $this->render('TopxiaWebBundle:Points:points_bill.html.twig', array('cashes' => $cashes, 'paginator' => $paginator, 'amountInflow' => $amountInflow ?: 0, 'amountOutflow' => $amountOutflow ?: 0));
}
示例3: indexAction
public function indexAction(Request $request, $id)
{
$course = $this->getCourseService()->tryManageCourse($id);
$type = $request->query->get('type');
$type = in_array($type, array('courselesson', 'coursematerial')) ? $type : 'courselesson';
$conditions = array('targetType' => $type, 'targetId' => $course['id']);
if (array_key_exists('targetId', $conditions) && !empty($conditions['targetId'])) {
$course = $this->getCourseService()->getCourse($conditions['targetId']);
if ($course['parentId'] > 0 && $course['locked'] == 1) {
$conditions['targetId'] = $course['parentId'];
}
}
$paginator = new Paginator($request, $this->getUploadFileService()->searchFileCount($conditions), 20);
$files = $this->getUploadFileService()->searchFiles($conditions, 'latestCreated', $paginator->getOffsetCount(), $paginator->getPerPageCount());
foreach ($files as $key => $file) {
$files[$key]['metas2'] = json_decode($file['metas2'], true) ?: array();
$files[$key]['convertParams'] = json_decode($file['convertParams']) ?: array();
$useNum = $this->getCourseService()->searchLessonCount(array('mediaId' => $file['id']));
$manageFilesUseNum = $this->getMaterialService()->getMaterialCountByFileId($file['id']);
if ($files[$key]['targetType'] == 'coursematerial') {
$files[$key]['useNum'] = $manageFilesUseNum;
} else {
$files[$key]['useNum'] = $useNum;
}
}
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($files, 'updatedUserId'));
$storageSetting = $this->getSettingService()->get("storage");
return $this->render('TopxiaWebBundle:CourseFileManage:index.html.twig', array('type' => $type, 'course' => $course, 'courseLessons' => $files, 'users' => ArrayToolkit::index($users, 'id'), 'paginator' => $paginator, 'now' => time(), 'storageSetting' => $storageSetting));
}
示例4: ordersAction
public function ordersAction(Request $request)
{
$fields = $request->query->all();
$conditions = array();
if (!empty($fields)) {
$conditions = $fields;
}
if (isset($conditions['keywordType'])) {
if ($conditions['keywordType'] == 'userName') {
$conditions['keywordType'] = 'userId';
$userFindbyNickName = $this->getUserService()->getUserByNickname($conditions['keyword']);
$conditions['keyword'] = $userFindbyNickName ? $userFindbyNickName['id'] : -1;
}
}
if (isset($conditions['keywordType'])) {
$conditions[$conditions['keywordType']] = $conditions['keyword'];
unset($conditions['keywordType']);
unset($conditions['keyword']);
}
$paginator = new Paginator($this->get('request'), $this->getCashOrdersService()->searchOrdersCount($conditions), 20);
$orders = $this->getCashOrdersService()->searchOrders($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$userIds = ArrayToolkit::column($orders, 'userId');
$users = $this->getUserService()->findUsersByIds($userIds);
return $this->render('TopxiaAdminBundle:Coin:coin-orders.html.twig', array('users' => $users, 'orders' => $orders, 'paginator' => $paginator));
}
示例5: indexAction
public function indexAction(Request $request, $postStatus)
{
$conditions = $request->query->all();
if (isset($conditions['keywordType']) && $conditions['keywordType'] == 'courseTitle') {
$courses = $this->getCourseService()->findCoursesByLikeTitle(trim($conditions['keyword']));
$conditions['courseIds'] = ArrayToolkit::column($courses, 'id');
if (count($conditions['courseIds']) == 0) {
return $this->render('TopxiaAdminBundle:CourseQuestion:index.html.twig', array('paginator' => new Paginator($request, 0, 20), 'questions' => array(), 'users' => array(), 'courses' => array(), 'lessons' => array(), 'type' => $postStatus));
}
}
$conditions['type'] = 'question';
$paginator = new Paginator($request, $this->getThreadService()->searchThreadCount($conditions), 20);
$questions = $this->getThreadService()->searchThreads($conditions, 'createdNotStick', $paginator->getOffsetCount(), $paginator->getPerPageCount());
$unPostedQuestion = array();
foreach ($questions as $key => $value) {
if ($value['postNum'] == 0) {
$unPostedQuestion[] = $value;
} else {
$threadPostsNum = $this->getThreadService()->getThreadPostCountByThreadId($value['id']);
$userPostsNum = $this->getThreadService()->getPostCountByuserIdAndThreadId($value['userId'], $value['id']);
if ($userPostsNum == $threadPostsNum) {
$unPostedQuestion[] = $value;
}
}
}
if ($postStatus == 'unPosted') {
$questions = $unPostedQuestion;
}
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($questions, 'userId'));
$courses = $this->getCourseService()->findCoursesByIds(ArrayToolkit::column($questions, 'courseId'));
$lessons = $this->getCourseService()->findLessonsByIds(ArrayToolkit::column($questions, 'lessonId'));
return $this->render('TopxiaAdminBundle:CourseQuestion:index.html.twig', array('paginator' => $paginator, 'questions' => $questions, 'users' => $users, 'courses' => $courses, 'lessons' => $lessons, 'type' => $postStatus));
}
示例6: indexAction
public function indexAction(Request $request)
{
$total = $this->getTagService()->getAllTagCount();
$paginator = new Paginator($request, $total, 20);
$tags = $this->getTagService()->findAllTags($paginator->getOffsetCount(), $paginator->getPerPageCount());
return $this->render('TopxiaAdminBundle:Tag:index.html.twig', array('tags' => $tags, 'paginator' => $paginator));
}
示例7: indexAction
public function indexAction(Request $request, $courseId)
{
$course = $this->getCourseService()->tryManageCourse($courseId);
$conditions = $request->query->all();
if (empty($conditions['target'])) {
$conditions['targetPrefix'] = "course-{$course['id']}";
}
if (!empty($conditions['keyword'])) {
$conditions['stem'] = $conditions['keyword'];
}
//现实所有的题目包括设置为中间题的题目
$conditions['isMiddle'] = 'all';
if (!empty($conditions['parentId'])) {
$parentQuestion = $this->getQuestionService()->getQuestion($conditions['parentId']);
if (empty($parentQuestion)) {
return $this->redirect($this->generateUrl('course_manage_question', array('courseId' => $courseId)));
}
$orderBy = array('createdTime', 'ASC');
} else {
$conditions['parentId'] = 0;
$parentQuestion = null;
$orderBy = array('createdTime', 'DESC');
}
$paginator = new Paginator($this->get('request'), $this->getQuestionService()->searchQuestionsCount($conditions), 10);
$questions = $this->getQuestionService()->searchQuestions($conditions, $orderBy, $paginator->getOffsetCount(), $paginator->getPerPageCount());
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($questions, 'userId'));
$targets = $this->get('topxia.target_helper')->getTargets(ArrayToolkit::column($questions, 'target'));
return $this->render('TopxiaWebBundle:CourseQuestionManage:index.html.twig', array('course' => $course, 'questions' => $questions, 'users' => $users, 'targets' => $targets, 'paginator' => $paginator, 'parentQuestion' => $parentQuestion, 'conditions' => $conditions, 'targetChoices' => $this->getQuestionTargetChoices($course)));
}
示例8: indexBatchAction
public function indexBatchAction(Request $request)
{
$conditions = $request->query->all();
$paginator = new Paginator($this->get('request'), $this->getMoneyCardService()->searchBatchsCount($conditions), 20);
$batchs = $this->getMoneyCardService()->searchBatchs($conditions, array('id', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
return $this->render('TopxiaAdminBundle:MoneyCard:index-batch.html.twig', array('batchs' => $batchs, 'paginator' => $paginator));
}
示例9: indexAction
public function indexAction(Request $request)
{
$conditions = $request->query->all();
$conditions = ArrayToolkit::parts($conditions, array('nickname'));
$paginator = new Paginator($this->get('request'), $this->getUserService()->searchUserCount($conditions), 20);
$users = $this->getUserService()->searchUsers($conditions, array('id', 'ASC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$inviteInformations = array();
foreach ($users as $key => $user) {
$invitedRecords = $this->getInviteRecordService()->findRecordsByInviteUserId($user['id']);
$payingUserCount = 0;
$coinAmountTotalPrice = 0;
$amountTotalPrice = 0;
$totalPrice = 0;
$totalCoinAmount = 0;
$totalAmount = 0;
foreach ($invitedRecords as $keynum => $invitedRecord) {
$coinAmountTotalPrice = $this->getOrderService()->analysisCoinAmount(array('userId' => $invitedRecord['invitedUserId'], 'coinAmount' => 0, 'status' => 'paid', 'paidStartTime' => $invitedRecord['inviteTime']));
$amountTotalPrice = $this->getOrderService()->analysisAmount(array('userId' => $invitedRecord['invitedUserId'], 'amount' => 0, 'status' => 'paid', 'paidStartTime' => $invitedRecord['inviteTime']));
$tempPrice = $this->getOrderService()->analysisTotalPrice(array('userId' => $invitedRecord['invitedUserId'], 'status' => 'paid', 'paidStartTime' => $invitedRecord['inviteTime']));
if ($coinAmountTotalPrice || $amountTotalPrice) {
$payingUserCount = $payingUserCount + 1;
}
$totalCoinAmount = $totalCoinAmount + $coinAmountTotalPrice;
$totalAmount = $totalAmount + $amountTotalPrice;
$totalPrice = $totalPrice + $tempPrice;
}
$inviteInformations[] = array('id' => $user['id'], 'nickname' => $user['nickname'], 'payingUserCount' => $payingUserCount, 'payingUserTotalPrice' => $totalPrice, 'coinAmountPrice' => $totalCoinAmount, 'amountPrice' => $totalAmount, 'count' => count($invitedRecords));
}
return $this->render('TopxiaAdminBundle:Invite:index.html.twig', array('paginator' => $paginator, 'inviteInformations' => $inviteInformations));
}
示例10: exploreAction
public function exploreAction(Request $request)
{
if (!$this->setting('course.live_course_enabled')) {
return $this->createMessageResponse('info', '直播频道已关闭');
}
$recenntLessonsCondition = array('status' => 'published', 'endTimeGreaterThan' => time());
$paginator = new Paginator($this->get('request'), $this->getCourseService()->searchLessonCount($recenntLessonsCondition), 30);
$recentlessons = $this->getCourseService()->searchLessons($recenntLessonsCondition, array('startTime', 'ASC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$courses = $this->getCourseService()->findCoursesByIds(ArrayToolkit::column($recentlessons, 'courseId'));
$recentCourses = array();
foreach ($recentlessons as $lesson) {
$course = $courses[$lesson['courseId']];
if ($course['status'] != 'published') {
continue;
}
$course['lesson'] = $lesson;
$recentCourses[] = $course;
}
$liveCourses = $this->getCourseService()->searchCourses(array('status' => 'published', 'type' => 'live'), 'lastest', 0, 10);
$userIds = array();
foreach ($liveCourses as $course) {
$userIds = array_merge($userIds, $course['teacherIds']);
}
$users = $this->getUserService()->findUsersByIds($userIds);
$default = $this->getSettingService()->get('default', array());
return $this->render('TopxiaWebBundle:LiveCourse:index.html.twig', array('recentCourses' => $recentCourses, 'liveCourses' => $liveCourses, 'users' => $users, 'paginator' => $paginator, 'default' => $default));
}
示例11: showAction
public function showAction(Request $request, $id)
{
$buyer = $this->getCurrentUser();
$ex = $request->query->all();
$myexchangeid = $ex['ex'];
$applyid = $ex[applyid];
$exchange = $this->getExchangeService()->getExchange($id);
$condition = array('exchangeId' => $exchange['id'], 'userId' => $buyer['id']);
$buyerapplys = $this->getApplyService()->searchApplys($condition, 'latest', 0, 10);
$buyerapplyIds = ArrayToolkit::column($buyerapplys, 'id');
$sellerId = $exchange['userId'];
$seller = $this->getUserService()->getUser($sellerId);
if (empty($exchange)) {
throw $this->createNotFoundException("宝贝不存在");
}
$conditions = array('exchangeId' => $exchange['id']);
$paginator = new Paginator($this->get('request'), $this->getApplyService()->searchApplyCount($conditions), 5);
$applys = $this->getApplyService()->searchApplys($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount());
$applysIds = ArrayToolkit::column($applys, 'id');
// dump($applysIds);
// die;
$flag = 0;
if (!empty($applysIds)) {
foreach ($buyerapplyIds as $val) {
if (in_array($val, $applysIds)) {
$flag = 1;
break;
}
}
}
$userIds = ArrayToolkit::column($applys, 'userId');
$users = $this->getUserService()->findUsersByIds($userIds);
return $this->render("TopxiaWebBundle:Exchange:show.html.twig", array('flag' => $flag, 'seller' => $seller, 'applyid' => $applyid, 'myexchangeid' => $myexchangeid, 'exchange' => $exchange, 'applys' => $applys, 'users' => $users, 'paginator' => $paginator));
}
示例12: 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));
}
示例13: logsAction
public function logsAction(Request $request)
{
$paginator = new Paginator($this->get('request'), $this->getAppService()->findLogCount(), 30);
$logs = $this->getAppService()->findLogs($paginator->getOffsetCount(), $paginator->getPerPageCount());
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($logs, 'userId'));
return $this->render('TopxiaAdminBundle:App:logs.html.twig', array('logs' => $logs, 'users' => $users));
}
示例14: indexAction
public function indexAction(Request $request)
{
$fields = $request->query->all();
$conditions = array('roles' => '', 'keywordType' => '', 'keyword' => '', 'keywordUserType' => '');
if (empty($fields)) {
$fields = array();
}
$conditions = array_merge($conditions, $fields);
//根据mobile查询user_profile获得userIds
if (isset($conditions['keywordType']) && $conditions['keywordType'] == 'verifiedMobile') {
$profilesCount = $this->getUserService()->searchUserProfileCount(array('mobile' => $conditions['keyword']));
$userProfiles = $this->getUserService()->searchUserProfiles(array('mobile' => $conditions['keyword']), array('id', 'DESC'), 0, $profilesCount);
$userIds = ArrayToolkit::column($userProfiles, 'id');
if (!empty($userIds)) {
unset($conditions['keywordType']);
unset($conditions['keyword']);
$conditions['userIds'] = $userIds;
}
}
$userCount = $this->getUserService()->searchUserCount($conditions);
$paginator = new Paginator($this->get('request'), $userCount, 20);
$users = $this->getUserService()->searchUsers($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$app = $this->getAppService()->findInstallApp("UserImporter");
$showUserExport = false;
if (!empty($app) && array_key_exists('version', $app)) {
$showUserExport = version_compare($app['version'], "1.0.2", ">=");
}
$userIds = ArrayToolkit::column($users, 'id');
$profiles = $this->getUserService()->findUserProfilesByIds($userIds);
return $this->render('TopxiaAdminBundle:User:index.html.twig', array('users' => $users, 'userCount' => $userCount, 'paginator' => $paginator, 'profiles' => $profiles, 'showUserExport' => $showUserExport));
}
示例15: listAction
public function listAction(Request $request, $id)
{
$classroom = $this->getClassroomService()->getClassroom($id);
$courses = $this->getClassroomService()->findActiveCoursesByClassroomId($id);
$coursesNum = count($courses);
$user = $this->getCurrentUser();
$member = $user ? $this->getClassroomService()->getClassroomMember($classroom['id'], $user['id']) : null;
if (!$this->getClassroomService()->canLookClassroom($classroom['id'])) {
return $this->createMessageResponse('info', "非常抱歉,您无权限访问该{$classroomSetting['name']},如有需要请联系客服", '', 3, $this->generateUrl('homepage'));
}
$conditions = array('classroomId' => $id);
$reviewsNum = $this->getClassroomReviewService()->searchReviewCount($conditions);
$paginator = new Paginator($this->get('request'), $reviewsNum, 20);
$reviews = $this->getClassroomReviewService()->searchReviews($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$reviewUserIds = ArrayToolkit::column($reviews, 'userId');
$reviewUsers = $this->getUserService()->findUsersByIds($reviewUserIds);
$classroom = $this->getClassroomService()->getClassroom($id);
$review = $this->getClassroomReviewService()->getUserClassroomReview($user['id'], $classroom['id']);
$layout = 'ClassroomBundle:Classroom:layout.html.twig';
if ($member && !$member['locked']) {
$layout = 'ClassroomBundle:Classroom:join-layout.html.twig';
}
if (!$classroom) {
$classroomDescription = array();
} else {
$classroomDescription = $classroom['about'];
$classroomDescription = strip_tags($classroomDescription, '');
$classroomDescription = preg_replace("/ /", "", $classroomDescription);
}
return $this->render("ClassroomBundle:Classroom\\Review:list.html.twig", array('classroom' => $classroom, 'courses' => $courses, 'paginator' => $paginator, 'reviewsNum' => $reviewsNum, 'reviews' => $reviews, 'userReview' => $review, 'reviewSaveUrl' => $this->generateUrl('classroom_review_create', array('id' => $id)), 'users' => $reviewUsers, 'member' => $member, 'layout' => $layout, 'classroomDescription' => $classroomDescription, 'canReview' => $this->isClassroomMember($classroom, $user['id'])));
}