本文整理汇总了PHP中JModelList::getPagination方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelList::getPagination方法的具体用法?PHP JModelList::getPagination怎么用?PHP JModelList::getPagination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModelList
的用法示例。
在下文中一共展示了JModelList::getPagination方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPagination
function getPagination()
{
$pagination = parent::getPagination();
$pagination->total = $this->total;
if ($pagination->total % $pagination->limit > 0) {
$nr_pages = intval($pagination->total / $pagination->limit) + 1;
} else {
$nr_pages = intval($pagination->total / $pagination->limit);
}
$pagination->set('pages.total', $nr_pages);
$pagination->set('pages.stop', $nr_pages);
return $pagination;
}
示例2: testGetPaginationSavesPaginationObjectInCache
/**
* Tests the getPagination method.
*
* @since 3.4
*
* @return void
*
* @testdox getPagination() stores JPagination object in object cache
*/
public function testGetPaginationSavesPaginationObjectInCache()
{
TestReflection::setValue($this->object, '__state_set', true);
$this->object->getPagination();
$this->assertArrayHasKey('0b072c19169b805b8ecca41340f0e20a', TestReflection::getValue($this->object, 'cache'));
}
示例3: getPagination
public function getPagination()
{
return parent::getPagination();
}
示例4: getPagination
/**
* Method to get a JPagination object for the data set.
*
* @return JPagination A JPagination object for the data set.
*/
public function getPagination()
{
if ($this->getState('list.limit', 20) == 0) {
return;
}
$pagination = parent::getPagination();
$pagination->prefix = 'slicomments';
$url = ContentHelperRoute::getArticleRoute($this->getState('article.slug'), $this->getState('article.catid'));
$uri = new JUri($url);
$query = $uri->getQuery(true);
foreach ($query as $key => $value) {
$pagination->setAdditionalUrlParam($key, $value);
}
return $pagination;
}
示例5: getItems
/**
* Method to get a list of newsletters.
*
* Overriden to inject convert the attribs field into a JParameter object.
*
* @return mixed An array of objects on success, false on failure.
*
* @since 1.0.1
*/
public function getItems()
{
$items = parent::getItems();
$user = JFactory::getUser();
$userId = $user->get('id');
$guest = $user->get('guest');
$groups = $user->getAuthorisedViewLevels();
$this->_pagination = parent::getPagination();
// Convert the parameter fields into objects.
foreach ($items as &$item) {
$item->params = clone $this->getState('params');
// Get display date
switch ($item->params->get('list_show_date')) {
case 'modified_time':
$item->displayDate = $item->modified_time;
break;
case 'published':
$item->displayDate = $item->publish_up == 0 ? $item->created_date : $item->publish_up;
break;
case 'created_date':
$item->displayDate = $item->created_date;
break;
default:
case 'mailing_date':
$item->displayDate = $item->mailing_date;
break;
}
// Compute the asset access permissions.
// Technically guest could edit an newsletter, but lets not check that to improve performance a little.
if (!$guest) {
$asset = 'com_bwpostman.newsletter.' . $item->id;
// Check general edit permission first.
if ($user->authorise('core.edit', $asset)) {
$item->params->set('access-edit', true);
} elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
// Check for a valid user and that they are the owner.
if ($userId == $item->created_by) {
$item->params->set('access-edit', true);
}
}
}
$access = $this->getState('filter.access');
if ($access) {
// If the access filter has been set, we already have only the newsletters this user can view.
$item->params->set('access-view', true);
} else {
// If no access filter is set, the layout takes some responsibility for display of limited information.
$item->params->set('access-view', in_array($item->access, $groups));
}
// Get the tags
$item->tags = new JHelperTags();
$item->tags->getItemTags('com_bwpostman.newsletter', $item->id);
}
return $items;
}
示例6: getPagination
/**
* Method to get a JPagination object for the data set.
*
* @return JPagination A JPagination object for the data set.
* @since 1.0.0
*/
public function getPagination()
{
if ($this->getState('filter.extension_name')) {
$page = parent::getPagination();
} else {
// Create the pagination object.
jimport('joomla.html.pagination');
$limit = (int) $this->getState('list.limit') - (int) $this->getState('list.links');
$page = new JPagination(0, 0, $limit);
}
return $page;
}