/** * Get the raw departments dropdown * * @param int company id * @param string $select_label pass any string to be as the first element * * @return array the key-value paired departments */ function erp_hr_get_departments_dropdown_raw($select_label = null) { $departments = erp_hr_get_departments(); $dropdown = array(0 => __('- Select Department -', 'wp-erp')); if ($select_label) { $dropdown = array(0 => $select_label); } if ($departments) { foreach ($departments as $key => $department) { $dropdown[$department->id] = stripslashes($department->title); } } return $dropdown; }
<h2><?php _e('HR Management', '$domain'); ?> </h2> <div class="erp-single-container"> <div class="erp-area-left"> <?php if (current_user_can('erp_create_employee')) { ?> <?php $employees = erp_hr_get_employees(); $departments = erp_hr_get_departments(); $designations = erp_hr_get_designations(); ?> <div class="badge-container"> <div class="badge-wrap badge-green"> <div class="badge-inner"> <h3><?php echo number_format_i18n(count($employees), 0); ?> </h3> <p><?php _e('Employees', 'wp-erp'); ?> </p> </div>
/** * Prepare the class items * * @return void */ function prepare_items() { global $per_page; $columns = $this->get_columns(); $hidden = array(); $sortable = $this->get_sortable_columns(); $this->_column_headers = array($columns, $hidden, $sortable); $per_page = 20; $current_page = $this->get_pagenum(); $offset = ($current_page - 1) * $per_page; $this->page_status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : '2'; // only ncessary because we have sample data $args = array('offset' => $offset, 'number' => $per_page); $this->items = erp_hr_get_departments($args); $this->set_pagination_args(array('total_items' => erp_hr_count_departments(), 'per_page' => $per_page)); }