aliroAbstractPageNav Class Reference

Inheritance diagram for aliroAbstractPageNav:

aliroAdminPageNav aliroUserPageNav

List of all members.

Public Member Functions

 __construct ($total, $limitstart, $limit)
 getPagesCounter ()
 writePagesLinks ($link='')

Public Attributes

 $limitstart = null
 $limit = null
 $total = null

Protected Member Functions

 makeLimitSteps ()
 fixLink ($link)


Detailed Description

Definition at line 71 of file aliroPageNav.php.


Constructor & Destructor Documentation

aliroAbstractPageNav::__construct ( total,
limitstart,
limit 
)

Definition at line 76 of file aliroPageNav.php.

References $limit, $limitstart, and $total.

00076                                                                 {
00077         $this->total = max($total, 0);
00078         $this->limit = max($limit, 1);
00079         if ($this->limit > $this->total) $this->limitstart = '0';
00080         else {
00081             while ($limitstart > $this->total) $limitstart -= $this->limit;
00082             $this->limitstart = ($limitstart > 0) ? $limitstart : '0';
00083         }
00084     }


Member Function Documentation

aliroAbstractPageNav::makeLimitSteps (  )  [protected]

Definition at line 86 of file aliroPageNav.php.

References aliroHTML::getInstance().

Referenced by aliroUserPageNav::getLimitBox(), and aliroAdminPageNav::getLimitBox().

00086                                          {
00087         $steps = array ('5', '10', '15', '20', '25', '30', '50');
00088         $alirohtml = aliroHTML::getInstance();
00089         foreach ($steps as $step) $limits[] = $alirohtml->makeOption($step);
00090         return $limits;
00091     }

aliroAbstractPageNav::fixLink ( link  )  [protected]

Definition at line 94 of file aliroPageNav.php.

References $sef, and aliroSEF::getInstance().

00094                                        {
00095         if ($this->isAdmin) return $link;
00096         $sef = aliroSEF::getInstance();
00097         return $sef->sefRelToAbs($link);
00098     }

aliroAbstractPageNav::getPagesCounter (  ) 

The html for the pages counter, eg, Results 1-10 of x

Definition at line 103 of file aliroPageNav.php.

References T_().

Referenced by aliroAdminPageNav::getListFooter(), and aliroAdminPageNav::writePagesCounter().

00103                                       {
00104         $html = '';
00105         $to_result = min ($this->limitstart + $this->limit, $this->total);
00106         if ($this->total) $html .= sprintf(T_("Results %d to %d of %d"), $this->limitstart+1, $to_result, $this->total);
00107         else $html .= T_('No records found.');
00108         return $html;
00109     }

aliroAbstractPageNav::writePagesLinks ( link = ''  ) 

The html for the Start - Previous - numbers - Next - End links

Reimplemented in aliroAdminPageNav.

Definition at line 115 of file aliroPageNav.php.

References T_().

00115                                               {
00116         $html = '';
00117         $total_pages = ceil( $this->total / $this->limit );
00118         $this_page = ceil( ($this->limitstart+1) / $this->limit );
00119         $start_loop = (floor(($this_page-1)/_ALIRO_PAGE_NAV_DISPLAY_PAGES))*_ALIRO_PAGE_NAV_DISPLAY_PAGES+1;
00120         $stop_loop = min($total_pages, $start_loop + _ALIRO_PAGE_NAV_DISPLAY_PAGES - 1);
00121         $link .= '&limit='. $this->limit;
00122         if ($this_page > 1) {
00123             $page = ($this_page - 2) * $this->limit;
00124             $html .= '<a href="'.$this->fixLink ($link.'&amp;limitstart=0').'" class="pagenav" title="'.T_('first page').'">&lt;&lt; '. T_('Start') .'</a> ';
00125             $html .= '<a href="'.$this->fixLink ($link.'&amp;limitstart='.$page).'" class="pagenav" title="'.T_('previous page').'">&lt; '. T_('Previous') .'</a> ';
00126         } else {
00127             $html .= '<span class="pagenav">&lt;&lt; '. T_('Start') .'</span> ';
00128             $html .= '<span class="pagenav">&lt; '. T_('Previous') .'</span> ';
00129         }
00130         for ($i=$start_loop; $i <= $stop_loop; $i++) {
00131             $page = ($i - 1) * $this->limit;
00132             if ($i == $this_page) $html .= '<span class="pagenav">'. $i .'</span> ';
00133             else $html .= '<a href="'.$this->fixLink ($link.'&amp;limitstart='.$page).'" class="pagenav"><strong>'. $i .'</strong></a> ';
00134         }
00135         if ($this_page < $total_pages) {
00136             $page = $this_page * $this->limit;
00137             $end_page = ($total_pages-1) * $this->limit;
00138             $html .= '<a href="'.$this->fixLink ($link.'&amp;limitstart='.$page).' " class="pagenav" title="'.T_('next page').'">'. T_('Next') .' &gt;</a> ';
00139             $html .= '<a href="'.$this->fixLink ($link.'&amp;limitstart='.$end_page).' " class="pagenav" title="'.T_('end page').'">'. T_('End') .' &gt;&gt;</a>';
00140         } else {
00141             $html .= '<span class="pagenav">'. T_('Next') .' &gt;</span> ';
00142             $html .= '<span class="pagenav">'. T_('End') .' &gt;&gt;</span>';
00143         }
00144         return $html;
00145     }


Member Data Documentation

aliroAbstractPageNav::$limitstart = null

Definition at line 72 of file aliroPageNav.php.

Referenced by __construct().

aliroAbstractPageNav::$limit = null

Definition at line 73 of file aliroPageNav.php.

Referenced by __construct().

aliroAbstractPageNav::$total = null

Definition at line 74 of file aliroPageNav.php.

Referenced by __construct().


The documentation for this class was generated from the following file:

Generated on Wed May 14 13:01:57 2008 for ALIRO by  doxygen 1.5.5