<?php
/*
* Copyright 2008 Blandware (http://www.blandware.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Pager utilities.
*
* @package AtleapLite
* @author Roman Puchkovskiy
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
*/
/**
*/
require_once 'include/constants.php';
require_once 'Pager/Pager.php';
/**
* Class that has some configuration for pager.
*
* @package AtleapLite
*/
class DefaultPager extends Pager {
/**
* Factory method.
*
* @global int items per page
* @global int pager delta
* @param array $options pager options
* @return object pager
*/
function factory($options) {
global $perPage, $pagerDelta;
$defaultOptions = array(
'urlVar' => PAGE_ID_VAR,
'perPage' => $perPage,
'delta' => round($pagerDelta / 2),
'prevImg' => getMessage('pager.prevImg'),
'nextImg' => getMessage('pager.nextImg'),
'altPrev' => getMessage('pager.altPrev'),
'altNext' => getMessage('pager.altNext'),
'altPage' => getMessage('pager.altPage'),
'linkClass' => 'pageLink',
'mode' => 'Sliding',
'separator' => '',
'spacesBeforeSeparator' => 0,
'spacesAfterSeparator' => 1,
'firstPageText' => getMessage('pager.firstPageText'),
'firstPagePre' => '',
'firstPagePost' => '',
'lastPageText' => getMessage('pager.lastPageText'),
'lastPagePre' => '',
'lastPagePost' => '',
'curPageLinkClassName' => 'curPageLink',
'excludeVars' => array('clearFilters', 'resetPageId')
);
foreach ($options as $key => $value) {
$defaultOptions[$key] = $value;
}
return Pager::factory($defaultOptions);
}
}
/**
* Creates a pager instance.
*
* @param array $options optional pager options
* @return pager instance
*/
function getPager($options = array()) {
return DefaultPager::factory($options);
}
?>