public static function getInstance() { if (!self::$_instance) { self::$_instance = new Hrm_Time(); } return self::$_instance; }
$search['from_date'] = array('label' => __('From Date', 'hrm'), 'class' => 'hrm-datepicker-from', 'value' => isset($_POST['from_date']) ? hrm_date2mysql($_POST['from_date']) : '', 'type' => 'text', 'desc' => __('Choose Date', 'hrm')); $search['to_date'] = array('label' => __('To Date', 'hrm'), 'class' => 'hrm-datepicker-to', 'value' => isset($_POST['to_date']) ? hrm_date2mysql($_POST['to_date']) : '', 'type' => 'text', 'desc' => __('Choose Date', 'hrm')); $search['type'] = array('type' => 'hidden', 'value' => '_search'); $search['action'] = 'hrm_search'; $search['table_option'] = 'hrm_attendance'; echo hrm_Settings::getInstance()->get_serarch_form($search, __('Attendance Records', 'hrm')); //search form $user_id = get_current_user_id(); $pagenum = hrm_pagenum(); $limit = hrm_result_limit(); if (isset($_POST['type']) && $_POST['type'] == '_search') { $search_satus = true; $query = Hrm_Time::getInstance()->get_individulat_punch($_POST, $limit, $pagenum); } else { $search_satus = false; $query = Hrm_Time::getInstance()->get_individulat_punch($_POST, $limit, $pagenum); } $posts = $query->posts; $total_pagination = $query->found_posts; ?> <div id="hrm-attendance"></div> <?php $add_permission = hrm_user_can_access($tab, $subtab, 'add') ? true : false; $delete_permission = hrm_user_can_access($tab, $subtab, 'delete') ? true : false; // $puch_status = get_user_meta( $user_id, '_puch_in_status', true ); $total_duration = 0; foreach ($posts as $key => $post) { if ($add_permission && hrm_user_can_access($tab, $subtab, 'punch_edit', true)) { $name_id = '<a href="#" class="hrm-time-editable" data-post_id=' . $post->ID . '>' . hrm_get_punch_in_time($post->post_date) . '<a>'; } else {
function new_punch_in() { check_ajax_referer('hrm_nonce'); $post = array(); $post = $_POST; $punch = Hrm_Time::getInstance()->new_punch_in($post); $url = $post['url']; if ($punch) { $page = $_POST['page']; $tab = $_POST['tab']; $subtab = $_POST['subtab']; $req_frm = urldecode($_POST['req_frm']); ob_start(); require_once $req_frm; wp_send_json_success(array('content' => ob_get_clean(), 'success_msg' => __('Successfully update puch', 'hrm'))); } }
$search['from_date'] = array('label' => __('From Date', 'hrm'), 'class' => 'hrm-datepicker-from', 'type' => 'text', 'desc' => __('Choose Date', 'hrm')); $search['to_date'] = array('label' => __('To Date', 'hrm'), 'class' => 'hrm-datepicker-to', 'type' => 'text', 'desc' => __('Choose Date', 'hrm')); $search['type'] = array('type' => 'hidden', 'value' => '_search'); $search['action'] = 'hrm_search'; $search['table_option'] = 'hrm_attendance_record_both'; echo hrm_Settings::getInstance()->get_serarch_form($search, __('Attendance Records for Employer/Employee', 'hrm')); ?> <div id="hrm-attendance"></div> <?php $pagenum = hrm_pagenum(); $limit = hrm_result_limit(); if (isset($_POST['type']) && $_POST['type'] == '_search') { $search_satus = true; $query = Hrm_Time::getInstance()->search_punch_in_out_recored($_POST, $limit, $pagenum); $total_pagination = $query->found_posts; $posts = $query->posts; } else { $search_satus = false; $total_pagination = 0; $posts = array(); } $add_permission = hrm_user_can_access($tab, $subtab, 'add') ? true : false; $delete_permission = hrm_user_can_access($tab, $subtab, 'delete') ? true : false; $puch_status = get_user_meta($user_id, '_puch_in_status', true); $total_duration = 0; foreach ($posts as $key => $post) { if ($add_permission) { $name_id = '<a href="#" class="hrm-time-editable" data-post_id=' . $post->ID . '>' . hrm_get_punch_in_time($post->post_date) . '<a>'; } else {