本文整理汇总了PHP中PagerModule::_CurrentPager方法的典型用法代码示例。如果您正苦于以下问题:PHP PagerModule::_CurrentPager方法的具体用法?PHP PagerModule::_CurrentPager怎么用?PHP PagerModule::_CurrentPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PagerModule
的用法示例。
在下文中一共展示了PagerModule::_CurrentPager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
/**
*
*
* @param array $Options
* @throws Exception
*/
public static function write($Options = array())
{
static $WriteCount = 0;
if (!self::$_CurrentPager) {
if (is_a($Options, 'Gdn_Controller')) {
self::$_CurrentPager = new PagerModule($Options);
$Options = array();
} else {
self::$_CurrentPager = new PagerModule(val('Sender', $Options, Gdn::controller()));
}
}
$Pager = self::$_CurrentPager;
$Pager->Wrapper = val('Wrapper', $Options, $Pager->Wrapper);
$Pager->MoreCode = val('MoreCode', $Options, $Pager->MoreCode);
$Pager->LessCode = val('LessCode', $Options, $Pager->LessCode);
$Pager->ClientID = val('ClientID', $Options, $Pager->ClientID);
$Pager->Limit = val('Limit', $Options, $Pager->Controller()->data('_Limit', $Pager->Limit));
$Pager->HtmlBefore = val('HtmlBefore', $Options, val('HtmlBefore', $Pager, ''));
$Pager->CurrentRecords = val('CurrentRecords', $Options, $Pager->Controller()->data('_CurrentRecords', $Pager->CurrentRecords));
// Try and figure out the offset based on the parameters coming in to the controller.
if (!$Pager->Offset) {
$Page = $Pager->Controller()->Request->get('Page', false);
if (!$Page) {
$Page = 'p1';
foreach ($Pager->Controller()->RequestArgs as $Arg) {
if (preg_match('`p\\d+`', $Arg)) {
$Page = $Arg;
break;
}
}
}
list($Offset, $Limit) = offsetLimit($Page, $Pager->Limit);
$TotalRecords = val('RecordCount', $Options, $Pager->Controller()->data('RecordCount', false));
$Get = $Pager->Controller()->Request->get();
unset($Get['Page'], $Get['DeliveryType'], $Get['DeliveryMethod']);
$Url = val('Url', $Options, $Pager->Controller()->SelfUrl . '?Page={Page}&' . http_build_query($Get));
$Pager->configure($Offset, $Limit, $TotalRecords, $Url);
} elseif ($Url = val('Url', $Options)) {
$Pager->Url = $Url;
}
echo $Pager->toString($WriteCount > 0 ? 'more' : 'less');
$WriteCount++;
// list($Offset, $Limit) = offsetLimit(GetValue, 20);
// $Pager->configure(
// $Offset,
// $Limit,
// $TotalAddons,
// "/settings/addons/$Section?Page={Page}"
// );
// $Sender->setData('_Pager', $Pager);
}