function prepare_items() { $columns = $this->get_columns(); $hidden = array(); self::$data = $this->get_data(); $sortable = $this->get_sortable_columns(); $this->_column_headers = array($columns, $hidden, $sortable); usort(self::$data, array(&$this, 'usort_reorder')); $user = get_current_user_id(); $screen = get_current_screen(); $option = $screen->get_option('per_page', 'option'); $per_page = get_user_meta($user, $option, true); if (empty($per_page) || $per_page < 1) { $per_page = $screen->get_option('per_page', 'default'); } $current_page = $this->get_pagenum(); $total_items = count(self::$data); if ($_GET['page'] != 'wc_new_customer') { // only ncessary because we have sample data $this->found_data = array_slice(self::$data, ($current_page - 1) * $per_page, $per_page); $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page)); $this->items = $this->found_data; } else { $this->items = self::$data; } }
function get_customer_activity() { require_once 'wc_crm_logs.php'; $logs = new WC_Crm_Logs(); $logs->prepare_items(); $logs->display(); }