/** ************************************************************************ * REQUIRED! This is where you prepare your data for display. This method will * usually be used to query the database, sort and filter the data, and generally * get it ready to be displayed. At a minimum, we should set $this->items and * $this->set_pagination_args(), although the following properties and methods * are frequently interacted with here... * * @uses $this->_column_headers * @uses $this->items * @uses $this->get_columns() * @uses $this->get_sortable_columns() * @uses $this->get_pagenum() * @uses $this->set_pagination_args() **************************************************************************/ function prepare_items() { // process bulk actions $this->process_bulk_action(); // get pagination state $current_page = $this->get_pagenum(); $per_page = $this->get_items_per_page('orders_per_page', 20); // regard max table rows limit if ($max_per_page = get_option('wplister_force_table_items_limit')) { $per_page = min($per_page, $max_per_page); } // define columns $this->_column_headers = $this->get_column_info(); // fetch profiles from model $ordersModel = new EbayOrdersModel(); $this->items = $ordersModel->getPageItems($current_page, $per_page); $total_items = $ordersModel->total_items; // register our pagination options & calculations. $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page))); }