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


PHP Pagination::getOffset方法代码示例

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


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

示例1: 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();
 }
开发者ID:didww,项目名称:demo,代码行数:33,代码来源:sms.php

示例2: 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();
 }
开发者ID:didww,项目名称:demo,代码行数:27,代码来源:call_history.php

示例3: actionList

 public function actionList()
 {
     $data = new stdClass();
     $batch = new Batch();
     $batch->organizationId = Yii::app()->user->getOrgId();
     $searchOptions = array();
     $searchField = Yii::app()->request->getQuery("search", "");
     if (!empty($searchField)) {
         $searchOptions["code"] = $searchField;
     }
     $pager = new Pagination(10, 10, Yii::app()->request->getQuery("page", 1), 100000, false);
     $searchOptions["start"] = $pager->getOffset();
     $searchOptions["rows"] = 10;
     $batchData = $batch->getBatches($searchOptions);
     $pager->setTotalItems($batchData["count"], true);
     $data->pager = $pager;
     $data->batches = $batchData["items"];
     $this->render('list', $data);
 }
开发者ID:rhl4ttr,项目名称:hello-world,代码行数:19,代码来源:BatchController.php

示例4: getListTitles

 /**
  * Returns information about the titles within a list including:
  * - Title, Author, Bookcover URL, description, record id
  */
 function getListTitles($listId = NULL, Pagination $pagination = NULL)
 {
     global $configArray;
     if (!$listId) {
         if (!isset($_REQUEST['id'])) {
             return array('success' => false, 'message' => 'The id of the list to load must be provided as the id parameter.');
         }
         $listId = $_REQUEST['id'];
     }
     if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
         $username = $_REQUEST['username'];
         $password = $_REQUEST['password'];
         global $user;
         $user = UserAccount::validateAccount($username, $password);
     } else {
         global $user;
     }
     if ($user) {
         $userId = $user->id;
     }
     if (is_numeric($listId) || preg_match('/list[-:](.*)/', $listId, $listInfo)) {
         if (isset($listInfo)) {
             $listId = $listInfo[1];
         }
         return $this->_getUserListTitles($listId);
     } elseif (preg_match('/search:(.*)/', $listId, $searchInfo)) {
         if (is_numeric($searchInfo[1])) {
             $titles = $this->getSavedSearchTitles($searchInfo[1]);
             if ($titles && count($titles) > 0) {
                 return array('success' => true, 'listTitle' => $listId, 'listDescription' => "Search Results", 'titles' => $titles, 'cacheLength' => 4);
             } else {
                 return array('success' => false, 'message' => 'The specified search could not be found.');
             }
         } else {
             //Do a default search
             $titles = $this->getSystemListTitles($listId);
             if (count($titles) > 0) {
                 return array('success' => true, 'listTitle' => $listId, 'listDescription' => "System Generated List", 'titles' => $titles, 'cacheLength' => 4);
             } else {
                 return array('success' => false, 'message' => 'The specified list could not be found.');
             }
         }
     } else {
         $systemList = null;
         $systemLists = $this->getSystemLists();
         foreach ($systemLists['lists'] as $curSystemList) {
             if ($curSystemList['id'] == $listId) {
                 $systemList = $curSystemList;
                 break;
             }
         }
         //The list is a system generated list
         if ($listId == 'newEpub' || $listId == 'newebooks') {
             require_once ROOT_DIR . 'sys/eContent/EContentRecord.php';
             $eContentRecord = new EContentRecord();
             $eContentRecord->orderBy('date_added DESC');
             $eContentRecord->limit(0, 30);
             $eContentRecord->find();
             $titles = array();
             while ($eContentRecord->fetch()) {
                 $titles[] = $this->setEcontentRecordInfoForList($eContentRecord);
             }
             return array('success' => true, 'listTitle' => $systemList['title'], 'listDescription' => $systemList['description'], 'titles' => $titles, 'cacheLength' => 1);
         } elseif ($listId == 'freeEbooks') {
             if (!$pagination) {
                 $pagination = new Pagination();
             }
             require_once ROOT_DIR . 'sys/eContent/EContentRecord.php';
             $eContentRecord = new EContentRecord();
             $eContentRecord->orderBy('date_added DESC');
             $eContentRecord->whereAdd('accessType = \'free\'');
             $eContentRecord->limit($pagination->getOffset(), $pagination->getNumItemsPerPage());
             $eContentRecord->find();
             $titles = array();
             while ($eContentRecord->fetch()) {
                 $titles[] = $this->setEcontentRecordInfoForList($eContentRecord);
             }
             return array('success' => true, 'listTitle' => $systemList['title'], 'listDescription' => $systemList['description'], 'titles' => $titles, 'cacheLength' => 1);
         } elseif ($listId == 'highestRated') {
             $query = "SELECT record_id, AVG(rating) FROM `user_rating` inner join resource on resourceid = resource.id GROUP BY resourceId order by AVG(rating) DESC LIMIT 30";
             $result = mysql_query($query);
             $ids = array();
             while ($epubInfo = mysql_fetch_assoc($result)) {
                 $ids[] = $epubInfo['record_id'];
             }
             $titles = $this->loadTitleInformationForIds($ids);
             return array('success' => true, 'listTitle' => $systemList['title'], 'listDescription' => $systemList['description'], 'titles' => $titles, 'cacheLength' => 1);
         } elseif ($listId == 'highestRatedEContent') {
             require_once ROOT_DIR . '/sys/eContent/EContentRating.php';
             $econtentRating = new EContentRating();
             $records = $econtentRating->getRecordsListAvgRating("DESC", 30);
             $titles = array();
             if (!empty($records)) {
                 foreach ($records as $eContentRecord) {
                     $titles[] = $this->setEcontentRecordInfoForList($eContentRecord);
                 }
//.........这里部分代码省略.........
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:101,代码来源:ListAPI.php

示例5: LandmarkDB

					<li><a href="../update_profile.php" title="About">Профил</a></li>
					<li><a href = "add.php">Добавете забележителност</a></li>
					<li><a href="all_landmarks.php" title="all">Всички</a></li>
					<li><a href="../contact_form.php" title="Contact Us">Контакт</a></li>
					<li><a href="../logout.php" title="logout">Изход</a></li>
				</ul>
			</div>
		</div><!-- // end #header -->
        <?php 
require '../classes/landmarkDB.php';
require '../classes/pagination.php';
require '../home.php';
$landmarks = new LandmarkDB();
$limit = 4;
$pagination = new Pagination();
$offset = $pagination->getOffset($limit);
$yourLandmarks = $landmarks->getYourLandmarks($limit, $offset);
$ids = array();
foreach ($yourLandmarks as $value) {
    $ids[] = (int) $value->id;
}
$yourLandmarkImages = $landmarks->selectLandmarkItemsImages($ids, 'small');
$bigImages = $landmarks->selectLandmarkItemsImages($ids, 'big');
?>
       	<?php 
if (count($yourLandmarks) > 0) {
    ?>
       	<div id="main">
			<div class="container">
				<div id="slideshow">
					<?php 
开发者ID:voknen,项目名称:project,代码行数:31,代码来源:my_landmarks.php

示例6: overview

 public function overview($tpl = null, $pagination = 0, CustomDataFilter $filter = null)
 {
     if ($filter === null) {
         $filter = new CustomDataFilter($this->position);
         foreach ($this->mainFields as $field) {
             $filter->field($field);
         }
         $filter->orderBy(reset($this->mainFields));
     }
     $pages = '';
     if ($pagination > 0) {
         $pg = new Pagination($pagination, $filter->getAmount());
         $pg->setUri($this->baseUri);
         $pg->parsePage();
         $filter->limit($pg->getPerPage(), $pg->getOffset());
         $pages = $pg->build();
     }
     $tpl = Response::getObject()->appendTemplate($tpl ? $tpl : "/Cms/fields/data_categories");
     $tpl->assign('pages', $pages, false);
     $tpl->assign('list', $filter->retrieveList(), false);
     $tpl->assign('baseUri', $this->baseUri);
     $tpl->output();
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:23,代码来源:class.FieldDataPages.php

示例7: pagination

 /**
  * Use Pagination object for limiting the results
  *
  * @param Pagination $pager
  * @return \Query
  */
 public function pagination(Pagination $pager)
 {
     $this->offset($pager->getOffset());
     $this->limit($pager->getRowsCount());
     return $this;
 }
开发者ID:nicksp,项目名称:BakedCarrot,代码行数:12,代码来源:Query.php

示例8: members

 protected function members()
 {
     $db = Database::getObject();
     $db->query("SELECT COUNT(*) FROM <p>user");
     $pp = Config::get('pagination.admin');
     $pg = new Pagination($pp, $db->fetchOne());
     $pg->parsePage();
     $pg->setUri(Uri::build('/Cms/admin/members'));
     $offset = $pg->getOffset();
     $db->query("SELECT * FROM <p>user ORDER BY surname, forename LIMIT <offset:int>, <pp:int>", compact("offset", "pp"));
     $data = array();
     while ($row = $db->fetchAssoc()) {
         $row['group'] = UserUtils::getGroupName($row['group_id']);
         $data[] = $row;
     }
     $tpl = Response::getObject()->appendTemplate("Cms/admin/members");
     $tpl->assign("pages", $pg->build(), false);
     $tpl->assign("data", $data);
     $tpl->output();
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:20,代码来源:class.AdminMemberPages.php


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