Elgg  Version 2.3
Namespaces | Variables
pagination.php File Reference

Go to the source code of this file.

Namespaces

 Elgg
 Save menu items.
 

Variables

if(elgg_in_context('widget')) $count = (int) elgg_extract('count', $vars, 0)
 
if(! $count) $offset = abs((int) elgg_extract('offset', $vars, 0))
 
if(! $limit=(int) elgg_extract('limit', $vars, elgg_get_config('default_limit'))) $offset_key = elgg_extract('offset_key', $vars, 'offset')
 
 $url_fragment = elgg_extract('url_fragment', $vars, '')
 
if(isset($vars['base_url']) && $vars['base_url']) elseif(elgg_is_xhr() &&!empty($_SERVER['HTTP_REFERER'])) else
 
 $base_url_has_fragment = preg_match('~#.~', $base_url)
 
 $get_href
 
if($count<=$limit && $offset==0) $total_pages = (int) ceil($count / $limit)
 
 $current_page = (int) ceil($offset / $limit) + 1
 
 $pages = array()
 
 $start_page = max(min([$current_page - 2, $total_pages - 4]), 1)
 
 $prev_offset = $offset - $limit
 
if($prev_offset< 1) $pages ['prev']
 
if($current_page==1) if(1< $start_page) if(1<($start_page - 2)) elseif($start_page==3) $max = 1
 
for($page=$start_page; $page<=$total_pages; $page++) if($total_pages >($start_page+6)) elseif(($start_page+5)==($total_pages - 1)) if($total_pages >=($start_page+5)) $next_offset = $offset + $limit
 
if($next_offset >=$count) $pages ['next']
 
if($current_page==$total_pages) $list =""
 
 foreach ( $pages as $page_num=> $page)
 

Variable Documentation

◆ $base_url_has_fragment

$base_url_has_fragment = preg_match('~#.~', $base_url)

Definition at line 44 of file pagination.php.

◆ $count

if (elgg_in_context( 'widget')) $count = (int) elgg_extract('count', $vars, 0)

Definition at line 21 of file pagination.php.

◆ $current_page

$current_page = (int) ceil($offset / $limit) + 1

Definition at line 60 of file pagination.php.

◆ $get_href

$get_href
Initial value:
= function ($offset) use ($base_url, $base_url_has_fragment, $offset_key, $url_fragment) {
$link .= "#$url_fragment";
}
return $link;
}
$link
Definition: container.php:14
elgg_http_add_url_query_elements($url, array $elements)
Sets elements in a URL's query string.
Definition: elgglib.php:1199
if(! $count) $offset
Definition: pagination.php:26
if(! $limit=(int) elgg_extract('limit', $vars, elgg_get_config('default_limit'))) $offset_key
Definition: pagination.php:32
$url_fragment
Definition: pagination.php:33
$base_url_has_fragment
Definition: pagination.php:44

Definition at line 46 of file pagination.php.

◆ $list

if ( $current_page==$total_pages) $list =""

Definition at line 131 of file pagination.php.

◆ $max

if ( $current_page==1) if (1< $start_page) if (1<( $start_page - 2)) elseif ( $start_page==3) $max = 1

Definition at line 95 of file pagination.php.

◆ $next_offset

for ( $page=$start_page;$page<=$total_pages;$page++) if ( $total_pages >( $start_page+6)) elseif (( $start_page+5)==( $total_pages - 1)) if ( $total_pages >=( $start_page+5)) $next_offset = $offset + $limit

Definition at line 117 of file pagination.php.

◆ $offset

if (! $count) $offset = abs((int) elgg_extract('offset', $vars, 0))
Examples
/root/Elgg/engine/lib/views.php.

Definition at line 26 of file pagination.php.

◆ $offset_key

if (! $limit=(int) elgg_extract( 'limit', $vars, elgg_get_config( 'default_limit'))) $offset_key = elgg_extract('offset_key', $vars, 'offset')

Definition at line 32 of file pagination.php.

◆ $pages [1/3]

$pages = array()

Definition at line 62 of file pagination.php.

◆ $pages [2/3]

if ( $next_offset >=$count) $pages[ 'next']
Initial value:
= [
'text' => elgg_echo('next'),
'href' => $get_href($next_offset),
]
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$get_href
Definition: pagination.php:46
for($page=$start_page; $page<=$total_pages; $page++) if($total_pages >($start_page+6)) elseif(($start_page+5)==($total_pages - 1)) if($total_pages >=($start_page+5)) $next_offset
Definition: pagination.php:117

Definition at line 122 of file pagination.php.

◆ $pages [3/3]

if ( $prev_offset< 1) $pages[ 'prev'] ( )
Initial value:
= [
'text' => elgg_echo('previous'),
'href' => $get_href($prev_offset),
]
$prev_offset
Definition: pagination.php:68

Definition at line 74 of file pagination.php.

◆ $prev_offset

$prev_offset = $offset - $limit

Definition at line 68 of file pagination.php.

◆ $start_page

$start_page = max(min([$current_page - 2, $total_pages - 4]), 1)

Definition at line 65 of file pagination.php.

◆ $total_pages

if ( $count<=$limit &&$offset==0) $total_pages = (int) ceil($count / $limit)

Definition at line 59 of file pagination.php.

◆ $url_fragment

$url_fragment = elgg_extract('url_fragment', $vars, '')

Definition at line 33 of file pagination.php.

◆ else

if (isset( $vars[ 'base_url']) &&$vars[ 'base_url']) elseif (elgg_is_xhr() &&!empty( $_SERVER[ 'HTTP_REFERER'])) else
Initial value:
{
$base_url = current_page_url()
current_page_url()
Returns the current page's complete URL.
Definition: input.php:65

Definition at line 40 of file pagination.php.

◆ foreach

foreach($pages as $page_num=> $page) (   $pages as,
  $page 
)

Definition at line 132 of file pagination.php.