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


PHP Paginator::setCurrentPage方法代码示例

本文整理汇总了PHP中Paginator::setCurrentPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginator::setCurrentPage方法的具体用法?PHP Paginator::setCurrentPage怎么用?PHP Paginator::setCurrentPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Paginator的用法示例。


在下文中一共展示了Paginator::setCurrentPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAll

 public function getAll($params = array())
 {
     $columns = isset($params['columns']) ? $params['columns'] : array('*');
     $sortColumn = isset($params['sort_column']) ? $params['sort_column'] : null;
     $sortDirection = isset($params['sort_direction']) ? $params['sort_direction'] : 'asc';
     $pageIndex = isset($params['page_index']) ? $params['page_index'] : 1;
     $pageSize = isset($params['page_size']) ? $params['page_size'] : 10;
     $includes = isset($params['includes']) ? $params['includes'] : array();
     $criteria = isset($params['criteria']) ? $params['criteria'] : array();
     $query = TaxRate::with($includes);
     if ($sortColumn) {
         $query = $query->orderBy($sortColumn, $sortDirection);
     }
     foreach ($criteria as $value) {
         $op = isset($value['op']) ? $value['op'] : '=';
         $query = $query->where($value['column'], $op, $value['value']);
     }
     if (isset($params['page_index']) || isset($params['page_size'])) {
         Paginator::setCurrentPage($pageIndex);
         $items = $query->select($columns)->paginate($pageSize);
     } else {
         $items = $query->select($columns)->get();
     }
     return $items;
 }
开发者ID:pda-code,项目名称:eshop-angular-laravel,代码行数:25,代码来源:TaxRateService.php

示例2: getAll

 public function getAll($params = array(), $language_id)
 {
     //$columns = isset($params['columns']) ? $params['columns'] : array('*');
     //$sort_column = isset($params['sort_column']) ? $params['sort_column'] : null;
     $sort_direction = isset($params['sort_direction']) ? $params['sort_direction'] : 'asc';
     $page_index = isset($params['page_index']) ? $params['page_index'] : null;
     $page_size = isset($params['page_size']) ? $params['page_size'] : null;
     //$includes = isset($params['includes']) ? $params['includes'] : array();
     //$criteria = isset($params['criteria']) ? $params['criteria'] : array();
     $columns = ['payment_methods.*', 'payment_methods_descriptions.name'];
     $sort_column = "sort_order";
     //basic query
     $query = PaymentMethod::leftJoin("payment_methods_descriptions", function ($join) use($language_id) {
         $join->on('payment_methods.id', '=', 'payment_methods_descriptions.payment_method_id');
         $join->where('payment_methods_descriptions.language_id', '=', $language_id);
     })->orderBy($sort_column, $sort_direction);
     //pagination
     if (isset($page_index) || isset($page_size)) {
         Paginator::setCurrentPage($page_index);
         $items = $query->select($columns)->paginate($page_size);
     } else {
         $items = $query->select($columns)->get();
     }
     return $items;
 }
开发者ID:pda-code,项目名称:eshop-angular-laravel,代码行数:25,代码来源:PaymentMethodService.php

示例3: getRepliesWithLimit

 public function getRepliesWithLimit($limit = 30)
 {
     // 默认显示最新的回复
     if (is_null(\Input::get(\Paginator::getPageName()))) {
         $latest_page = ceil($this->reply_count / $limit);
         \Paginator::setCurrentPage($latest_page ?: 1);
     }
     return $this->replies()->orderBy('created_at', 'asc')->with('user')->paginate($limit);
 }
开发者ID:6174,项目名称:phphub,代码行数:9,代码来源:Topic.php

示例4: blog

 public function blog($page = 1)
 {
     $limit = 5;
     $offset = ($page - 1) * $limit;
     $posts = Post::take($limit)->skip($offset)->active()->orderBy('created_at', 'desc')->get();
     Paginator::setBaseUrl(Config::get('app.url') . '/blog');
     Paginator::setCurrentPage($page);
     $totalItems = Post::with('id')->active()->count();
     $paginator = PrettyPaginator::make($posts->toArray(), $totalItems, $limit);
     return View::make('blog.blog', ['posts' => $posts, 'paginate' => $paginator]);
 }
开发者ID:Rotron,项目名称:shop,代码行数:11,代码来源:BlogController.php

示例5: all

 public function all($page = 1)
 {
     $limit = 5;
     $offset = ($page - 1) * $limit;
     $articles = Article::take($limit)->skip($offset)->active()->orderBy('created_at', 'desc')->get();
     Paginator::setBaseUrl(Config::get('app.url') . '/articles');
     Paginator::setCurrentPage($page);
     $totalItems = Article::with('id')->active()->count();
     $paginator = PrettyPaginator::make($articles->toArray(), $totalItems, $limit);
     return View::make('article/all', ['articles' => $articles, 'setting' => Config::get('setting'), 'paginate' => $paginator]);
 }
开发者ID:Rotron,项目名称:shop,代码行数:11,代码来源:ArticleController.php

示例6: showCategory

 public function showCategory($link, $page = 1)
 {
     $limit = 9;
     $offset = ($page - 1) * $limit;
     $category = Category::where('link', '=', $link)->first();
     $products = Product::categorized($category)->take($limit)->skip($offset)->active()->orderBy('created_at', 'desc')->get();
     Paginator::setBaseUrl(asset("/category/{$link}"));
     Paginator::setCurrentPage($page);
     $totalItems = Product::categorized($category)->active()->count();
     $paginator = PrettyPaginator::make($products->toArray(), $totalItems, $limit);
     return View::make('shop.category', ['category' => $category, 'products' => $products, 'setting' => Config::get('setting'), 'paginate' => $paginator]);
 }
开发者ID:Rotron,项目名称:shop,代码行数:12,代码来源:CategoryController.php

示例7: search

 /**
  * Search page, using google's.
  */
 public function search()
 {
     $query = Purifier::clean(Input::get('q'));
     $limit = 20;
     $latest_page = Input::get('page') ?: 1;
     \Paginator::setCurrentPage($latest_page);
     $topics = $this->topic->where('title', 'like', '%' . $query . '%')->with('user', 'node', 'lastReplyUser')->paginate($limit);
     $nodes = Node::allLevelUp();
     $links = Link::remember(1440)->get();
     return View::make('topics.index', compact('topics', 'nodes', 'links'));
     //return Redirect::away('https://www.baidu.com/search?q=site:phphub.org ' . $query, 301);
 }
开发者ID:azonwan,项目名称:pingju,代码行数:15,代码来源:PagesController.php

示例8: _list

 public function _list($page = 1, $searchString = null)
 {
     if (!empty($searchString)) {
         $roles = Role::where('ime', 'like', '%' . $searchString . '%')->orderBy('ime');
     } else {
         $roles = Role::orderBy('ime');
     }
     if ($page != 1) {
         Paginator::setCurrentPage($page);
     }
     $roles = $roles->paginate(10);
     $v = View::make('Role.list')->with('roles', $roles);
     if (Request::ajax()) {
         return $v->renderSections()['list'];
     }
     return $v;
 }
开发者ID:Firtzberg,项目名称:Edu,代码行数:17,代码来源:RoleController.php

示例9: _list

 public function _list($page = 1, $searchString = null)
 {
     if (!empty($searchString)) {
         $cjenovnici = Cjenovnik::where('ime', 'like', '%' . $searchString . '%')->orderBy('ime');
     } else {
         $cjenovnici = Cjenovnik::orderBy('ime');
     }
     if ($page != 1) {
         Paginator::setCurrentPage($page);
     }
     $cjenovnici = $cjenovnici->paginate(10);
     $v = View::make('Cjenovnik.list')->with('cjenovnici', $cjenovnici);
     if (Request::ajax()) {
         return $v->renderSections()['list'];
     }
     return $v;
 }
开发者ID:Firtzberg,项目名称:Edu,代码行数:17,代码来源:CjenovnikController.php

示例10: _list

 public function _list($page = 1, $searchString = null)
 {
     if (!empty($searchString)) {
         $ucionice = Ucionica::where('naziv', 'like', '%' . $searchString . '%')->orderBy('naziv');
     } else {
         $ucionice = Ucionica::orderBy('naziv');
     }
     if ($page != 1) {
         Paginator::setCurrentPage($page);
     }
     $ucionice = $ucionice->paginate(10);
     $v = View::make('Ucionica.list')->with('ucionice', $ucionice);
     if (Request::ajax()) {
         return $v->renderSections()['list'];
     }
     return $v;
 }
开发者ID:Firtzberg,项目名称:Edu,代码行数:17,代码来源:UcionicaController.php

示例11: getAll

 public function getAll()
 {
     $sortColumn = Input::get('sortColumn');
     $sortDirection = Input::get('sortDirection');
     $pageIndex = Input::get('pageIndex');
     $pageSize = Input::get('pageSize');
     $includes = Input::get('includes');
     $criteria = Input::get('criteria');
     $result = array("sortColumn" => Input::get('sortColumn'), "sortDirection" => $sortDirection, "pageIndex" => $pageIndex, "pageSize" => $pageSize, "includes" => $includes, "criteria" => $criteria);
     if ($pageIndex == NULL) {
         $pageIndex = 1;
     }
     if ($pageSize == NULL) {
         $pageSize = 10;
     }
     Paginator::setCurrentPage($pageIndex);
     return Response::json(Product::paginate($pageSize));
 }
开发者ID:pda-code,项目名称:eshop-angular-laravel,代码行数:18,代码来源:apiProductController.php

示例12: getList

 function getList()
 {
     if (Request::ajax()) {
         $defaultField = Input::get('defaultField');
         $defaultOrder = Input::get('defaultOrder');
         $searchData = Input::get('searchData');
         $showNumber = Input::get('showNumber');
         $isReset = Input::get('isReset');
         $this->data['defaultField'] = $defaultField;
         $this->data['defaultOrder'] = $defaultOrder;
         $this->data['defaultURL'] = $this->moduleURL;
         $this->data['showField'] = $this->model->getShowField();
         if ($isReset == 1) {
             Paginator::setCurrentPage(1);
         }
         $this->data['items'] = $this->model->where('publisher_id', $this->getPublisher()->id)->get();
         return View::make('ajaxShowList', $this->data);
     }
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:19,代码来源:AlternativeadPublisherController.php

示例13: getList

 /**
  *     Handle Ajax list item of module
  */
 function getList()
 {
     if (Request::ajax()) {
         $defaultField = "campaign." . Input::get('defaultField');
         $defaultOrder = Input::get('defaultOrder');
         $searchData = Input::get('searchData');
         $showNumber = Input::get('showNumber');
         $isReset = Input::get('isReset');
         $this->data['defaultField'] = str_replace("campaign.", "", $defaultField);
         $this->data['defaultOrder'] = $defaultOrder;
         $this->data['defaultURL'] = $this->moduleURL;
         $this->data['showField'] = $this->model->getShowField();
         if ($isReset == 1) {
             Paginator::setCurrentPage(1);
         }
         //pr($userCurrent,1);
         $this->data['lists'] = $this->model->getSearchCampaign($searchData)->select('campaign.*', 'category.name as cate_name', 'advertiser.name as name_advertiser', 'flight_website.publisher_base_cost')->where('flight_website.website_id', $this->getPublisher()->id)->orderBy($defaultField, $defaultOrder)->paginate($showNumber);
         return View::make('ajaxShowList', $this->data);
     }
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:23,代码来源:CampaignPublisherController.php

示例14: createPagination

 public static function createPagination($dataObject, $input)
 {
     //total rows
     $totalItems = count($dataObject->tableData);
     //array of rows
     $items = $dataObject->tableData;
     //display
     $perpage = 10;
     //if we go outside the range of links
     if ($input < 1 || $input > ceil($totalItems / $perpage)) {
         $input = 1;
         Paginator::setCurrentPage(1);
     }
     //offset for each page
     $offset = $input * $perpage - $perpage;
     //cut up the array for display
     $articles = array_slice($items, $offset, $perpage);
     //create the paginated data
     $paginator = Paginator::make($articles, $totalItems, $perpage);
     return $paginator;
 }
开发者ID:RoryAPower,项目名称:Engineering,代码行数:21,代码来源:CustomPagination.php

示例15: _list

 public function _list($page = 1, $searchString = null)
 {
     $djelatnici = User::with('role', 'role.permissions');
     if (!empty($searchString)) {
         $djelatnici = $djelatnici->where('name', 'like', '%' . $searchString . '%');
     }
     $djelatnici = $djelatnici->orderBy('name');
     if ($page != 1) {
         Paginator::setCurrentPage($page);
     }
     $djelatnici = $djelatnici->paginate(10);
     $v = View::make('Djelatnik.list')->with('instruktori', $djelatnici);
     if (Request::ajax()) {
         return $v->renderSections()['list'];
     }
     return $v;
 }
开发者ID:Firtzberg,项目名称:Edu,代码行数:17,代码来源:DjelatnikController.php


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