Пример #1
0
 /**
  * Get employee leave history
  *
  * @since 0.1
  *
  * @return void
  */
 public function get_employee_leave_history()
 {
     $this->verify_nonce('erp-hr-empl-leave-history');
     $year = isset($_POST['year']) ? intval($_POST['year']) : date('Y');
     $employee_id = isset($_POST['employee_id']) ? intval($_POST['employee_id']) : 0;
     $policy = isset($_POST['leave_policy']) ? intval($_POST['leave_policy']) : 'all';
     $args = array('year' => $year, 'user_id' => $employee_id, 'status' => 1, 'orderby' => 'req.start_date');
     if ($policy != 'all') {
         $args['policy_id'] = $policy;
     }
     $requests = erp_hr_get_leave_requests($args);
     ob_start();
     include WPERP_HRM_VIEWS . '/employee/tab-leave-history.php';
     $content = ob_get_clean();
     $this->send_success($content);
 }
Пример #2
0
 /**
  * Prepare the class items
  *
  * @return void
  */
 function prepare_items()
 {
     $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, 'status' => $this->page_status);
     $this->counts = erp_hr_leave_get_requests_count();
     $this->items = erp_hr_get_leave_requests($args);
     $this->set_pagination_args(array('total_items' => $this->counts[$this->page_status]['count'], 'per_page' => $per_page));
 }
Пример #3
0
        </tbody>

    </table>

<?php 
}
?>

<h3><?php 
_e('History', 'wp-erp');
?>
</h3>

<?php 
$cur_year = date('Y');
$requests = erp_hr_get_leave_requests(array('year' => $cur_year, 'user_id' => $employee->id, 'status' => 1, 'orderby' => 'req.start_date', 'number' => -1));
?>

<form action="#" id="erp-hr-empl-leave-history">
    <?php 
erp_html_form_input(array('name' => 'leave_policy', 'type' => 'select', 'options' => array('all' => __('All Policy', 'wp-erp')) + erp_hr_leave_get_policies_dropdown_raw()));
?>

    <select name="year" id="year">
        <?php 
for ($i = $cur_year; $i > $cur_year - 5; $i--) {
    ?>
            <option value="<?php 
    echo $i;
    ?>
"><?php