Using either Mouse Object constructor detailed above, a Message Manager Page Class would look like:
class MessageManager extends FilterPage {
function __construct() {
parent::__construct("Message Manager");
$this->data = new MessageDB();
$this->list = array();
$this->attributes = array();
$this->page_size = 20; //overload FilterPage
$this->total_rows = $this->data->count_lms_message(); //overload FilterPage
}
function pre_render() {
parent::pre_render();
if ($_REQUEST['print']) {
$this->page_size = $this->total_rows; //if this is a printable page, show all of the results
}
//select from lms_message table
$this->list = $this->data->list_lms_message(($this->get_current_page()-1) * $this->get_page_size(),
$this->get_page_size());
}
function body() {
if (!$_REQUEST['print']) {
render_pagination_bar($this->current_page, $this->total_pages, $this->total_rows, true);
}
auto_render_list($this->data, $this->list, true);
if (!$_REQUEST['print']) {
render_pagination_bar($this->current_page, $this->total_pages, $this->total_rows, false);
}
}
}
Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer