本文整理汇总了PHP中Pagination::setLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::setLimit方法的具体用法?PHP Pagination::setLimit怎么用?PHP Pagination::setLimit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::setLimit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: listPublicGroups
private function listPublicGroups($offset)
{
$sql = "SELECT * FROM groups WHERE active=1 AND type <> 'private' ";
require_once FRAMEWORK_PATH . 'lib/pagination/pagination.class.php';
$pagination = new Pagination($this->registry);
$pagination->setQuery($sql);
$pagination->setOffset($offset);
$pagination->setLimit(20);
$pagination->setMethod('cache');
$pagination->generatePagination();
if ($pagination->getNumRowsPage() == 0) {
$this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'groups/no-public.tpl.php', 'footer.tpl.php');
} else {
$this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'groups/public.tpl.php', 'footer.tpl.php');
$this->registry->getObject('template')->getPage()->addTag('groups', array('SQL', $pagination->getCache()));
$this->registry->getObject('template')->getPage()->addTag('page_number', $pagination->getCurrentPage());
$this->registry->getObject('template')->getPage()->addTag('num_pages', $pagination->getNumPages());
if ($pagination->isFirst()) {
$this->registry->getObject('template')->getPage()->addTag('first', '');
$this->registry->getObject('template')->getPage()->addTag('previous', '');
} else {
$this->registry->getObject('template')->getPage()->addTag('first', "<a href='groups/'>First page</a>");
$this->registry->getObject('template')->getPage()->addTag('previous', "<a href='groups/" . ($pagination->getCurrentPage() - 2) . "'>Previous page</a>");
}
if ($pagination->isLast()) {
$this->registry->getObject('template')->getPage()->addTag('next', '');
$this->registry->getObject('template')->getPage()->addTag('last', '');
} else {
$this->registry->getObject('template')->getPage()->addTag('first', "<a href='groups/" . $pagination->getCurrentPage() . "'>Next page</a>");
$this->registry->getObject('template')->getPage()->addTag('previous', "<a href='groups/" . ($pagination->getNumPages() - 1) . "'>Last page</a>");
}
}
}
示例3: getMany
public function getMany()
{
$req = $this->bcms->request();
$items = \ORM::for_table($this->tableName);
if ($req->get('group')) {
$group = $req->get('group');
$items = $items->where_in('group', $group);
$this->bcms->view()->appendData(array('currentGroup' => $group));
}
// Search
$query = $req->get('query');
if ($query) {
$items = $items->where_like('email', "%{$query}%");
$this->bcms->view()->appendData(array('query' => $query));
}
// Ordering
if ($req->get('order_by')) {
$orderBy = $req->get('order_by');
$items = $items->order_by_asc($orderBy);
$this->bcms->view()->appendData(array('order_by' => $orderBy));
} else {
$items = $items->order_by_desc('date_created');
}
$items = $items->left_outer_join('b_users_profiles', array($this->tableName . '.id', '=', 'b_users_profiles.user_id'));
//Pagination
$pagination = new Pagination($this->bcms);
$pagination->setLimit($this->perPage);
$pagination->setCount($items->count());
$items = $items->limit($this->perPage)->offset($pagination->start);
$items = $items->find_array();
if (!$items) {
return false;
}
return $items;
}
示例4: 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();
}
示例5: filterMembersByName
/**
* Search for members based on their name
* @param String $filter name
* @param int $offset the offset
* @return Object pagination object
*/
public function filterMembersByName($filter = '', $offset = 0)
{
$filter = $this->registry->getObject('db')->sanitizeData(urldecode($filter));
require_once FRAMEWORK_PATH . 'lib/pagination/pagination.class.php';
$paginatedMembers = new Pagination($this->registry);
$paginatedMembers->setLimit(25);
$paginatedMembers->setOffset($offset);
$query = "SELECT u.ID, u.username, p.name, p.dino_name, p.dino_gender, p.dino_breed FROM users u, profile p WHERE p.user_id=u.ID AND u.active=1 AND u.banned=0 AND u.deleted=0 AND p.name LIKE'%" . $filter . "%' ORDER BY p.name ASC";
$paginatedMembers->setQuery($query);
$paginatedMembers->setMethod('cache');
$paginatedMembers->generatePagination();
return $paginatedMembers;
}
示例6: View
<?php
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 -->
示例7: intval
<!-- content wrapper -->
<div class="row-fluid">
<?php
//$view->showProducts($category);
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
$pagination = new Pagination();
$pagination->setTable('products');
if ($category != null) {
$pagination->setCategory($category);
}
$pagination->setLimit($config->shop_articlepp);
$pagination->setPage($page);
//$pagination->setCategory('books');
$pagination->setTotal();
$pagination->setPages();
$pagination->setOffset();
$products = $pagination->getData();
$view->showProducts($products);
?>
</div> <!-- /.content wrapper -->
<!-- pagination -->
<div class="row text-center">
<div class="col-lg-12">
示例8: isset
<?php
include "./pagination.php";
$iLimit = 10;
$iPage = isset($_GET['page']) ? $_GET['page'] : 1;
$iStart = $iLimit * $iPage - $iLimit;
$oPaginate = new Pagination();
$aNames = $oPaginate->getNames($iStart, $iLimit);
$oPaginate->setCount($aNames['count']);
$oPaginate->setRange(3);
$oPaginate->setLimit($iLimit);
$oPaginate->setCurrentPage($iPage);
if ($aNames['count'] > 0) {
foreach ($aNames['names'] as $r) {
echo $r['name'] . '<br>';
}
}
echo $oPaginate->create();