$myListTable->set_columns(array('cb' => 'Select All', 'shub_column_account' => __('Account', 'support_hub'), 'shub_column_product' => __('Product', 'support_hub'), 'shub_column_time' => __('Time', 'support_hub'), 'shub_column_from' => __('From', 'support_hub'), 'shub_column_summary' => __('Summary', 'support_hub'), 'shub_column_action' => __('Action', 'support_hub'))); /*$myListTable->set_sortable_columns( array( 'shub_column_time' => array( 'shub_column_time', 1 ), ) );*/ $myListTable->process_bulk_action(); // before we do the search on messages. $this_search = $search; if (isset($this_search['shub_status']) && $this_search['shub_status'] == -1) { unset($this_search['shub_status']); } // SupportHub::getInstance()->load_all_messages($this_search, $order); // $all_messages = SupportHub::getInstance()->all_messages; $all_messages = array_merge(SupportHubOutbox::get_failed(), SupportHubOutbox::get_pending()); $limit_pages = 2; // get about 10 pages of data to display in WordPress. $has_more = false; if (count($all_messages) >= $myListTable->get_pagenum() * $myListTable->items_per_page + $limit_pages * $myListTable->items_per_page) { $has_more = true; // a flag so we can show "more" in the pagination listing. } // todo - hack in here some sort of cache so pagination works nicer ? //module_debug::log(array( 'title' => 'Finished social messages', 'data' => '', )); $myListTable->set_layout_type($layout_type); $myListTable->set_data($all_messages); $myListTable->prepare_items(); $myListTable->pagination_has_more = $has_more; ?> <form method="post" id="shub_search_form">
public function send_outbox_messages($debug = false) { // find any pending outbox messages and send them // return stats on the messages left for update in the UI $pending_messages = SupportHubOutbox::get_pending(); if (count($pending_messages)) { foreach ($pending_messages as $pending_message) { $pending = new SupportHubOutbox($pending_message['shub_outbox_id']); $pending->send_queued(); } } }