BLACK HILL SYSTEMS
Published on BLACK HILL SYSTEMS (http://www.blackhillsystems.com)

Home > MOUSE - Application Development Framework > Utilization Samples > List (or Manager) Page Render Example

List (or Manager) Page Render Example

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);
        }
    }
}

  • Log in [1] to post comments

Source URL: http://www.blackhillsystems.com/?q=node/30

Links
[1] http://www.blackhillsystems.com/?q=user/login&destination=node/30%23comment-form