results_per_page = ($rpp != '') ? $rpp : $this->default_rpp;
$this->pagenav = '';
}
function set_total_num_records($from='', $where='', $override='')
{
$this->total_num_records = ($override != '' && is_numeric($override)) ? $override : Database::ado_get_one("SELECT count(*) $from $where", 'pagination::set_total_num_records');
}
function set_current_page()
{
if($this->total_num_records == 0)
{
$this->current_page = 1;
}
else
{
$this->current_page = (isset($_GET['pagenum'])) ? $_GET['pagenum'] : 1;
}
}
function set_pagenav($qs_nav = '', $text_class='pagenavText')
{
$this->pagenav = ''; // remains blank if 1 page
$num_pages = ceil($this->total_num_records / $this->results_per_page);
$this->pagenav = '';
if($this->total_num_records > 0 && $num_pages > 1)
{
$this->pagenav = '
PAGE ';
for($i=1;$i<=$num_pages;++$i)
{
$this->pagenav .= ($i != $this->current_page) ? ''.$i.' ' : $i.' ';
$this->pagenav .= ' ';
}
$this->pagenav .= ' VIEW ALL > |
';
}
}
function set_pagenav_m($qs_nav = '')
{
// this is for backend
$num_pages = ceil($this->total_num_records / $this->results_per_page);
$this->pagenav = '';
$prevpage = $this->current_page-1;
$nextpage = $this->current_page+1;
$prevlink = ($this->current_page == 1) ? '<' : '