/** * Handle Employee Bulk actions * * @since 0.1 * * @return void [redirection] */ public function employee_bulk_action() { if (!$this->verify_current_page_screen('erp-hr-employee', 'bulk-employees')) { return; } $employee_table = new \WeDevs\ERP\HRM\Employee_List_Table(); $action = $employee_table->current_action(); if ($action) { $redirect = remove_query_arg(array('_wp_http_referer', '_wpnonce', 'filter_employee'), wp_unslash($_SERVER['REQUEST_URI'])); switch ($action) { case 'delete': if (isset($_GET['employee_id']) && !empty($_GET['employee_id'])) { erp_employee_delete($_GET['employee_id'], false); } wp_redirect($redirect); exit; case 'permanent_delete': if (isset($_GET['employee_id']) && !empty($_GET['employee_id'])) { erp_employee_delete($_GET['employee_id'], true); } wp_redirect($redirect); exit; case 'restore': if (isset($_GET['employee_id']) && !empty($_GET['employee_id'])) { erp_employee_restore($_GET['employee_id']); } wp_redirect($redirect); exit; case 'filter_employee': wp_redirect($redirect); exit; case 'employee_search': $redirect = remove_query_arg(array('employee_search'), $redirect); wp_redirect($redirect); exit; } } }
<?php _e('Employee', 'wp-erp'); if (current_user_can('erp_create_employee')) { ?> <a href="#" id="erp-employee-new" class="add-new-h2"><?php _e('Add New', 'wp-erp'); ?> </a> <?php } ?> </h2> <div class="list-table-wrap"> <div class="list-table-inner"> <form method="get"> <input type="hidden" name="page" value="erp-hr-employee"> <?php $employee_table = new \WeDevs\ERP\HRM\Employee_List_Table(); $employee_table->prepare_items(); $employee_table->search_box(__('Search Employee', 'wp-erp'), 'erp-employee-search'); $employee_table->views(); $employee_table->display(); ?> </form> </div><!-- .list-table-inner --> </div><!-- .list-table-wrap --> </div>