本文整理汇总了PHP中Pagination::getCurrentPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::getCurrentPage方法的具体用法?PHP Pagination::getCurrentPage怎么用?PHP Pagination::getCurrentPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::getCurrentPage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>");
}
}
}
示例2: BuckysAds
if (!buckys_check_user_acl(USER_ACL_MODERATOR)) {
buckys_redirect('/index.php', MSG_PERMISSION_DENIED, MSG_TYPE_ERROR);
}
$classAds = new BuckysAds();
if (isset($_REQUEST['action'])) {
if (!buckys_check_form_token()) {
buckys_redirect('/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
if ($_REQUEST['action'] == 'reject-ads') {
$classAds->rejectAds($_REQUEST['adID']);
buckys_redirect('/manage_ads.php', MSG_AD_ADS_REJECTED);
} else {
if ($_REQUEST['action'] == 'approve-ads') {
$classAds->approveAds($_REQUEST['adID']);
buckys_redirect('/manage_ads.php', MSG_AD_ADS_APPROVED);
}
}
}
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$totalCount = $classAds->getPendingAdsCount();
//Init Pagination Class
$pagination = new Pagination($totalCount, BuckysAds::$COUNT_PER_PAGE, $page);
$page = $pagination->getCurrentPage();
$objects = $classAds->getPendingAds($page, BuckysAds::$COUNT_PER_PAGE);
buckys_enqueue_javascript('manage_ads.js');
buckys_enqueue_stylesheet('account.css');
buckys_enqueue_stylesheet('moderator.css');
buckys_enqueue_stylesheet('publisher.css');
$TNB_GLOBALS['content'] = 'manage_ads';
$TNB_GLOBALS['title'] = "Moderator Panel";
require DIR_FS_TEMPLATE . $TNB_GLOBALS['template'] . "/" . $TNB_GLOBALS['layout'] . ".php";
示例3: actionList
/**
* Lists all schemata.
*/
public function actionList()
{
// Create list for sideBar usage
if ($this->request->getParam('sideBar')) {
$schemata = array();
foreach (Schema::model()->findAll() as $schema) {
$schemata[] = $schema->SCHEMA_NAME;
}
$this->sendJSON($schemata);
} else {
$criteria = new CDbCriteria();
// Pagination
$pages = new Pagination(Schema::model()->count($criteria));
$pages->setupPageSize('pageSize', 'schemata');
$pages->applyLimit($criteria);
$pages->route = '#schemata';
// Sort
$sort = new CSort('Schema');
$sort->attributes = array('name' => 'SCHEMA_NAME', 'tableCount' => 'tableCount', 'collation' => 'DEFAULT_COLLATION_NAME');
$sort->defaultOrder = 'SCHEMA_NAME ASC';
$sort->route = '#schemata';
$sort->applyOrder($criteria);
$criteria->group = 'SCHEMA_NAME';
$criteria->select = 'SCHEMA_NAME, DEFAULT_COLLATION_NAME, COUNT(*) AS tableCount';
$schemaList = Schema::model()->with(array('tables' => array('select' => 'COUNT(tables.TABLE_NAME) AS tableCount')))->together()->findAll($criteria);
$this->render('list', array('schemaList' => $schemaList, 'schemaCount' => $pages->getItemCount(), 'schemaCountThisPage' => min($pages->getPageSize(), $pages->getItemCount() - $pages->getCurrentPage() * $pages->getPageSize()), 'pages' => $pages, 'sort' => $sort));
}
}
示例4:
<option value="trash"><?php
_e('Remove', 'wp-sms');
?>
</option>
</select>
<input value="<?php
_e('Apply', 'wp-sms');
?>
" name="doaction" id="doaction" class="button-secondary action" type="submit"/>
</div>
<br class="clear">
</div>
</form>
<?php
if ($get_result) {
?>
<div class="pagination-log">
<?php
echo $Pagination->display();
?>
<p id="result-log">
<?php
echo ' ' . __('Page', 'wp-sms') . ' ' . $Pagination->getCurrentPage() . ' ' . __('From', 'wp-sms') . ' ' . $Pagination->getTotalPages();
?>
</p>
</div>
<?php
}
?>
</div>