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


PHP Pager类代码示例

本文整理汇总了PHP中Pager的典型用法代码示例。如果您正苦于以下问题:PHP Pager类的具体用法?PHP Pager怎么用?PHP Pager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: preDisplay

 public function preDisplay()
 {
     parent::preDisplay();
     // Set header if needed
     $this->setHeader($this->data['currentFolderName'] . ' - ' . SITE_NAME, 'title');
     if (isset($this->data['folders'])) {
         foreach ($this->data['folders'] as $key => $folder) {
             if ($folder['filesNum'] == 0 && $folder['subFoldersNum'] == 0) {
                 $folder['link'] = '#';
             } else {
                 $folder['link'] = '/list/' . $folder['fd_id'];
             }
             $folder['desc'] = '(含' . $folder['subFoldersNum'] . '个图集, ' . $folder['filesNum'] . '张图片)';
             $this->data['folders'][$key] = $folder;
         }
         if ($this->data['subFolderPager'] == 'more') {
             $this->data['subFolderPager'] = '<div id="pagerMore"><a href="/list_subfolders/' . $this->data['currentFolderId'] . '">更多</a></div>';
         } else {
             import('Pager');
             $pager = new Pager($this->data['limitNum'], $this->data['subFolderTotal'], $this->data['page'], '/list_subfolders/' . $this->data['currentFolderId'] . '/');
             $this->data['subFolderPager'] = $pager->generatePages();
         }
     }
     if (isset($this->data['files'])) {
         if ($this->data['filesPager'] == 'more') {
             $this->data['filesPager'] = '<div id="pagerMore"><a href="/list_files/' . $this->data['currentFolderId'] . '">更多</a></div>';
         } else {
             import('Pager');
             $pager = new Pager($this->data['limitNum'], $this->data['filesTotal'], $this->data['page'], '/list_files/' . $this->data['currentFolderId'] . '/');
             $this->data['filesPager'] = $pager->generatePages();
         }
     }
 }
开发者ID:elevenfox,项目名称:VTree,代码行数:33,代码来源:folderPageView.class.php

示例2: showlist

function showlist()
{
    global $db;
    global $smarty;
    $page_size = getPageSize();
    // 每页显示的条目数
    $sub_pages = getSubPages();
    // 每次显示的页数
    $current_page = empty($_GET["p"]) ? "1" : $_GET["p"];
    // 当前被选中的页
    // 消息类型: 0表示用户发送  1表示管理员回复 2表示管理员群发消息 3 自动回复  4聊天室信息
    $sql = "SELECT a.*, b.nickname, b.localnickname, b.backup,  \r\n\t\tCONCAT(SUBSTR(b.headimgurl,1,(LENGTH(b.headimgurl) - 1)),'46') as headimgurl, c.content as replycontent , TIMESTAMPDIFF(SECOND  ,a.createtime, date_format(now(),'%Y%m%d%h%m%s')) timeInterval\r\n    \tfrom wx_user_msg a \r\n\t\tleft join wx_user_info b\r\n\t\t\ton a.createby = b.openid \r\n\t\tleft join wx_user_msg c\r\n\t\t\ton a.id = c.replyid\r\n\t\twhere a.msgtype in('0', '4', '5')\r\n\t\torder by createtime desc";
    $res = $db->query_page_list2($sql, $page_size, $current_page);
    $rowList = $db->fetch_all($res);
    // 查总记录数
    $countres = $db->query("SELECT count(1) as totalcount from wx_user_msg a where a.msgtype in('0', '4')");
    $countObj = $db->fetch($countres);
    // 总条目数
    $nums = $countObj["totalcount"];
    //echo $nums."=======>";
    $pager = new Pager($page_size, $nums, $current_page, $sub_pages);
    //$pagerlinker = $pager -> commonPager();
    $pagerlinker = $pager->mod5();
    //echo print_r($rowList);
    $smarty->assign('pager', $pagerlinker);
    $smarty->assign('messageArray', $rowList);
    $smarty->display('sysadmin/wxmessagelist.html');
}
开发者ID:jurimengs,项目名称:bangsm,代码行数:28,代码来源:wxmessagelist.php

示例3: smarty_modifier_page

/**
 * Smarty page modifier plugin
 *
 * Type:     modifier<br>
 * Name:     page<br>
 * Date:     JUNE 19, 2008
 * Purpose:  get page list by count
 * Input:    count int 
 * Input:    page_size int 
 * Example:  {$count|page:20}
 * @version 1.0
 * @param 	(int)	$count	| 分页的总数
 * @param 	(int)	$page_size		| 每页多少条记录
 * @return 	(String)	分页字符串
 */
function smarty_modifier_page($count, $page_size = 20)
{
    $count = intval($count);
    $page_size = intval($page_size);
    $pager = new Pager(array('rowCount' => $count, 'pageSize' => $page_size));
    return $pager->genYuan();
}
开发者ID:cmooony,项目名称:d4d-studio,代码行数:22,代码来源:modifier.page.php

示例4: action_list

 public function action_list()
 {
     $cid = Arr::get($_GET, 'cid');
     $where = array();
     $where['cid'] = $cid;
     $where['status'] = 'open';
     $where['ORDER'] = 'id DESC';
     $where = array_filter($where);
     $m_article = Model::factory('article', 'cms');
     $total = $m_article->count($where);
     $pager = new Pager($total, 10);
     $list = $m_article->select($pager->offset, $pager->size, $where)->as_array();
     $m_category = Model::factory('category', 'cms');
     $cat_list = $m_category->getAll()->as_array('id', 'name');
     foreach ($list as &$item) {
         $item['cat_name'] = isset($cat_list[$item['cid']]) ? $cat_list[$item['cid']] : '';
     }
     unset($item);
     if (isset($_GET['get_next_page'])) {
         $content = View::factory('article/list_incr');
         $content->list = $list;
         $next_page = $pager->next_page ? $pager->url($pager->next_page, array('cid' => $cid, 'get_next_page' => 'ajax')) : '';
         header('Content-Type: application/json; charset=utf-8');
         $ret = array('content' => (string) $content, 'next_page' => $next_page);
         echo json_encode($ret);
         exit;
     }
     $this->content = View::factory('article_list');
     $this->content->list = $list;
     $this->content->pager = $pager->render('common/pager');
     $this->content->next_page = $pager->next_page ? $pager->url($pager->next_page, array('cid' => $cid, 'get_next_page' => 'ajax')) : '';
 }
开发者ID:andygoo,项目名称:cms,代码行数:32,代码来源:Article.php

示例5: get_all_articles

function get_all_articles()
{
    $con = new database();
    $query = "select articles.articleID, articles.stageID, articles.title, articles.created from articles";
    $page = new Pager($query, 'navlist', '../templates/data_table.tpl.php');
    return $page->display_record($_GET['page']);
}
开发者ID:sudogem,项目名称:brcms,代码行数:7,代码来源:query_fns.php

示例6: getBaseDatagrid

 /**
  * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  * @param array $values
  * @return \Sonata\AdminBundle\Datagrid\DatagridInterface
  */
 public function getBaseDatagrid(AdminInterface $admin, array $values = array())
 {
     $pager = new Pager();
     $pager->setCountColumn($admin->getModelManager()->getIdentifierFieldNames($admin->getClass()));
     $formBuilder = $this->formFactory->createNamedBuilder('form', 'filter', array(), array('csrf_protection' => false));
     return new Datagrid($admin->createQuery(), $admin->getList(), $pager, $formBuilder, $values);
 }
开发者ID:khasinski,项目名称:Iphp,代码行数:12,代码来源:DatagridBuilder.php

示例7: pagestring

function pagestring($count, $pagesize, $wap = false)
{
    if (isset($_GET['page']) && intval($_GET['page']) == 0) {
        $pagesize = $count;
    }
    $p = new Pager($count, $pagesize, 'page');
    return array($pagesize, $p->pageNo, $p->genBasic());
}
开发者ID:Germey,项目名称:yinxingpm,代码行数:8,代码来源:common.php

示例8: pages

 /**
  * Тег постраничной навигации
  *
  * @param  array $config конфиг
  * @param  int   $total  Общее кол-во страниц
  *
  * @return string        формированный блок с постраничкой
  */
 public static function pages($config, $total)
 {
     $config['total_items'] = $total;
     $pages = '';
     if ($total > $config['items_per_page']) {
         $pagination = new Pager($config);
         // Сформированный блок с постраничкой
         $pages = $pagination->render();
     }
     return $pages;
 }
开发者ID:dle-modules,项目名称:DLE-Components,代码行数:19,代码来源:bpModifiers.php

示例9: testNoRecords

 public function testNoRecords()
 {
     $pager = new Pager();
     $pager->total_records = 0;
     $pager->records_per_page = 10;
     $pager->shown_pages = 5;
     $pager->shown_pages_wing = 2;
     // try last page first
     $this->assertEquals(0, $pager->getOffsetOf(10));
     $this->assertEquals([], $pager->getPages());
 }
开发者ID:hax4,项目名称:foundation,代码行数:11,代码来源:PagerTest.php

示例10: browse

 function browse($path, $visible, $offset = 0, $limit = 10)
 {
     global $intl, $loader;
     $loader->import('saf.Database.Pager');
     $output = '';
     $res = $this->doc->query($path);
     if (!is_array($res)) {
         $this->error = $this->doc->error;
         return 0;
     }
     $pager = new Pager();
     printf('<p>%s</p>', $pager->link($this->browseLink, $limit, $offset, count($res)));
     // create table header
     $output .= "<table border='1' cellpadding='5'>\n";
     $output .= "\t<tr>\n";
     $output .= "\t\t<th><input type='submit' name='action' value='" . $intl->get('Delete') . "' /></th>\n";
     $output .= "\t\t<th><input type='submit' value='" . $intl->get('Select All') . "' /></th>\n";
     foreach ($visible as $node) {
         $output .= "\t\t<th>" . ucwords(str_replace('_', ' ', $node)) . "</th>\n";
     }
     $output .= "\t</tr>\n";
     for ($i = $offset; $i < $offset + $limit; $i++) {
         if (!is_object($res[$i])) {
             break;
         }
         $row = $res[$i]->makeObj();
         $path = urlencode($res[$i]->path());
         $output .= "\t<tr>\n";
         $output .= "\t\t<td align='center'>";
         $output .= "<input type='checkbox' name='del_items[]' value='" . $path . "' />";
         //			$output .= $intl->get ('Delete');
         $output .= "</td>\n";
         $output .= "\t\t<td>";
         $output .= "<a href='" . $this->editLink . $path . "'>";
         $output .= $intl->get('Edit');
         $output .= '</a>';
         $output .= ' | ';
         $output .= "<a href='" . $this->downloadLink . $path . "'>";
         $output .= $intl->get('Download');
         $output .= '</a>';
         $output .= "</td>\n";
         foreach ($visible as $node) {
             $output .= "\t\t<td>" . $row->{$node} . "</td>\n";
         }
         $output .= "\t</tr>\n";
     }
     // create table footer
     $output .= "</table>\n";
     return $output;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:50,代码来源:Browser.php

示例11: set_recovery_post

 public function set_recovery_post()
 {
     $PagerList = new ObjList(['db_where_Arr' => ['status' => -1], 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'Pager', 'limitstart_Num' => 0, 'limitcount_Num' => 100]);
     foreach ($PagerList->obj_Arr as $key => $value_pager) {
         $Pager = new Pager(['pagerid_Num' => $value_pager->pagerid_Num]);
         $Pager->recovery();
     }
     if (!empty($PagerList->obj_Arr)) {
         $this->load->model('Message');
         $this->Message->show(['message' => '復原成功', 'url' => 'admin/base/pager/set/set']);
     } else {
         $this->load->model('Message');
         $this->Message->show(['message' => '已無可復原的項目', 'url' => 'admin/base/pager/set/set']);
     }
 }
开发者ID:fansWoo,项目名称:win_the_world,代码行数:15,代码来源:Set.php

示例12: actionNewsList

 public function actionNewsList()
 {
     $id = yii::app()->request->getParam('id');
     $page = yii::app()->request->getParam('page');
     $channel = TSChannel::model()->find('Channel_Identify=:id', array(':id' => $id));
     $criteria = new CDbCriteria();
     $criteria->condition = "Article_Is_Publish = 1 AND Channel_Identify ='" . $id . "'";
     $criteria->order = 'Article_Create_Time desc';
     $count = TSArticle::model()->count($criteria);
     $pages = new Pager($count);
     $pages->currentPage = (int) $page;
     $pages->pageSize = 3;
     $pages->applyLimit($criteria);
     $models = TSArticle::model()->findAll($criteria);
     $this->render('news_list', array('articles' => $models, 'pages' => $pages, 'id' => $id, 'channel' => $channel));
 }
开发者ID:JavaBird,项目名称:Easy3W,代码行数:16,代码来源:NewsController.php

示例13: defaultAction

 public function defaultAction()
 {
     $pageSize = 50;
     $page = Pager::get();
     $category = (int) Request::getGET('category', -1);
     $title = trim(Request::getGET('title', ''));
     $username = trim(Request::getGET('username', ''));
     $where = array();
     if ($category != -1) {
         $where[] = array('category', '=', $category);
     }
     if (!empty($username)) {
         $userInfo = UserCommonInterface::getByLoginName(array('login_name' => $username));
         $where[] = array('user_id', '=', Arr::get('id', $userInfo, 0));
     }
     if (!empty($title)) {
         $where[] = array('title', 'LIKE', "%{$title}%");
     }
     if ($category != -1) {
         $order = array('hidden' => 'ASC', 'title' => 'ASC', 'id' => 'DESC');
     } else {
         $order = array('id' => 'DESC');
     }
     $offset = ($page - 1) * $pageSize;
     $docList = DocInterface::getList(array('where' => $where, 'order' => $order, 'limit' => $pageSize, 'offset' => $offset));
     $allCount = empty($docList) ? 0 : DocInterface::getCount($where);
     $userIds = array_unique(array_column($docList, 'user_id'));
     $userHash = UserCommonInterface::getById(array('id' => $userIds));
     // 缓存部分的html
     $html = array();
     $html['pager'] = $this->view->fetch(array('renderAllCount' => $allCount, 'renderPageSize' => $pageSize, 'renderRadius' => 7), 'widget/pager.php');
     $this->renderFramework(array('html' => $html, 'docList' => $docList, 'userHash' => $userHash), 'doc/list.php');
 }
开发者ID:aozhongxu,项目名称:web_hqoj,代码行数:33,代码来源:ListController.class.php

示例14: defaultAction

 public function defaultAction()
 {
     $pageSize = 20;
     // 获取参数
     $page = Pager::get();
     $title = Request::getGET('title');
     $status = (int) Request::getGET('status');
     // 构建where
     $where = array();
     $where[] = array('user_id', '=', $this->loginUserInfo['id']);
     if (!empty($title)) {
         $where[] = array('title', 'LIKE', "%{$title}%");
     }
     if (!empty($status) && $status != -1) {
         $where[] = array('hidden', '=', $status - 1);
     }
     // 获取数据
     $order = array('refresh_at' => 'DESC', 'id' => 'DESC');
     $offset = ($page - 1) * $pageSize;
     $setList = OjProblemSetInterface::getList(array('where' => $where, 'order' => $order, 'limit' => $pageSize, 'offset' => $offset));
     $allCount = OjProblemSetInterface::getCount($where);
     foreach ($setList as &$setInfo) {
         $problemJson = $setInfo['problem_set'];
         $globalIds = (array) json_decode($problemJson, true);
         $setInfo['count'] = count($globalIds);
     }
     // 缓存部分的html
     $html = array();
     $html['pager'] = $this->view->fetch(array('renderAllCount' => $allCount, 'renderPageSize' => $pageSize, 'renderRadius' => 8), 'widget/pager.php');
     // 输出
     $this->renderFramework(array('html' => $html, 'setList' => $setList), 'setup/set/list.php');
 }
开发者ID:aozhongxu,项目名称:web_hqoj,代码行数:32,代码来源:ListController.class.php

示例15: init

 /**
  * Initializes the pager. Must be called before using the component.
  *
  * Takes user configuration and creates pager object ($this->Pager)
  *
  * @access public
  * @param array $config Configuration options for Pager::factory() method
  * @see http://pear.php.net/manual/en/package.html.pager.factory.php
  * @return void
  */
 function init($config)
 {
     // Get the correct URL, even with admin routes
     $here = array();
     if (defined('CAKE_ADMIN') && !empty($this->Controller->params[CAKE_ADMIN])) {
         $here[0] = $this->Controller->params[CAKE_ADMIN];
         $here[2] = substr($this->Controller->params['action'], strlen($this->Controller->params[CAKE_ADMIN]) + 1);
     } else {
         $here[2] = $this->Controller->params['action'];
     }
     $here[1] = Inflector::underscore($this->Controller->params['controller']);
     ksort($here);
     $url = implode('/', $here);
     // Set up the default configuration vars
     $this->params = array('mode' => 'Sliding', 'perPage' => 10, 'delta' => 5, 'totalItems' => '', 'httpMethod' => 'GET', 'currentPage' => 1, 'linkClass' => 'pager', 'altFirst' => 'First page', 'altPrev ' => 'Previous page', 'altNext' => 'Next page', 'altLast' => 'Last page', 'separator' => '', 'spacesBeforeSeparator' => 1, 'spacesAfterSeparator' => 1, 'useSessions' => false, 'firstPagePre' => '', 'firstPagePost' => '', 'firstPageText' => '<img src="' . $this->Controller->base . '/img/first.gif" alt="">', 'lastPagePre' => '', 'lastPagePost' => '', 'lastPageText' => '<img src="' . $this->Controller->base . '/img/last.gif" alt="">', 'prevImg' => '<img src="' . $this->Controller->base . '/img/prev.gif" alt="">', 'nextImg' => '<img src="' . $this->Controller->base . '/img/next.gif" alt="">', 'altPage' => 'Page', 'clearIfVoid' => true, 'append' => false, 'path' => '', 'fileName' => $this->Controller->base . DS . $url . DS . '%d', 'urlVar' => '');
     vendor('Pear/Pager/Pager');
     // Merge with user config
     $this->params = array_merge($this->params, $config);
     // sanitize requested page number
     if (!in_array($this->params['currentPage'], range(1, ceil($this->params['totalItems'] / $this->params['perPage'])))) {
         $this->params['currentPage'] = 1;
     }
     $this->Pager =& Pager::factory($this->params);
     // Set the template vars
     $this->Controller->set('pageLinks', $this->Pager->getLinks());
     $this->Controller->set('currentPage', $this->params['currentPage']);
     $this->Controller->set('isFirstPage', $this->Pager->isFirstPage());
     $this->Controller->set('isLastPage', $this->Pager->isLastPage());
 }
开发者ID:uwitec,项目名称:eduoa,代码行数:39,代码来源:pager.php


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