function update_empoyer($user_id, $postdata) { $display_name = $postdata['first_name'] . ' ' . $postdata['last_name']; update_user_meta($user_id, 'first_name', $postdata['first_name']); update_user_meta($user_id, 'last_name', $postdata['last_name']); wp_update_user(array('ID' => $user_id, 'display_name' => $display_name)); update_user_meta($user_id, '_job_title', $postdata['job_title']); update_user_meta($user_id, '_job_category', $postdata['job_category']); update_user_meta($user_id, '_location', $postdata['location']); update_user_meta($user_id, '_job_desc', $postdata['job_desc']); update_user_meta($user_id, '_status', $postdata['status']); update_user_meta($user_id, '_mob_number', $postdata['mobile']); update_user_meta($user_id, '_joined_date', hrm_date2mysql($postdata['joined_date'])); }
<div class="hrm-update-notification"></div> <?php $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)) {
function insert_task() { check_ajax_referer('hrm_nonce'); $is_update = isset($_POST['id']) ? true : false; $url = isset($_POST['url']) ? $_POST['url'] : ''; $start_date = !empty($_POST['start_date']) ? hrm_date2mysql($_POST['start_date']) : ''; $end_date = !empty($_POST['end_date']) ? hrm_date2mysql($_POST['end_date']) : ''; $data = array('post_title' => $_POST['title'], 'post_content' => $_POST['description'], 'post_type' => 'hrm_task', 'post_status' => 'publish'); if ($is_update) { $data['ID'] = $_POST['id']; $task_id = wp_update_post($data); Hrm_Evaluation::getInstance()->update_task_rating($_POST); $status = false; } else { $data['post_parent'] = $_POST['project_id']; $task_id = wp_insert_post($data); $assign = isset($_POST['assigned']) ? $_POST['assigned'] : 0; Hrm_Evaluation::getInstance()->new_inserted_task_rating($_POST['project_id'], $assign); $status = false; } if ($task_id) { $post = get_post($task_id); $project_id = $post->post_parent; if (!isset($_POST['assigned'])) { $assign_to = 0; } else { $assign_to = $_POST['assigned']; } update_post_meta($task_id, '_start_date', $start_date); update_post_meta($task_id, '_end_date', $end_date); update_post_meta($task_id, '_assigned', $assign_to); update_post_meta($task_id, '_completed', $_POST['status']); $project_budget = get_post_meta($project_id, '_budget', true); if ($project_budget) { $project_budget_utilize = get_post_meta($project_id, '_project_budget_utilize', true); $task_budget = floatval($_POST['task_budget']); $new_budget_utilize = $project_budget_utilize + $task_budget; if (floatval($project_budget) >= $new_budget_utilize) { update_post_meta($project_id, '_project_budget_utilize', $new_budget_utilize); update_post_meta($task_id, '_task_budget', $task_budget); } } $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('success_msg' => __('Updated successfully'), 'content' => ob_get_clean())); } else { wp_send_json_error(array('error_msg' => __('Update Failed', 'hrm'))); } }
function new_leave($post = null) { global $wpdb; $update = false; $table_name = $wpdb->prefix . 'hrm_leave'; $post_name = isset($post['name']) ? $post['name'] : array(); foreach ($post_name as $key => $user_id) { $args = array('emp_id' => $user_id, 'leave_type_id' => $post['type_id'], 'start_time' => hrm_date2mysql($post['from']), 'end_time' => hrm_date2mysql($post['to']), 'leave_comments' => $post['comment'], 'leave_status' => 1); $format = array('%d', '%d', '%s', '%s', '%s'); if (isset($post['id']) && !empty($post['id'])) { $where = array('id' => $post['id']); $update = $wpdb->update($table_name, $args, $where, $format); } else { $update = $wpdb->insert($table_name, $args, $format); } } if ($update) { return true; } else { return false; } }
<div class="hrm-update-notification"></div> <?php if (!hrm_user_can_access($tab, $subtab, 'view')) { printf('<h1>%s</h1>', __('You do no have permission to access this page', 'cpm')); return; } //search form $search['title'] = array('label' => __('Title', 'hrm'), 'type' => 'text', 'desc' => 'please insert title', 'value' => isset($_POST['title']) ? $_POST['title'] : ''); $search['date'] = array('label' => __('Date', 'hrm'), 'id' => 'hrm-src-date', 'class' => 'hrm-datepicker', 'type' => 'text', 'value' => isset($_POST['date']) ? hrm_date2mysql($_POST['date']) : '', 'desc' => 'please insert title'); $search['type'] = array('type' => 'hidden', 'value' => '_search'); $search['action'] = 'hrm_search'; $search['table_option'] = 'hrm_notice'; echo Hrm_Settings::getInstance()->get_serarch_form($search, 'Notice'); ?> <div id="hrm-admin-notice"></div> <?php $pagenum = hrm_pagenum(); $limit = hrm_result_limit(); if (isset($_POST['type']) && $_POST['type'] == '_search') { $post = $_POST; $results = Hrm_Settings::getInstance()->search_query($post, $limit, $pagenum); $search_satus = true; } else { $results = Hrm_Settings::getInstance()->hrm_query('hrm_notice', $limit, $pagenum); $search_satus = false; } $total = $results['total_row']; unset($results['total_row']); $add_permission = hrm_user_can_access($tab, $subtab, 'add') ? true : false; $delete_permission = hrm_user_can_access($tab, $subtab, 'delete') ? true : false; foreach ($results as $key => $value) {