public static function getInstance() { if (!self::$_instance) { self::$_instance = new hrm_Leave(); } return self::$_instance; }
foreach ($users as $key => $user) { $user_info[$user->ID] = $user->display_name; } $work_in_week = get_option('hrm_work_week'); $holidays = Hrm_Settings::getInstance()->hrm_query('hrm_holiday'); unset($holidays['total_row']); $holiday_index = array(); foreach ($holidays as $key => $holiday) { $holiday_index = array_merge($holiday_index, maybe_unserialize($holiday->index_holiday)); } foreach ($results as $key => $value) { if (!isset($leave_cat[$value->leave_type_id])) { continue; } $leave_action_dropdown = array('class' => 'hrm-leave-action', 'extra' => array('data-leave_id' => $value->id), 'option' => hrm_Leave::getInstance()->leave_employer_status(), 'selected' => $value->leave_status); $body[] = array('<input name="hrm_check[' . $value->id . ']" value="" type="checkbox">', '<a href="#" class="hrm-editable" data-user_id=' . $employer_id . ' data-table_option="hrm_leave" data-id=' . $value->id . '>' . $leave_cat[$value->leave_type_id] . '<a>', '<a href="#">' . $user_info[$value->emp_id] . '</a>', hrm_get_date2mysql($value->start_time), hrm_get_date2mysql($value->end_time), Hrm_Leave::getInstance()->leave_status($value->leave_status), $value->leave_comments, Hrm_Leave::getInstance()->total_leave($value->start_time, $value->end_time, $work_in_week, $holiday_index), Hrm_Leave::getInstance()->leave_take($value->start_time, $value->end_time, $work_in_week, $holiday_index), Hrm_Leave::getInstance()->leave_remain($value->start_time, $value->end_time, $work_in_week, $holiday_index)); $td_attr[] = array('class="check-column"'); } $table = array(); $table['head'] = array('<input type="checkbox">', 'Leave Type', 'Employee Name', 'Start Date', 'End Date', 'Leave Status', 'Comments', 'Total Leave(day)', 'Leave Take(day)', 'Leave Remain(day)'); $table['body'] = isset($body) ? $body : array(); $table['td_attr'] = isset($td_attr) ? $td_attr : array(); $table['th_attr'] = array('class="check-column"'); $table['table_attr'] = array('class' => 'widefat'); $table['table'] = 'hrm_leave'; $table['action'] = 'hrm_delete'; $table['tab'] = $tab; $table['subtab'] = $subtab; echo Hrm_Settings::getInstance()->table($table); //table $leave_cat = isset($leave_cat) && is_array($leave_cat) ? $leave_cat : array();
function instantiate() { Hrm_Ajax::getInstance(); Hrm_Admin::getInstance(); Hrm_Leave::getInstance(); Hrm_Employee::getInstance(); }