コード例 #1
0
$search['mobile'] = array('label' => __('Mobile', 'hrm'), 'type' => 'text', 'desc' => 'please insert mobile number', 'value' => isset($_POST['mobile']) ? $_POST['mobile'] : '');
$search['type'] = array('type' => 'hidden', 'value' => '_search');
$search['action'] = 'hrm_search';
$search['table_option'] = 'hrm_employee';
echo hrm_Settings::getInstance()->get_serarch_form($search, 'Employee Information');
?>
<div id="hrm-eployee-list"></div>
<?php 
$pagenum = hrm_pagenum();
$limit = hrm_result_limit();
if (isset($_POST['type']) && $_POST['type'] == '_search') {
    $post = $_POST;
    $search_satus = true;
    $employers = hrm_Employeelist::getInstance()->employeer_search_query($post, $limit, $pagenum);
} else {
    $employers = hrm_Employeelist::getInstance()->get_employee($limit, $pagenum);
    $search_satus = false;
}
if (!$employers) {
    return;
}
$total = $employers->total_users;
$employers = $employers->results;
$add_permission = hrm_user_can_access($tab, null, 'add') ? true : false;
$delete_permission = hrm_user_can_access($tab, null, 'delete') ? true : false;
foreach ($employers as $key => $employer) {
    if ($delete_permission) {
        $del_checkbox = '<input name="hrm_check[' . $employer->ID . ']" value="' . $employer->ID . '" type="checkbox">';
    } else {
        $del_checkbox = '';
    }
コード例 #2
0
 function add_employer()
 {
     check_ajax_referer('hrm_nonce');
     $post = $_POST;
     $url = $_POST['url'];
     $user_id = hrm_Employeelist::getInstance()->add_new_employer($post);
     if (isset($user_id->errors)) {
         wp_send_json_error(array('error_msg' => __('User name or E-mail already exist', 'hrm'), 'redirect' => $url));
     } else {
         $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' => __('Update successfull', 'hrm')));
     }
 }