public function customer_actions() { $pages = array(WC_CRM_TOKEN, WC_CRM_TOKEN . '-new-customer'); if (!isset($_GET['page']) || !in_array($_GET['page'], $pages)) { return false; } $this->customer_process_bulk_action(); if (isset($_POST['wc_crm_customer_action'])) { switch ($_POST['wc_crm_customer_action']) { case 'sent_email': WC_CRM_Screen_Activity::process_email_form(); break; case 'save_phone_call': WC_CRM_Screen_Activity::process_phone_call_form(); break; case 'create_customer': WC_CRM_Screen_Customers_Edit::create_user(); wc_crm_clear_transient(); break; default: if (isset($_POST['customer_id']) && !empty($_POST['customer_id'])) { WC_CRM_Screen_Customers_Edit::save($_POST['customer_id']); wc_crm_clear_transient(); } break; } } }
function prepare_items() { $columns = $this->get_columns(); $hidden = array(); $sortable = $this->get_sortable_columns(); $this->_column_headers = array($columns, $hidden, $sortable); $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(); $this->data = WC_CRM_Screen_Activity::get_activity(); $total_items = count($this->data); $found_data = array_slice($this->data, ($current_page - 1) * $per_page, $per_page); $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page)); $this->items = $found_data; }
public function logs_page() { if (isset($_GET['log_id']) && !empty($_GET['log_id'])) { WC_CRM_Screen_Activity::display_activity_data(); } else { WC_CRM_Screen_Activity::output(); } }