本文整理汇总了PHP中Pagination::setPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::setPage方法的具体用法?PHP Pagination::setPage怎么用?PHP Pagination::setPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::setPage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$this->getView()->addStylesheetURL('assets/stylesheets/sorting.css');
$customer_id = \Yoda\Request::getInt('customer_id');
$did_number = \Yoda\Request::getString('did_number');
$from_date = \Yoda\Request::getString('from_date');
$to_date = \Yoda\Request::getString('to_date');
$order = \Yoda\Request::getString('order', 'duration');
$direction = \Yoda\Request::getString('direction', 'ASC');
$pagination = new Pagination();
$pagination->setLimit(10);
$pagination->setPage(\Yoda\Request::getInt('page', 1));
$pagination->setLink('index.php?controller=call_history&did_number=' . $did_number . '&customer_id=' . $customer_id . '&from_date=' . $from_date . '&to_date=' . $to_date);
$cdr = new Didww\API2\CDRCollection();
$cdr->setCustomerId($customer_id);
$cdr->setDidNumber($did_number);
$cdr->setFromDate($from_date);
$cdr->setToDate($to_date);
$cdr->setOrderBy($order);
$cdr->setOrderDir(strtoupper($direction));
$cdr->setLimit($pagination->getLimit());
$cdr->setOffset($pagination->getOffset());
$cdrs = $cdr->getList();
$total = $cdr->getTotal();
$pagination->setTotal($total);
$this->getView()->setProperties(['view' => $this->getView(), 'cdrs' => $cdrs, 'customer_id' => $customer_id, 'did_number' => $did_number, 'from_date' => $from_date, 'to_date' => $to_date, 'pagination' => $pagination, 'order' => $order, 'direction' => $direction, 'total' => $total])->display();
}
示例2: index
function index()
{
$this->getView()->addStylesheetURL('assets/stylesheets/sorting.css');
$customer_id = \Yoda\Request::getInt('customer_id');
$destination = \Yoda\Request::getString('destination');
$source = \Yoda\Request::getString('source');
$success = \Yoda\Request::getString('success', '');
$from_date = \Yoda\Request::getString('from_date');
$to_date = \Yoda\Request::getString('to_date');
$order = \Yoda\Request::getString('order', 'destination');
$direction = \Yoda\Request::getString('direction', 'ASC');
$pagination = new Pagination();
$pagination->setLimit(10);
$pagination->setPage(\Yoda\Request::getInt('page', 1));
$pagination->setLink('index.php?controller=sms&customer_id=' . $customer_id . '&destination=' . $destination . '&source=' . $source . '&success=' . $success . '&from_date=' . $from_date . '&to_date=' . $to_date);
$sms = new Didww\API2\SMSCollection();
$sms->setCustomerId($customer_id);
$sms->setDestination($destination);
$sms->setSource($source);
if ($success !== '') {
$sms->setSuccess($success);
}
$sms->setFromDate($from_date);
$sms->setToDate($to_date);
$sms->setOrderBy($order);
$sms->setOrderDir(strtoupper($direction));
$sms->setLimit($pagination->getLimit());
$sms->setOffset($pagination->getOffset());
$sms_log = $sms->getList();
$total = $sms->getTotal();
$pagination->setTotal($total);
$this->getView()->setProperties(['view' => $this->getView(), 'sms_log' => $sms_log, 'customer_id' => $customer_id, 'destination' => $destination, 'source' => $source, 'success' => $success, 'from_date' => $from_date, 'to_date' => $to_date, 'pagination' => $pagination, 'order' => $order, 'direction' => $direction, 'total' => $total])->display();
}
示例3: index
/**
* Index function. Lists items items under specific category
*
* @return view
*/
public function index(Request $request, $cat_code = '')
{
if ($cat_code != '') {
//get category info
$objCategory = App\CategoryMaster::where('cat_code', $cat_code)->first();
if (null == $objCategory) {
abort(404);
}
//create an object of a pagination class
$pagination = new \Pagination();
//set number of records per page
$pagination->setRecordsPerPage(18);
//set links call method (PHP for simple full callback or JS for javascript function call (in case your fetching data using ajax))
$pagination->setRenderMode('PHP');
//get page number if its been ser in URL
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
//set page number
$pagination->setPage($page);
//get items for the category
$itemCount = DB::table('item_master')->join('type_master', 'item_master.item_type', '=', 'type_master.type_id')->join('category_master', 'type_master.category', '=', 'category_master.cat_id')->select('item_master.*')->where('status', 1)->where('category_master.cat_code', $cat_code)->count();
//set number of total records
$pagination->setTotalRecords($itemCount);
//calculate offset (copy and paste this to your code)
$offset = ($page - 1) * $pagination->getRecordsPerPage();
//get items for the category
$objItems = DB::table('item_master')->join('type_master', 'item_master.item_type', '=', 'type_master.type_id')->join('category_master', 'type_master.category', '=', 'category_master.cat_id')->select('item_master.*', 'type_master.type_code', 'type_master.name as type_name', 'category_master.name as cat_name', 'category_master.cat_code')->where('status', 1)->where('category_master.cat_code', $cat_code)->skip($offset)->take($pagination->getRecordsPerPage())->get();
return view('category_items', compact('objCategory', 'objItems', 'pagination'));
} else {
abort(404);
}
}
示例4: View
include 'admin_header.php';
$view = new View();
$user = new User();
$pagination = new Pagination();
// get the actual pagenumber (for pagination)
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
// config pagination class
$pagination->setTable('users');
$pagination->setPageLink('users.php');
$pagination->setLimit(10);
$pagination->setPage($page);
$pagination->setTotal();
$pagination->setPages();
$pagination->setOffset();
// get the users data as array (for view)
$users = $pagination->getData();
?>
<!-- content wrapper -->
<div class="container-full">
<!-- page row -->
<div class="row">
<!-- sidebar -->
<div class="col-sm-2 sidebar-wrapper">
示例5: action
function action(&$c)
{
set_menu($c);
/** ***********************************************************************
* 表示のページネーション、クエリの準備
*
* pn_sizeを変えると、一頁当たりの表示が変わる。
*
***************************************************************************/
//pagenation setting
$pagination = new Pagination();
$pn_size = $c->admin->getListNum();
$pn_page = isset($_GET['pn_page']) ? $_GET['pn_page'] : 1;
$order_tmp = '<a href="list.php?%QUERY%=%VALUE%&order=%ORDER%&sort=%SORT%">%TITLE%</a>';
$order_que = '';
//表示用のパラメータをセット
$c->set('cols', $c->admin->getListCols());
//query のテンプレを作る
$order_link = array();
$skey = array('/%ORDER%/', '/%SORT%/', '/%TITLE%/');
$rkey = array('created', 'desc', '新しい順');
$o1 = preg_replace($skey, $rkey, $order_tmp);
$rkey = array('created', 'asc', '古い順');
$o2 = preg_replace($skey, $rkey, $order_tmp);
$order_link['更新日'] = array($o1, $o2);
$rkey = array('size', 'desc', '大きい');
$o1 = preg_replace($skey, $rkey, $order_tmp);
$rkey = array('size', 'asc', '小さい');
$o2 = preg_replace($skey, $rkey, $order_tmp);
$order_link['サイズ'] = array($o1, $o2);
$rkey = array('name', 'asc', '昇順');
$o1 = preg_replace($skey, $rkey, $order_tmp);
$rkey = array('size', 'desc', '降順');
$o2 = preg_replace($skey, $rkey, $order_tmp);
$order_link['名前'] = array($o1, $o2);
/** ***********************************************************************
* セッションから、ページ名を作成、並び替えのクエリをセット
*
*
*
***************************************************************************/
//ページ名設定
if (isset($_SESSION['swfu']['page_name'])) {
$page = $_SESSION['swfu']['page_name'];
$c->set('page_name', $page);
$images = $c->image->find('$page_name=="' . $page . '"', 'created desc');
$c->set('images', $images);
}
//並び替えクエリ
if (isset($_GET['order']) && isset($_GET['sort'])) {
$order_que = '&order=' . $_GET['order'] . '&sort=' . $_GET['sort'];
}
/** ***********************************************************************
* ページ名の変更
*
***************************************************************************/
if (isset($_POST['change_page_name'])) {
$old_page = $_POST['old_page'];
$new_page = $_POST['new_page'];
$rs = $c->image->find('$page_name=="' . $old_page . '"');
foreach ($rs as $r) {
$r['page_name'] = $new_page;
$c->image->update($r);
}
$c->redirect('list.php?page=' . rawurlencode($new_page));
}
/** ***********************************************************************
* ページ名の設定
*
***************************************************************************/
if (isset($_POST['set_page_name'])) {
if ($_POST['new_page'] == '') {
$c->redirect('index.php');
} else {
$_SESSION['swfu']['page_name'] = $_POST['new_page'];
$c->redirect('list.php?page=' . rawurlencode($_POST['new_page']));
}
}
/** ***********************************************************************
* pageをもとに、リストを表示
*
*
*
***************************************************************************/
if (isset($_GET['page'])) {
$page = $_GET['page'];
$cond = '$page_name=="' . $page . '"';
$order = $order_que == '' ? 'created desc' : $_GET['order'] . ' ' . $_GET['sort'];
$total_cnt = $c->image->getCount($cond);
$pagination->setLink('list.php?page=' . rawurlencode($page) . '&pn_page=##PN_PAGE##' . $order_que);
$pagination->setPage($pn_page);
$pagination->setSize($pn_size);
$pagination->setTotalRecords($total_cnt);
$limit = $pagination->getLimit();
$images = $c->image->find($cond, $order, $limit);
$c->set('images', $images);
$c->set('pagination_link', $pagination->create_links());
$disp_pagename = $page == '' ? '未分類' : $page;
$c->set('h2title', '「' . $disp_pagename . '」のファイル一覧');
$skey = array('/%QUERY%/', '/%VALUE%/');
//.........这里部分代码省略.........