function facebook_client() { static $facebook = null; if ($facebook === null) { $facebook = new Facebook(get_api_key(), get_api_secret()); if (!$facebook) { error_log('Could not create facebook client.'); } } return $facebook; }
function auth_token_check($token, $username, $password) { $user = get_user_by_username($username); if (!$user) { throw new InvalidParameterException('registration:usernamenotvalid'); } if (validate_user_token($token, 1) == $user->guid) { $return['auth_token'] = 'OK'; $return['api_key'] = get_api_key(); $return['gcm_sender_id'] = get_gcm_sender_id(); } else { $return = auth_gettoken($username, $password); } return $return; }
function index($bulan = 'bln', $tahun = "thn", $sort_by = "id", $sort_order = "asc", $offset = 0) { if (!$this->ion_auth->logged_in()) { //redirect them to the login page redirect('auth/login', 'refresh'); } else { $sess_id = $this->session->userdata('user_id'); $sess_nik = get_nik($sess_id); $s_bulan = substr($bulan, 3); if ($s_bulan) { $filter['bulan'] = "where/" . $s_bulan; } $this->data['s_bulan'] = $s_bulan; $filter = array(); $s_tahun = substr($tahun, 3); if ($s_tahun) { $filter['tahun'] = "where/" . $s_tahun; } $this->data['s_tahun'] = $s_tahun; $month = $bulan !== 'bln' ? '/MONTH/' . substr($bulan, 3) : 'bln'; $year = $tahun !== 'thn' ? '/YEAR/' . substr($tahun, 3) : 'thn'; if ($bulan === 'bln' && $tahun === 'thn') { $url = get_api_key() . 'attendance/user/EMPLID/' . $sess_nik . '/format/json'; //print_mz($url); } elseif ($tahun === 'thn') { $url = get_api_key() . 'attendance/user/EMPLID/' . $sess_nik . $month . '/format/json'; //print_mz($url); } elseif ($bulan === 'bln') { $url = get_api_key() . 'attendance/user/EMPLID/' . $sess_nik . $year . '/format/json'; //print_mz($url); } else { $url = get_api_key() . 'attendance/user/EMPLID/' . $sess_nik . $month . $year . '/format/json'; } $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $get_user_attendance = file_get_contents($url); $this->data['user_att'] = $user_attendance = json_decode($get_user_attendance, true); } else { $this->data['user_att'] = ''; } $this->_render_page('attendance_axapta/index', $this->data); } }
function update_object_and_related($objname) { //global $jsoninv_collection; global $jsondata_collection; $cachetime = 12 * 60 * 60; // 12h $objjs = load_json_from_mongo($objname, $jsondata_collection); $ts = $data['ts']; if ($ts + $cachetime > time()) { echo ","; return true; } $apikey = get_api_key(); $res = askhost("http://api.crunchbase.com/v/2/" . $objname . "?user_key={$apikey}", FALSE, "", "", "1", 60000, "", true); $js = json_decode($res['data']); if (isset($js->data->uuid)) { save_json_to_mongo($js, $objname, $jsondata_collection); } update_related($js); }
function get_user_atasan() { $id = $this->session->userdata('user_id'); $pos_group = get_pos_group(get_nik($id)); $url = get_api_key() . 'users/superior/EMPLID/' . get_nik($id) . '/format/json'; $url_atasan_satu_bu = get_api_key() . 'users/atasan_by_posgroup/EMPLID/' . get_nik($id) . '/format/json'; $headers = get_headers($url); $headers2 = get_headers($url_atasan_satu_bu); $response = substr($headers[0], 9, 3); $response2 = substr($headers2[0], 9, 3); //$url_atasan_satu_bu = get_api_key().'users/atasan_satu_bu/EMPLID/'.get_nik($id).'/format/json'; if ($pos_group == 'AMD' || $pos_group == 'DIR' || $pos_group == 'KACAB' || $pos_group == 'MGR' || $pos_group == 'ASM') { if ($response != "404") { $get_atasan = file_get_contents($url); $atasan = json_decode($get_atasan, true); $get_atasan2 = file_get_contents($url_atasan_satu_bu); $atasan2 = json_decode($get_atasan2, true); $atasan3 = array_merge($atasan, $atasan2); return $this->data['user_atasan'] = $atasan3; } elseif ($response == "404" && $response2 != "404") { $get_atasan = file_get_contents($url_atasan_satu_bu); $atasan = json_decode($get_atasan, true); return $this->data['user_atasan'] = $atasan; } else { return $this->data['user_atasan'] = '- Karyawan Tidak Memiliki Atasan -'; } } else { if ($response != "404") { $get_atasan = file_get_contents($url); $atasan = json_decode($get_atasan, true); return $this->data['user_atasan'] = $atasan; } elseif ($response == "404" && $response2 != "404") { $get_atasan = file_get_contents($url_atasan_satu_bu); $atasan = json_decode($get_atasan, true); return $this->data['user_atasan'] = $atasan; } else { return $this->data['user_atasan'] = '- Karyawan Tidak Memiliki Atasan -'; } } }
function get_sisa_cuti($user_id) { if ($user_id != null) { $url = get_api_key() . 'users/sisa_cuti/EMPLID/' . get_nik($user_id) . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getsisa_cuti = file_get_contents($url); $sisa_cuti = json_decode($getsisa_cuti, true); return $sisa_cuti; } else { return '-'; } } }
function detail($id, $first_login = FALSE) { if (!$this->ion_auth->logged_in()) { //redirect them to the login page redirect('auth/login', 'refresh'); } elseif ($id != $this->session->userdata('user_id') && !$this->ion_auth->is_admin()) { //redirect them to the home page because they must be an administrator to view this //return show_error('You must be an administrator to view this page.'); return show_error('You can not view this page.'); } else { $this->data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message'); $this->data['csrf'] = $this->_get_csrf_nonce(); $user = $this->person_model->getUsers($id)->row(); $user_emp = $this->person_model->getUserEmp($id)->row(); $user_course = $this->person_model->getUserCourse($id); $user_certificate = $this->person_model->getUserCertificate($id); $user_education = $this->person_model->getUserEducation($id); $user_exp = $this->person_model->getUserexperience($id); $user_sk = $this->person_model->getUserSk($id); $user_sti = $this->person_model->getUserSti($id); $user_jabatan = $this->person_model->getUserJabatan($id); $user_award = $this->person_model->getUserAward($id); $user_ikatan = $this->person_model->getUserIkatanDinas($id); $jsondata = file_get_contents(get_api_key() . 'users/lists/format/json'); $data = json_decode($jsondata, true); if ($this->cekNik($data, 'EMPLID', $user->nik) == TRUE) { $getdata = file_get_contents(get_api_key() . 'users/list/EMPLID/' . $user->nik . '/format/json'); $data = json_decode($getdata, true); $url = get_api_key() . 'users/employement/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getuser_info = file_get_contents($url); $user_info = json_decode($getuser_info, true); $this->data['user_info'] = $user_info; } else { //$this->data['user_info'] = $this->form_cuti_model->where('users.id',$user_id)->form_cuti_input()->result(); } //employee identity $this->data['id'] = $user->id; $this->data['nik'] = !empty($user->nik) ? $user->nik : '-'; $this->data['bod'] = !empty($user->bod) ? $user->bod : '-'; $this->data['is_birthday_reminder'] = $user->is_birthday_reminder; $this->data['first_login'] = $first_login; $this->data['first_name'] = !empty($user->first_name) ? $user->first_name : ''; $this->data['last_name'] = !empty($user->last_name) ? $user->last_name : ''; $this->data['business_unit'] = !empty($user->organization_title) ? $user->organization_title : ''; $this->data['marital'] = !empty($user->marital_title) ? $user->marital_title : ''; $this->data['phone'] = !empty($user->phone) ? $user->phone : ''; $this->data['email'] = !empty($user->email) ? $user->email : ''; $this->data['previous_email'] = !empty($user_info['PREVIOUSEMAIL']) ? $user_info['PREVIOUSEMAIL'] : '-'; $this->data['bb_pin'] = !empty($user_info['PINBB']) ? $user_info['PINBB'] : '-'; $this->data['photo'] = !empty($user->photo) ? $user->photo : ''; $this->data['s_kk'] = $this->form_validation->set_value('kk', $user->scan_kk); $this->data['s_akta'] = $this->form_validation->set_value('akta', $user->scan_akta); $user_folder = $user->id . $user->first_name; $this->data['u_folder'] = $user_folder; $url = get_api_key() . 'users/course/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getcourse = file_get_contents($url); $course = json_decode($getcourse, true); $this->data['course'] = $course; } else { $this->data['course'] = $user_course->result_array(); } $url = get_api_key() . 'users/certificate/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getcertificate = file_get_contents(get_api_key() . 'users/certificate/EMPLID/' . $user->nik . '/format/json'); $certificate = json_decode($getcertificate, true); $this->data['certificate'] = $certificate; } else { $this->data['certificate'] = $user_certificate->result_array(); } $url = get_api_key() . 'users/award/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getaward = file_get_contents(get_api_key() . 'users/award/EMPLID/' . $user->nik . '/format/json'); $award = json_decode($getaward, true); $this->data['award'] = $award; } else { $this->data['award'] = $user_award->result_array(); } //Education Tab API $url = get_api_key() . 'users/education/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $geteducation = file_get_contents(get_api_key() . 'users/education/EMPLID/' . $user->nik . '/format/json'); $education = json_decode($geteducation, true); $this->data['education'] = $education; } else { $this->data['education'] = $user_education->result_array(); } //Experience Tab API $url = get_api_key() . 'users/experience/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getexperience = file_get_contents(get_api_key() . 'users/experience/EMPLID/' . $user->nik . '/format/json'); $experience = json_decode($getexperience, true); $this->data['experience'] = $experience; } else { $this->data['experience'] = $user_exp->result_array(); } //SK Tab API $url = get_api_key() . 'users/sk/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getsk = file_get_contents(get_api_key() . 'users/sk/EMPLID/' . $user->nik . '/format/json'); $sk = json_decode($getsk, true); $this->data['sk'] = $sk; } else { $this->data['sk'] = $user_sk->result_array(); } //STI Tab API $url = get_api_key() . 'users/sti/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getsti = file_get_contents(get_api_key() . 'users/sti/EMPLID/' . $user->nik . '/format/json'); $sti = json_decode($getsti, true); $this->data['sti'] = $sti; } else { $this->data['sti'] = $user_sti->result_array(); } //Riwayat_jabatan Tab API $url = get_api_key() . 'users/jabatan/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getjabatan = file_get_contents(get_api_key() . 'users/jabatan/EMPLID/' . $user->nik . '/format/json'); $jabatan = json_decode($getjabatan, true); $this->data['jabatan'] = $jabatan; } else { $this->data['jabatan'] = $user_exp->result_array(); } //Ikatan_Dinas Tab API $url = get_api_key() . 'users/ikatan_dinas/EMPLID/' . $user->nik . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getikatan_dinas = file_get_contents(get_api_key() . 'users/ikatan_dinas/EMPLID/' . $user->nik . '/format/json'); $ikatan_dinas = json_decode($getikatan_dinas, true); $this->data['ikatan_dinas'] = $ikatan_dinas; } else { $this->data['ikatan_dinas'] = $user_exp->result_array(); } $this->data['aviva'] = !empty($user_emp->aviva) ? $user_emp->aviva : !empty($user_info['AVIVA']) ? $user_info['AVIVA'] : '-'; $this->data['bpjs_kerja'] = !empty($user_emp->aviva) ? $user_emp->aviva : !empty($user_info['JAMSOSTEK']) ? $user_info['JAMSOSTEK'] : '-'; $this->data['ktp'] = !empty($user_emp->aviva) ? $user_emp->aviva : !empty($user_info['KTP']) ? $user_info['KTP'] : '-'; $this->data['ktp_valid_date'] = !empty($user_emp->aviva) ? $user_emp->aviva : !empty($user_info['KTPVALIDDATE']) ? $user_info['KTPVALIDDATE'] : '-'; $this->data['npwp'] = !empty($user_emp->aviva) ? $user_emp->aviva : !empty($user_info['NPWP']) ? $user_info['NPWP'] : '-'; $this->data['tax'] = !empty($user_emp->aviva) ? $user_emp->aviva : !empty($user_info['TAX']) ? $user_info['TAX'] : '-'; $this->data['bpjs_kesehatan'] = !empty($user_info['BPJS']) ? $user_info['BPJS'] : '-'; $this->data['bpjs_date'] = !empty($user_info['BPJS']) ? $user_info['BPJSDATE'] : '-'; $this->data['bumida'] = !empty($user_info['BUMIDA']) ? $user_info['BUMIDA'] : '-'; $this->data['bumida_date'] = !empty($user_info['BPJS']) ? $user_info['BUMIDADATE'] : '-'; $this->data['seniority_date'] = !empty($user_emp->seniority_date) ? $user_emp->seniority_date : !empty($user_info['SENIORITYDATE']) ? $user_info['SENIORITYDATE'] : '-'; $this->data['position'] = !empty($user_emp->position) ? $user_emp->position : !empty($user_info['POSITION']) ? $user_info['POSITION'] : '-'; $this->data['organization'] = !empty($user_info['ORGANIZATION']) ? $user_info['ORGANIZATION'] : '-'; $this->data['bu'] = !empty($user_info['BU']) ? $user_info['BU'] : '-'; $this->data['empl_status'] = !empty($user_emp->empl_status) ? $user_emp->empl_status : !empty($user_info['EMPLOYEESTATUS']) ? $user_info['EMPLOYEESTATUS'] : '-'; $this->data['employee_status'] = !empty($user_emp->employee_status) ? $user_emp->employee_status : !empty($user_info['STATUS']) ? $user_info['STATUS'] : '-'; $this->data['cost_center'] = !empty($user_emp->cost_center) ? $user_emp->cost_center : !empty($user_info['COSTCENTER']) ? $user_info['COSTCENTER'] : '-'; $this->data['position_group'] = !empty($user_emp->position_group) ? $user_emp->position_group : !empty($user_info['POSITIONGROUP']) ? $user_info['POSITIONGROUP'] : '-'; $this->data['grade'] = !empty($user_emp->grade) ? $user_emp->grade : !empty($user_info['GRADE']) ? $user_info['GRADE'] : '-'; $this->data['resign_reason'] = !empty($user_emp->resign_reason) ? $user_emp->resign_reason : !empty($user_info['RESIGNREASONCODEID']) ? $user_info['RESIGNREASONCODEID'] : '-'; $this->data['active_inactive'] = !empty($user_emp->active_inactive) ? $user_emp->active_inactive : !empty($user_info['ACTIVEINACTIVE']) ? $user_info['ACTIVEINACTIVE'] : '-'; } else { //employement $this->data['seniority_date'] = !empty($user_emp->seniority_date) ? $user_emp->seniority_date : '-'; $this->data['position'] = !empty($user_emp->position) ? $user_emp->position : '-'; $this->data['empl_status'] = !empty($user_emp->empl_status) ? $user_emp->empl_status : '-'; $this->data['employee_status'] = !empty($user_emp->employee_status) ? $user_emp->employee_status : '-'; $this->data['cost_center'] = !empty($user_emp->cost_center) ? $user_emp->cost_center : '-'; $this->data['position_group'] = !empty($user_emp->position_group) ? $user_emp->position_group : '-'; $this->data['grade'] = !empty($user_emp->grade) ? $user_emp->grade : '-'; $this->data['resign_reason'] = !empty($user_emp->resign_reason) ? $user_emp->resign_reason : '-'; $this->data['active_inactive'] = !empty($user_emp->active_inactive) ? $user_emp->active_inactive : '-'; } $this->data['s_photo'] = $this->form_validation->set_value('photo', $user->photo); $user_folder = $user->id . $user->first_name; $this->data['u_folder'] = $user_folder; //Company Sponsor Course Tab $this->data['user_course'] = $user_course; //Certificate Tab $this->data['user_certificate'] = $user_certificate; //Education Tab $this->data['user_education'] = $user_education; //Experience Tab $this->data['user_exp'] = $user_exp; //SuraKeputusan Tab $this->data['user_sk'] = $user_sk; $this->data['user_sti'] = $user_sti; $this->data['user_jabatan'] = $user_jabatan; $this->data['user_award'] = $user_award; $this->data['user_ikatan'] = $user_ikatan; //Mazhters $dt_temp = date("d"); //$dt_temp = date("d", mktime(1, 1, 1, date("m"), date("d")-1, date("Y"))); $this->baca_cron($dt_temp, date("m"), date("Y")); $mchID = GetValue("mchID", "users", array("id" => "where/" . $id)); $q = GetAll("view_att", array("mchID" => "where/" . $mchID)); $this->data['rekap_hadir'] = array("total" => 0, "hadir" => 0, "terlambat" => 0, "cuti" => 0, "ijin" => 0, "sakit" => 0, "alpa" => 0, "off" => 0); foreach ($q->result_array() as $r) { if ($r['jh'] || $r['terlambat']) { $this->data['rekap_hadir']['hadir']++; } if ($r['terlambat']) { $this->data['rekap_hadir']['terlambat']++; } if ($r['ijin']) { $this->data['rekap_hadir']['ijin']++; } if ($r['sakit']) { $this->data['rekap_hadir']['sakit']++; } if ($r['cuti']) { $this->data['rekap_hadir']['cuti']++; } if ($r['alpa']) { $this->data['rekap_hadir']['alpa']++; } if ($r['off']) { $this->data['rekap_hadir']['off']++; } $this->data['rekap_hadir']['total']++; } if ($this->data['rekap_hadir']['hadir'] != 0) { $this->data['persen_hadir'] = number_format($this->data['rekap_hadir']['hadir'] / $this->data['rekap_hadir']['total'] * 100, 1) != 0 ? number_format($this->data['rekap_hadir']['hadir'] / $this->data['rekap_hadir']['total'] * 100, 1) : $this->data['rekap_hadir']['hadir']; $this->data['persen_terlambat'] = number_format($this->data['rekap_hadir']['terlambat'] / $this->data['rekap_hadir']['total'] * 100, 1); } else { $this->data['persen_hadir'] = 0; $this->data['persen_terlambat'] = 0; } //End Mazhters if (date("m-d") !== date('m-d', strtotime($user->bod)) && $user->is_birthday_reminder == 1) { $this->db->query("update users set is_birthday_reminder = 0 where id = {$id}"); } $this->_render_page('person/detail', $this->data); } }
function is_config_setup() { return get_api_key() && get_api_secret() && get_api_key() != 'YOUR_API_KEY' && get_api_secret() != 'YOUR_API_SECRET' && get_callback_url() != null; }
function get_user_position($user_id) { $url = get_api_key() . 'users/employement/EMPLID/' . get_nik($user_id) . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getuser_info = file_get_contents($url); $user_info = json_decode($getuser_info, true); return $user_info['POSITION']; } else { return '-'; } }
function get_user_atasan() { $id = $this->session->userdata('user_id'); $url = get_api_key() . 'users/superior/EMPLID/' . get_nik($id) . '/format/json'; $url_atasan_satu_bu = get_api_key() . 'users/atasan_satu_bu/EMPLID/' . get_nik($id) . '/format/json'; $headers = get_headers($url); $headers2 = get_headers($url_atasan_satu_bu); $response = substr($headers[0], 9, 3); $response2 = substr($headers2[0], 9, 3); if ($response != "404") { $get_atasan = file_get_contents($url); $atasan = json_decode($get_atasan, true); return $this->data['user_atasan'] = $atasan; } elseif ($response == "404" && $response2 != "404") { $get_atasan = file_get_contents($url_atasan_satu_bu); $atasan = json_decode($get_atasan, true); return $this->data['user_atasan'] = $atasan; } else { return $this->data['user_atasan'] = '- Karyawan Tidak Memiliki Atasan -'; } }
function leadboxes_options_page() { $v = get_url_ver(); $admin_url = LEADPAGES_ABS_URL . 'admin/'; global $api_url; $lb_api_url = str_replace('/api/', '/_ah/api', $api_url); wp_register_script('lb_options', $admin_url . 'js/leadbox-settings.js' . $v, array('leadpages_jquery')); wp_enqueue_script('lb_options'); wp_register_script('leadpages_jquery', $admin_url . 'js/jquery_leadpages.js' . $v); wp_register_script('leadpages_bootstrap', $admin_url . 'js/twitter_bootstrap_leadpages.js' . $v, array('leadpages_jquery')); wp_register_style('leadpages_bootstrap', $admin_url . 'css/twitter_bootstrap_leadpages.css' . $v); wp_register_style('leadpages_admin', $admin_url . 'css/admin_leadpages.css' . $v); wp_enqueue_script('leadpages_jquery'); wp_enqueue_script('leadpages_bootstrap'); wp_enqueue_style('leadpages_bootstrap'); wp_enqueue_style('leadpages_admin'); ?> <!--suppress HtmlUnknownTarget --> <form action='options.php' method='post'> <h2>Configure LeadBoxes®</h2> <p>Here you can setup timed and exit LeadBoxes®. If you want to place a LeadBox™ via link, button, or image to any page, you need to copy and paste the HTML code you'll find in the LeadBox™ publish interface inside the LeadPages™ application.</p> <div id="leadbox-loading" style="width: 20%">Loading <div class="spinner"></div> </div> <div id="leadbox-options"> <?php $options = get_option('lp_settings'); $selected_timed = $options['lp_select_field_0']; $selected_exit = $options['lp_select_field_2']; settings_fields('pluginPage'); do_settings_sections('pluginPage'); submit_button(); ?> </div> </form> <script type="text/javascript"> var selected_timed = "<?php echo $selected_timed; ?> "; var selected_exit = "<?php echo $selected_exit; ?> "; var api_key = "<?php echo get_api_key(); ?> "; var API_URL = "<?php echo $lb_api_url; ?> "; jQuery('#leadbox-loading').find('.spinner').show(); jQuery('#leadbox-options').hide(); </script> <?php }
continue; echo "!"; } //bad data //update invround if ($need_update_jsons) { $objname = $doc['id']; $url = "http://api.crunchbase.com/v/2/funding-round/" . $objname . "?user_key={$apikey}"; //echo $doc['id'].": ".$js->data->uuid."\n"; $res = askhost($url, FALSE, "", "", "1", 60000, "", true); $js = json_decode($res['data']); if (isset($js->data->uuid)) { save_json_to_mongo($js, $objname, $jsoninv_collection); } else { echo "_"; $apikey = get_api_key(); $js = $js2; } } $ftype = $js->data->properties->funding_type; if (!isset($js->data->properties->money_raised_usd)) { echo "no usdsum, skip\n"; continue; } $usdsum = $js->data->properties->money_raised_usd; $fcurr = $js->data->properties->money_raised_currency_code; if (isset($fround->data->properties->series)) { $fser = $js->data->properties->series; } else { $fser = null; }
public function get_emp_bu() { $id = $this->input->post('id'); $url = get_api_key() . 'users/employement/EMPLID/' . get_nik($id) . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getuser_info = file_get_contents($url); $user_info = json_decode($getuser_info, true); $bu_nm = $user_info['BU']; } else { $bu_nm = ''; } echo $bu_nm; }
function update_sisa_absen($recid, $sisa_absen) { $method = 'post'; $params = array(); $uri = get_api_key() . 'users/sisa_cuti/RECID/' . $recid . '/ENTITLEMENT/' . $sisa_absen; $this->rest->format('application/json'); $result = $this->rest->{$method}($uri, $params); if (isset($result->status) && $result->status == 'success') { return TRUE; } else { return FALSE; } }
public function get_emp_sendate() { $id = $this->input->post('id'); $url = get_api_key() . 'users/employement/EMPLID/' . get_nik($id) . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getuser_info = file_get_contents($url); $user_info = json_decode($getuser_info, true); $sen_date = dateIndo($user_info['SENIORITYDATE']); } else { $sen_date = ''; } echo $sen_date; }
/** * The auth.gettoken API. * This API call lets a user log in, returning an authentication token which can be used * to authenticate a user for a period of time. It is passed in future calls as the parameter * auth_token. * * @param string $username Username * @param string $password Clear text password * * @return string Token string or exception * @throws SecurityException * @access private */ function auth_gettoken($username, $password) { // check if username is an email address if (is_email_address($username)) { $users = get_user_by_email($username); // check if we have a unique user if (is_array($users) && count($users) == 1) { $username = $users[0]->username; } } // validate username and password if (true === elgg_authenticate($username, $password)) { $return['auth_token'] = create_user_token($username); $return['api_key'] = get_api_key(); $return['gcm_sender_id'] = get_gcm_sender_id(); if ($return) { return $return; } // $token = create_user_token($username); // if ($token) { // return $token; // } } throw new SecurityException(elgg_echo('SecurityException:authenticationfailed')); }
function get_bu() { $url = get_api_key() . 'users/bu/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getbu = file_get_contents($url); $bu = json_decode($getbu, true); foreach ($bu as $row) { $result['0'] = '- Pilih BU -'; if ($row['NUM'] != null) { $result[$row['NUM']] = ucwords(strtolower($row['DESCRIPTION'])); } } return $this->data['bu'] = $result; } else { return $this->data['bu'] = ''; } }
function get_user_same_org() { $user_id = $this->session->userdata('user_id'); $url_org = get_api_key() . 'users/org/EMPLID/' . get_nik($user_id) . '/format/json'; $headers_org = get_headers($url_org); $response = substr($headers_org[0], 9, 3); if ($response != "404") { $get_user_pengganti = file_get_contents($url_org); $user_pengganti = json_decode($get_user_pengganti, true); return $this->data['user_same_org'] = $user_pengganti; } else { return $this->data['user_same_org'] = 'Tidak ada karyawan dengan departement yang sama'; } }
public function get_tr($id) { $url = get_api_key() . 'users/org/EMPLID/' . $id . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $get_task_receiver = file_get_contents($url); $data['subordinate'] = $task_receiver = json_decode($get_task_receiver, true); } else { $data['subordinate'] = ''; } $this->load->view('dropdown_tc', $data); }
function get_penerima_tugas_satu_bu() { $user_id = $this->session->userdata('user_id'); $url_org = get_api_key() . 'users/emp_satu_bu/EMPLID/' . get_nik($user_id) . '/format/json'; $headers_org = get_headers($url_org); $response = substr($headers_org[0], 9, 3); if ($response != "404") { $get_penerima_tugas = file_get_contents($url_org); $penerima_tugas = json_decode($get_penerima_tugas, true); return $this->data['penerima_tugas_satu_bu'] = $penerima_tugas; } else { return $this->data['penerima_tugas_satu_bu'] = 'Tidak ada karyawan dengan Bussiness Unit yang sama'; } }
function get_sisa_cuti() { $id = get_nik($this->input->post('id')); $url = get_api_key() . 'users/sisa_cuti/EMPLID/' . $id . '/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $getuser_info = file_get_contents($url); $user_info = json_decode($getuser_info, true); $sisa_cuti = $user_info[0]['ENTITLEMENT']; } else { $sisa_cuti = ''; } echo $sisa_cuti; }
function get_type_cuti() { $url = get_api_key() . 'users/type_cuti/format/json'; $headers = get_headers($url); $response = substr($headers[0], 9, 3); if ($response != "404") { $gettype_cuti = file_get_contents($url); $type_cuti = json_decode($gettype_cuti, true); return $type_cuti; } else { return ''; } }