本文整理汇总了PHP中Pagination类的典型用法代码示例。如果您正苦于以下问题:PHP Pagination类的具体用法?PHP Pagination怎么用?PHP Pagination使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pagination类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public function getList($id = "", $pg)
{
$purl = array();
if (isset($_GET['url'])) {
$purl = $_GET['url'];
$purl = rtrim($purl);
$purl = explode('/', $_GET['url']);
} else {
$purl = null;
}
if (!isset($purl['2'])) {
$pn = 1;
} else {
$pn = $purl['2'];
}
global $database;
$resultUser = $database->db_query("SELECT * FROM users_client");
$pagin = new Pagination();
$pagin->nr = $database->dbNumRows($resultUser);
$pagin->itemsPerPage = 20;
$users = User::find_by_sql("SELECT * FROM users_client WHERE company_id=" . $_SESSION['client_ident'] . " " . $pagin->pgLimit($pn));
$index_array = array("myusers" => $users, "mypagin" => $pagin->render($pg));
return $index_array;
return $index_array;
}
示例2: index
public function index()
{
$this->load->model('video/video');
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$limit = PAGESIZE;
//get certificates
$data = array('start' => ($page - 1) * $limit, 'limit' => $limit);
$this->data['video'] = $this->model_video_video->getvideoList($data);
$items_count = $this->model_video_video->getvideoCount();
//pagination
$route = $this->request->get['route'];
$pagination = new Pagination();
$pagination->total = $items_count;
$pagination->page = $page;
$pagination->limit = $limit;
$pagination->url = $this->url->link($route, 'page={page}', 'SSL');
$this->data['pagination'] = $pagination->render();
// var_dump($this->data);
$this->template = 'video/video.tpl';
$this->children = array('common/footer', 'common/header', 'common/banner', 'common/contentleft');
$this->response->setOutput($this->render());
}
示例3: listEncuestas
function listEncuestas()
{
global $uid, $uperms;
$where = "";
if (!$uperms['encuestas_w']) {
$where = "WHERE publicado = 's'";
}
$db = new DB();
$sql = "SELECT * FROM encuestas {$where}";
if (isset($_GET['starting'])) {
$starting = $_GET['starting'];
} else {
$starting = 0;
}
$objpag = new Pagination($sql, $starting, 20, 'index2.php?com=encuestas&do=list');
$res = $objpag->result;
$data = array();
$x = 0;
while ($line = $objpag->fetchNextObject($res)) {
$data[$x]['id'] = $line->id;
$data[$x]['titulo'] = $line->titulo;
$data[$x]['observaciones'] = $line->observaciones;
$data[$x]['fecha'] = $line->fecha;
$x++;
}
$anchors = $objpag->anchors;
$total = $objpag->total;
$tpl = new Elfic_Smarty();
$tpl->assign('lista', $data);
$tpl->assign('anchors', $anchors);
$tpl->assign('total', $total);
$tpl->display('encuestas/encuestasList.tpl');
}
示例4: plugins_update
/**
* function plugins_update to get
* plugins updates from the Database using pagination object.
*
* @author shubham meena mentored by Matthew Lagoe
*/
function plugins_update()
{
if (Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
$pagination = new Pagination("SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId", "lib", 5, "Plugincache");
$pageResult['plug'] = Gui_Elements::make_table($pagination->getElements(), array("getId", "getPluginName", "getPluginInfo", "getUpdateInfo"), array("id", "plugin_name", "plugin_info", "update_info"));
$pageResult['links'] = $pagination->getLinks(5);
$pageResult['lastPage'] = $pagination->getLast();
$pageResult['currentPage'] = $pagination->getCurrent();
global $INGAME_WEBPATH;
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
// check if shard is online
try {
$dbs = new DBLayer("shard");
$pageResult['shard'] = "online";
} catch (PDOException $e) {
$pageResult['shard'] = "offline";
}
return $pageResult;
} else {
// ERROR: No access!
$_SESSION['error_code'] = "403";
header("Cache-Control: max-age=1");
header("Location: index.php?page=error");
throw new SystemExit();
}
}
示例5: getList
/**
* the getList method is used to
* pupolate the listing table
*/
public function getList($id = "", $pg)
{
$purl = array();
if (isset($_GET['url'])) {
$purl = $_GET['url'];
$purl = rtrim($purl);
$purl = explode('/', $_GET['url']);
} else {
$purl = null;
}
if (!isset($purl['2'])) {
$pn = 1;
} else {
$pn = $purl['2'];
}
global $database;
$resultEmployee = $database->db_query("SELECT * FROM vendors");
$pagin = new Pagination();
//create the pagination object;
$pagin->nr = $database->dbNumRows($resultEmployee);
$pagin->itemsPerPage = 20;
$myitems = Vendor::find_by_sql("SELECT * FROM vendors " . $pagin->pgLimit($pn));
$index_array = array("vendors" => $myitems, "mypagin" => $pagin->render($pg));
return $index_array;
return $index_array;
}
示例6: action_default
/**
* 权限组列表
*/
public function action_default()
{
$this->quick_menu = array('administrator/group/add' => '添加权限组', 'administrator/' => '管理员列表', 'administrator/add' => '添加管理员');
if (!$this->session()->member()->perm()->is_own('administrator.view_group_info')) {
if ($this->session()->member()->perm()->is_own('administrator.can_edit_group')) {
$groups = $this->session()->member()->groups();
} else {
$this->message('抱歉,您无此权限');
}
}
$view = new View('admin/administrator/group_list');
if (isset($groups)) {
$view->list = $groups;
$view->group_manager = true;
} else {
if ($this->session()->member()->perm()->is_super_perm()) {
# 超级管理员列出所有组
$project = null;
} else {
$project = Core::$project;
}
$model_administrator = new Model_Admin_Administrator();
$count = $model_administrator->total_group_count($project);
if ($count) {
$pageconfig = Core::config('admin/pagination');
$pageconfig['total_items'] = $count;
$pagination = new Pagination($pageconfig);
$list = $model_administrator->get_group_list($project, $pagination->get_offset(), $pagination->get_items_per_page());
$view->list = $list;
$view->pagehtml = $pagination->render();
}
}
$view->render();
}
示例7: box
public function box()
{
if (!isset($this->params['type'])) {
$this->error(ECode::$MAIL_NOBOX);
}
$type = $this->params['type'];
try {
$mailBox = new MailBox(User::getInstance(), $type);
} catch (MailBoxNullException $e) {
$this->error(ECode::$MAIL_NOBOX);
}
$count = isset($this->params['url']['count']) ? $this->params['url']['count'] : Configure::read("pagination.mail");
if (($count = intval($count)) <= 0) {
$count = Configure::read('pagination.mail');
}
if ($count > Configure::read('plugins.api.page_item_limit')) {
$count = Configure::read('pagination.mail');
}
$page = isset($this->params['url']['page']) ? $this->params['url']['page'] : 1;
$page = intval($page);
$pagination = new Pagination($mailBox, $count);
$mails = $pagination->getPage($page);
$wrapper = Wrapper::getInstance();
$info = array();
foreach ($mails as $v) {
$info[] = $wrapper->mail($v);
}
$data['description'] = $mailBox->desc;
$data['pagination'] = $wrapper->page($pagination);
$data['mail'] = $info;
$this->set('data', $data);
$this->set('root', 'mailbox');
}
示例8: compile
protected function compile()
{
if (\Input::get('isAjax') == '1') {
return;
}
$objFilter = new Articlefilter($this->getRootIdFromUrl(), $this->imgSize);
$objFilter->selectedFilter = \Input::get('articlefilter_filter');
$objFilter->afstype = \Input::get('afstype');
$objFilter->sorting = $this->articlefilter_sorting;
$objFilter->showAll = true;
$objFilter->run();
/* search articles matching filter */
if ($objFilter->resultCount > 0) {
$resultCount = $objFilter->resultCount;
$results = $objFilter->results;
if ($this->perPage > 0 && $resultCount > $this->perPage) {
$objPagination = new \Pagination($resultCount, $this->perPage);
$this->Template->pagination = $objPagination->generate();
$page = \Input::get('page');
if ($page == '' || $page < 1) {
$page = 1;
}
$offset = ($page - 1) * $this->perPage;
$results = array_slice($results, $offset, $this->perPage);
}
$this->Template->resultCount = $resultCount;
$this->Template->results = $results;
$this->Template->showFilter = $this->articlefilter_showfilter;
$this->Template->selectedFilter = $objFilter->searchStrings;
$this->Template->selectedFilterHeadline = sprintf($GLOBALS['TL_LANG']['articlefilter']['selectedFilterHeadline'], $resultCount);
} else {
$this->Template->no_filter = true;
}
}
示例9: launch
function launch()
{
global $interface;
global $configArray;
global $library;
global $locationSingleton;
global $timer;
global $user;
$currentPage = isset($_GET['page']) ? intval($_GET['page']) : 1;
//Pagination
$pag = new Pagination();
$pag->setPagination($currentPage, 30);
//Most Popular
$listAPI = new ListAPI();
$listTitlesFE = $listAPI->getListTitles('freeEbooks', $pag);
$interface->assign('LIST', !empty($listTitlesFE['titles']) ? $listTitlesFE['titles'] : "");
$pag->setPagination($currentPage + 1, 30);
$moreTitles = $listAPI->getListTitles('freeEbooks', $pag);
if (!empty($moreTitles['titles'])) {
$interface->assign('NEXTPAGE', $currentPage + 1);
$interface->assign('ACTION', "FreeEbooks");
}
$interface->assign('ButtonBack', true);
$interface->assign('ButtonHome', true);
$interface->caching = 0;
$cacheId = 'homepage|' . $interface->lang;
//Disable Home page caching for now.
if (!$interface->is_cached('layout.tpl', $cacheId)) {
$interface->setPageTitle('Free eBooks');
$interface->assign('MobileTitle', 'Free eBooks');
$interface->setTemplate('listecontents.tpl');
}
$interface->display('layout.tpl', $cacheId);
}
示例10: getList
protected function getList()
{
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CATALOG_DASHBOARD'), 'href' => $this->url->link('catalog/dashboard')));
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_REVIEW')));
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$data = array('start' => ($page - 1) * $this->config->get('admin_limit'), 'limit' => $this->config->get('admin_limit'));
$reviewTotal = $this->model_catalog_review->getTotalReviews();
$pagination = new Pagination();
$pagination->total = $reviewTotal;
$pagination->page = $page;
$pagination->limit = $this->config->get('admin_limit');
$pagination->text = '';
$pagination->url = $this->url->link('catalog/review', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
$this->data = array_merge($this->data, array('reviews' => array(), 'insert' => $this->url->link('catalog/review/insert', 'token=' . $this->session->data['token'], 'SSL'), 'delete' => $this->url->link('catalog/review/delete', 'token=' . $this->session->data['token'], 'SSL'), 'pagination' => $pagination->renderAdmin()));
foreach ($this->model_catalog_review->getReviews($data) as $result) {
$this->data['reviews'][] = array_merge($result, array('status' => $result['status'] ? Language::getVar('SUMO_NOUN_ENABLED') : Language::getVar('SUMO_NOUN_DISABLED'), 'date_added' => Formatter::date($result['date_added']), 'edit' => $this->url->link('catalog/review/update', 'token=' . $this->session->data['token'] . '&review_id=' . $result['review_id'], 'SSL')));
}
$this->template = 'catalog/review_list.tpl';
$this->children = array('common/header', 'common/footer');
$this->response->setOutput($this->render());
}
示例11: generate_inner_html
function generate_inner_html()
{
$Pagination = new Pagination();
$Pagination->setPaging($this->Paging);
$this->page_prev = $Pagination->getPreviousPage();
$this->page_next = $Pagination->getNextPage();
$this->page_links = $Pagination->getPageLinks();
$inner_template = NULL;
switch ($this->mode) {
case 'relations':
case 'in_relations':
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl';
break;
default:
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl';
}
$obj_inner_template = new Template($inner_template, $this);
$obj_inner_template->set_object('links', $this->links);
$obj_inner_template->set_object('gid', @$this->gid);
$obj_inner_template->set('sub_title', @$this->sub_title);
$obj_inner_template->set('total', $this->Paging['count']);
$obj_inner_template->set('reciprocated_relationship_set', @$this->reciprocated_relationship_set);
$obj_inner_template->set('relations', @$this->relations);
$obj_inner_template->set('in_relations', @$this->in_relations);
$obj_inner_template->set('user_name', $this->page_user);
$obj_inner_template->set('page_prev', $this->page_prev);
$obj_inner_template->set('page_next', $this->page_next);
$obj_inner_template->set('page_links', $this->page_links);
$obj_inner_template->set('view_type', $this->view_type);
$inner_html = $obj_inner_template->fetch();
return $inner_html;
}
示例12: syncing
/**
* This function is beign used to load info that's needed for the syncing page.
* this function is used for notifying admins that there are unsynced changes, a brief overview of the non syned changes will be shown. The entries are being loaded here
* so that they can be passed to the template itself. Only admins can browse this page, others will be redirected to an error page.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function syncing()
{
if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))) {
//return a paginated version of all unsynced changes.
$pagination = new Pagination("SELECT * FROM ams_querycache", "lib", 5, "Querycache");
$pageResult['liblist'] = Gui_Elements::make_table($pagination->getElements(), array("getSID", "getType"), array("id", "type"));
$pageResult['links'] = $pagination->getLinks(5);
$pageResult['lastPage'] = $pagination->getLast();
$pageResult['currentPage'] = $pagination->getCurrent();
global $INGAME_WEBPATH;
$pageResult['ingame_webpath'] = $INGAME_WEBPATH;
//check if shard is online
try {
$dbs = new DBLayer("shard");
$pageResult['shard'] = "online";
} catch (PDOException $e) {
$pageResult['shard'] = "offline";
}
return $pageResult;
} else {
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Cache-Control: max-age=1");
header("Location: index.php?page=error");
throw new SystemExit();
}
}
示例13: results
public function results()
{
$id = $this->getParam(0, 0);
$type_label = $this->getParam(1, 0);
$page = !empty($this->getParam(2, 0)) ? (int) $this->getParam(2, 0) : 1;
//$search_query = $this->request->get('q', '');
$labels = Info::$type_labels;
$type_label = ucfirst(str_replace('-', ' ', $type_label));
$type = array_search($type_label, $labels);
//$infos = Info::getElements($id, $type);
/*
$vars = array (
'id' => $id,
'type_label' => $type_label,
'infos' => $infos,
'labels' => $labels
);
*/
$sql = 'SELECT id, quarter_id, name, type, description, url, rating, theme FROM info WHERE quarter_id = :quarter_id AND type = :type ORDER BY id ASC';
$bindings = array('quarter_id' => $id, 'type' => $type);
$pagination = new Pagination($sql, $bindings, 16, $page - 1);
$results = $pagination->getResults();
foreach ($results as $result) {
$infos[] = new Info($result);
}
//foreach ($infos as $key => $info) {
// $info->description=substr($info->description,0, 50);
//}
$vars = array('id' => $id, 'type_label' => $type_label, 'infos' => $infos, 'labels' => $labels, 'page' => $page, 'count_pages' => $pagination->getPagesCount(), 'count_total' => $pagination->getTotalCount());
$this->render('elements', $vars);
}
示例14: getList
protected function getList()
{
error_reporting(E_ALL);
ini_set('display_errors', 'On');
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$url = '';
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'), 'separator' => false);
$this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('sale/link', 'token=' . $this->session->data['token'] . $url, 'SSL'), 'separator' => ' :: ');
$this->data['insert'] = $this->url->link('sale/link/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
$this->data['delete'] = $this->url->link('sale/link/delete', 'token=' . $this->session->data['token'] . $url, 'SSL');
$this->data['user_groups'] = array();
$data = array('sort' => "ASC", 'order' => "link_order", 'start' => ($page - 1) * $this->config->get('config_admin_limit'), 'limit' => $this->config->get('config_admin_limit'));
$user_group_total = $this->model_sale_link->getTotalLinks();
$results = $this->model_sale_link->getTotalLink($data);
foreach ($results as &$result) {
$action = array();
$action[] = array('text' => $this->language->get('text_edit'), 'href' => $this->url->link('sale/link/update&id=' . $result['id'], 'token=' . $this->session->data['token'] . $url, 'SSL'));
$result['action'] = $action;
}
$this->data['results'] = $results;
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_no_results'] = $this->language->get('text_no_results');
$this->data['column_name'] = $this->language->get('column_name');
$this->data['column_action'] = $this->language->get('column_action');
$this->data['button_insert'] = $this->language->get('button_insert');
$this->data['button_delete'] = $this->language->get('button_delete');
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->session->data['success'])) {
$this->data['success'] = $this->session->data['success'];
unset($this->session->data['success']);
} else {
$this->data['success'] = '';
}
$url = '';
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$pagination = new Pagination();
$pagination->total = $user_group_total;
$pagination->page = $page;
$pagination->limit = $this->config->get('config_admin_limit');
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->url->link('sale/link', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
$this->data['pagination'] = $pagination->render();
$this->template = 'sale/link.tpl';
$this->children = array('common/header', 'common/footer');
$this->response->setOutput($this->render());
}
示例15: getData
private function getData()
{
$modelToolImage = $this->load->model('tool/image');
$urlParameters = $this->buildUrlParameterString($this->parameters);
$this->data['invoice'] = $this->url->link('sale/invoice/showForm', $urlParameters, 'SSL');
$this->data['print'] = $this->url->link('sale/repurchaseOrders/printPage', $urlParameters, 'SSL');
$this->data['orders'] = array();
$data = array('start' => ($this->parameters['page'] - 1) * $this->config->get('config_admin_limit'), 'limit' => $this->config->get('config_admin_limit'));
$data = array_merge($data, $this->parameters);
$order_items = RepurchaseOrderDAO::getInstance()->getOrders($data);
$showedCustomerIds = array();
$this->data['customers'] = array();
foreach ($order_items as $order_item) {
if (!in_array($order_item['customerId'], $showedCustomerIds)) {
$this->data['customers'][] = array('id' => $order_item['customerId'], 'name' => $order_item['customerName'] . '/' . $order_item['customerNick']);
$showedCustomerIds[] = $order_item['customerId'];
}
$actions = array();
$actions[] = array('text' => $this->getLanguage()->get('GOTO_ITEM'), 'href' => $order_item['itemUrl']);
$actions[] = array('text' => $this->getLanguage()->get('CHANGE_PICTURE'), 'href' => '', 'onclick' => 'imageManager(' . $order_item['orderItemId'] . ', $(this).parent().parent().find(\'img\'))');
/// Check if item URL is valid
if (preg_match('/https?:\\/\\/([\\w\\-\\.]+)/', $order_item['itemUrl'], $matches)) {
$siteName = $matches[1];
} else {
$siteName = 'Wrong URL format';
}
/// Get image path or URL
if (file_exists(DIR_IMAGE . $order_item['imagePath'])) {
$image = $modelToolImage->resize($order_item['imagePath'], 100, 100);
$hint = '';
} else {
$image = $modelToolImage->resize('no_image.jpg', 100, 100);
$hint = $this->getLanguage()->get('WARNING_HTML_PAGE_PROVIDED');
}
$this->data['orders'][] = array('privateComment' => $order_item['privateComment'], 'orderId' => $order_item['orderItemId'], 'underlyingOrderId' => $order_item['orderId'], 'hint' => $hint, 'imagePath' => $image, 'itemName' => $order_item['itemName'], 'itemUrl' => $order_item['itemUrl'], 'shopName' => $order_item['shopName'], 'siteName' => $siteName, 'customerName' => $order_item['customerName'], 'customerNick' => $order_item['customerNick'], 'customerUrl' => $this->url->link('sale/customer/update', 'token=' . $this->session->data['token'] . '&customer_id=' . $order_item['customerId'], 'SSL'), 'options' => nl2br(RepurchaseOrderDAO::getInstance()->getOptionsString($order_item['orderItemId'])), 'originalImagePath' => file_exists(DIR_IMAGE . $order_item['imagePath']) ? HTTP_IMAGE . $order_item['imagePath'] : $order_item['imagePath'], 'comment' => $order_item['comment'], 'publicComment' => $order_item['comment'], 'status' => $order_item['status'] ? Status::getStatus($order_item['status'], $this->config->get('config_language_id')) : "", 'quantity' => $order_item['quantity'], 'price' => (double) $order_item['price'], 'whiteprice' => (double) $order_item['whiteprice'], 'shipping' => (double) $order_item['shipping'], 'amount' => (double) $order_item['total'], 'actions' => $actions, 'whoOrders' => $order_item['whoOrders']);
}
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->session->data['success'])) {
$this->data['success'] = $this->session->data['success'];
unset($this->session->data['success']);
} else {
$this->data['success'] = '';
}
$pagination = new Pagination();
$pagination->total = RepurchaseOrderDAO::getInstance()->getOrdersCount($data);
$pagination->page = $this->parameters['page'];
$pagination->limit = $this->config->get('config_admin_limit');
$pagination->text = $this->getLanguage()->get('text_pagination');
$pagination->url = $this->url->link('sale/repurchaseOrders', $urlParameters . '&page={page}', 'SSL');
$this->data['pagination'] = $pagination->render();
$this->data['currencyCode'] = $this->config->get('config_currency');
$this->data['invoiceUrl'] = $this->url->link('sale/invoice/showForm', 'token=' . $this->session->data['token'], 'SSL');
$this->data['urlImageChange'] = $this->url->link('sale/repurchaseOrders/setProperty', 'propName=image&token=' . $this->parameters['token'], 'SSL');
$this->data['urlImageManager'] = $this->url->link('common/filemanager', 'field=image&token=' . $this->parameters['token'], 'SSL');
$this->data = array_merge($this->data, $this->parameters);
}