function form_absen($id = null) { $sess_id = $this->session->userdata('user_id'); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } $this->db->select('absen.*, absen.id as id, absen.date_tidak_hadir as date, users.username as name,keterangan_absen.id as keterangan_id, keterangan_absen.title as keterangan_absen'); $this->db->from('users_keterangan_absen as absen'); $this->db->join('users', 'users.id = absen.user_id', 'LEFT'); $this->db->join('comp_session', 'absen.id_comp_session = comp_session.id', 'LEFT'); $this->db->join('keterangan_absen', 'absen.keterangan_id = keterangan_absen.id', 'LEFT'); if ($id != null) { $this->db->where('absen.id', $id); } $this->db->where("(absen.user_id= {$sess_id} {$sub_id} {$subsub_id} )", null, false); $this->db->where('absen.is_deleted', 0); $q = $this->db->get(); return $q; }
function form_training($id = null) { $sess_id = $this->session->userdata('user_id'); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } $this->db->select('training.*, training.id as id,users.nik as nik, users.username as name,penyelenggara.title as penyelenggara, pembiayaan.title as pembiayaan, status_lv1.title as approval_status_lv1, status_lv2.title as approval_status_lv2'); $this->db->from('users_training as training'); $this->db->join('users', 'users.id = training.user_id', 'LEFT'); $this->db->join('penyelenggara', 'training.penyelenggara_id = penyelenggara.id', 'LEFT'); $this->db->join('pembiayaan', 'training.pembiayaan_id = pembiayaan.id', 'LEFT'); $this->db->join('approval_status as status_lv1', 'training.approval_status_id_lv1 = status_lv1.id', 'left'); $this->db->join('approval_status as status_lv2', 'training.approval_status_id_lv2 = status_lv2.id', 'left'); if ($id != null) { $this->db->where('training.id', $id); } $this->db->where('training.is_deleted', 0); $this->db->where("(training.user_id= {$sess_id} {$sub_id})", null, false); $q = $this->db->get(); return $q; }
function form_exit($id = null) { $sess_id = $this->session->userdata('user_id'); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } $admin = $this->ion_auth->is_admin() || $this->ion_auth->is_admin_bagian(); //$this->db->select('users_exit.id as id, users_exit.user_id, exit_type.title as exit_type, users_exit.date_exit, users_exit.created_on as date_created, users_exit.is_app,users_exit.user_app, users_exit.date_app,users_exit.note_app, users_exit.is_app_mgr, users_exit.user_app_mgr, users_exit.date_app_mgr, users_exit.is_app_koperasi, users_exit.user_app_koperasi, users_exit.date_app_koperasi,users_exit.is_app_perpus, users_exit.user_app_perpus, users_exit.date_app_perpus,users_exit.is_app_hrd, users_exit.user_app_hrd, users_exit.date_app_hrd, users_exit_inventaris.*, users_exit_rekomendasi.*'); $this->db->select('users_exit.*, exit_type.title as exit_type'); $this->db->from('users_exit'); $this->db->join('users', 'users.id = users_exit.user_id', 'LEFT'); $this->db->join('exit_type', 'users_exit.exit_type_id = exit_type.id', 'LEFT'); $this->db->where('users_exit.is_deleted', 0); if ($admin != 1) { $this->db->where("(users_exit.user_id= {$sess_id} {$sub_id})", null, false); } if ($id != null) { $this->db->where('users_exit.id', $id); } $this->db->where('is_purposed', 1); //$this->db->where('users_exit.user_id', $sess_id); $this->db->order_by('users_exit.id', 'desc'); $q = $this->db->get(); return $q; }
/** * form_training_group * * @return object form_training_group * @author Deni **/ public function form_training_group($id = null) { $this->trigger_events('form_training_group'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { $sess_id = $this->session->userdata('user_id'); $sess_nik = get_nik($sess_id); $is_approver = $this->approval->approver('training'); $is_admin = is_admin(); $is_admin_legal = is_admin_legal(); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } //default selects $this->db->select(array($this->tables['users_training_group'] . '.*', $this->tables['users_training_group'] . '.id as id', $this->tables['penyelenggara'] . '.title as penyelenggara', $this->tables['pembiayaan'] . '.title as pembiayaan', $this->tables['training_type'] . '.title as training_type', 'training_ikatan_dinas.title as ikatan', 'training_waktu.title as waktu', 'status_lv1.title as approval_status_lv1', 'status_lv2.title as approval_status_lv2', 'status_lv3.title as approval_status_lv3', 'status_hrd.title as approval_status_hrd')); $this->db->join('users', 'users_training_group.user_pengaju_id = users.id', 'left'); $this->db->join('penyelenggara', 'users_training_group.penyelenggara_id = penyelenggara.id', 'LEFT'); $this->db->join('pembiayaan', 'users_training_group.pembiayaan_id = pembiayaan.id', 'LEFT'); $this->db->join('training_type', 'users_training_group.training_type_id = training_type.id', 'LEFT'); $this->db->join('training_ikatan_dinas', 'users_training_group.ikatan_dinas_id = training_ikatan_dinas.id', 'LEFT'); $this->db->join('training_waktu', 'users_training_group.waktu_id = training_waktu.id', 'LEFT'); $this->db->join('approval_status as status_lv1', 'users_training_group.approval_status_id_lv1 = status_lv1.id', 'left'); $this->db->join('approval_status as status_lv2', 'users_training_group.approval_status_id_lv2 = status_lv2.id', 'left'); $this->db->join('approval_status as status_lv3', 'users_training_group.approval_status_id_lv3 = status_lv3.id', 'left'); $this->db->join('approval_status as status_hrd', 'users_training_group.approval_status_id_hrd = status_hrd.id', 'left'); if ($id != null) { $this->db->where('users_training_group.id', $id); } if ($is_approver !== $sess_nik && $is_admin != 1 && $is_admin_legal != 1) { //$this->db->where("(users_training_group.user_id= $sess_id $sub_id $subsub_id )",null, false); $this->db->where("(users_training_group.user_pengaju_id = {$sess_id} OR users_training_group.user_peserta_id like '%{$sess_nik}%' OR users_training_group.user_app_lv1 = '{$sess_nik}' OR users_training_group.user_app_lv2 = '{$sess_nik}' OR users_training_group.user_app_lv3 = '{$sess_nik}' OR users_training_group.created_by = '{$sess_id}')", null, false); } $this->db->order_by('users_training_group.id', 'desc'); } $this->trigger_events('extra_where'); //run each where that was passed if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['users_training_group']); return $this; }
function get_subordinate($con, $designationId) { $temp = array(); $temp[0] = ""; $strarray = array(); array_push($strarray, $user_id); $sql_get_users = "SELECT\r\n\t\t\t\t\tdesignationId\r\n\t\t\t\tFROM\r\n\t\t\t\t\tdesignation_hierarchy\r\n\t\t\t\tWHERE\r\n\t\t\t\t\treportingDesignationId=" . $designationId; $rst_user_id = $con->execute($sql_get_users); if ($rst_user_id) { while (!$rst_user_id->EOF) { array_push($strarray, $rst_user_id->fields[0]); array_push($strarray, get_subordinate($con, $rst_user_id->fields[0])); $rst_user_id->movenext(); } $rst_user_id->close(); return implode(',', array_unique(explode(",", implode(",", array_diff($strarray, $temp))))); } else { array_push($strarray, ""); return implode(',', array_unique(explode(",", implode(",", array_diff($strarray, $temp))))); } }
//列表信息 $wheresql = ''; $page = max(1, getGP('page', 'G', 'int')); $pagesize = $_CONFIG->config_data('pagenum'); $offset = ($page - 1) * $pagesize; $url = 'admin.php?ac=' . $ac . '&fileurl=' . $fileurl . ''; if ($type = getGP('type', 'G')) { $wheresql .= " AND type ='" . $type . "'"; $url .= '&type=' . $type; } $vuidtype = getGP('vuidtype', 'G'); if (!is_superadmin() && $vuidtype == '') { $wheresql .= " AND appperson = {$_USER->id}"; } if ($vuidtype != '') { $wheresql .= " " . get_subordinate($_USER->id, 'appperson'); $url .= '&vuidtype=' . $vuidtype; } $num = $db->result("SELECT COUNT(*) AS num FROM " . DB_TABLEPRE . "book_read WHERE 1 {$wheresql} ORDER BY id desc"); $sql = "SELECT * FROM " . DB_TABLEPRE . "book_read WHERE 1 {$wheresql} ORDER BY id desc LIMIT {$offset}, {$pagesize}"; $result = $db->fetch_all($sql); include_once 'template/file_read.php'; } elseif ($do == 'update') { $idarr = getGP('id', 'P', 'array'); foreach ($idarr as $id) { $r = $db->fetch_one_array("SELECT * FROM " . DB_TABLEPRE . "book_read where id='" . $id . "' ORDER BY id desc limit 0,1"); $file = array('type' => '0'); update_db('file', $file, array('id' => $r[fileid])); $db->query("DELETE FROM " . DB_TABLEPRE . "book_read WHERE id = '{$id}' "); } show_msg('图书信息撤消成功!', 'admin.php?ac=indexsearch&fileurl=book');
$sms_receive = array('smskey' => 2); update_db('sms_receive', $sms_receive, array('id' => $idarr)); goto_page("admin.php?ac=" . str_replace('-', "&", getGP('urls', 'G'))); } elseif ($do == 'excel') { $datename = "sms_" . get_date('YmdHis', PHP_TIME); $outputFileName = 'data/excel/' . $datename . '.xls'; $content = array(); $archive = array("状态", "发送人", "发送时间", "内容"); $content[] = $archive; $wheresql = ''; $vuidtype = getGP('vuidtype', 'P'); if (!is_superadmin() && $vuidtype == '') { $wheresql .= " AND receiveperson ='" . $_USER->id . "'"; } if ($vuidtype != '') { $wheresql .= get_subordinate($_USER->id, 'receiveperson'); } $sql = "SELECT * FROM " . DB_TABLEPRE . "sms_receive WHERE 1 {$wheresql} ORDER BY id desc"; $result = $db->query($sql); while ($row = $db->fetch_array($result)) { if ($row[smskey] == '1') { $type = '己读'; } else { $type = '未读'; } $archive = array("" . $type . "", "" . get_realname($row['sendperson']) . "", "" . str_replace("-", ".", $row[date]) . "", "" . $row['content'] . ""); $content[] = $archive; } $excel = new ExcelWriter($outputFileName); if ($excel == false) { echo $excel->error;
/** * form_spd_luar * * @return object form_spd_luar * @author Deni **/ public function form_spd_luar($id = null) { $this->trigger_events('form_spd_luar'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { $sess_id = $this->session->userdata('user_id'); $sess_nik = get_nik($sess_id); $is_admin = is_admin(); $is_approver = $this->approval->approver('dinas'); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } //default selects $this->db->select(array($this->tables['users_spd_luar'] . '.*', $this->tables['users_spd_luar'] . '.id as id', $this->tables['users_spd_luar'] . '.id as form_spd_luar_id', $this->tables['transportation'] . '.title as transportation_nm', 'city_to.title as city_to', 'city_from.title as city_from')); $this->db->join('users', 'users.nik = users_spd_luar.task_receiver', 'LEFT'); $this->db->join('users as creator', 'creator.nik = users_spd_luar.task_creator', 'LEFT'); $this->db->join('transportation', 'users_spd_luar.transportation_id = transportation.id'); $this->db->join('city as city_to', 'users_spd_luar.to_city_id = city_to.id'); $this->db->join('city as city_from', 'users_spd_luar.from_city_id = city_from.id'); if ($id != null) { $this->db->where('users_spd_luar.id', $id); } if ($is_approver !== $sess_nik && $is_admin != 1) { $this->db->where("(users_spd_luar.task_receiver = '{$sess_nik}' OR users_spd_luar.task_creator = '{$sess_nik}' OR users_spd_luar.created_by = '{$sess_id}'\n OR users_spd_luar.user_app_lv1 = '{$sess_nik}' OR users_spd_luar.user_app_lv2 = '{$sess_nik}' OR users_spd_luar.user_app_lv3 = '{$sess_nik}' \n )", null, false); } $this->db->where('users_spd_luar.is_deleted', 0); $this->db->order_by('users_spd_luar.id', 'desc'); } $this->trigger_events('extra_where'); //run each where that was passed if (isset($this->_ion_where) && !empty($this->_ion_where)) { foreach ($this->_ion_where as $where) { $this->db->where($where); } $this->_ion_where = array(); } if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['users_spd_luar']); return $this; }
/** * form_exit * * @return object form_exit * @author Deni **/ public function form_exit($id = null) { $this->trigger_events('form_exit'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { $sess_id = $this->session->userdata('user_id'); $sess_nik = get_nik($sess_id); $is_admin = is_admin() || is_admin_inventaris(); $is_approver = $this->approval->approver('exit'); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } //default selects $this->db->select(array($this->tables['users_exit'] . '.*', $this->tables['users_exit'] . '.id as id', 'exit_type.title as exit_type', 'status_lv1.title as approval_status_lv1', 'status_lv2.title as approval_status_lv2', 'status_lv3.title as approval_status_lv3', 'status_hrd.title as approval_status_hrd', 'status_hrd.title as approval_status_it', 'status_hrd.title as approval_status_mgr', 'status_hrd.title as approval_status_koperasi', 'status_hrd.title as approval_status_perpus', 'status_asset.title as approval_status_asset')); $this->db->join('users', 'users.id = users_exit.user_id', 'LEFT'); $this->db->join('exit_type', 'users_exit.exit_type_id = exit_type.id', 'LEFT'); $this->db->join('approval_status as status_lv1', 'users_exit.app_status_id_lv1 = status_lv1.id', 'left'); $this->db->join('approval_status as status_lv2', 'users_exit.app_status_id_lv2 = status_lv2.id', 'left'); $this->db->join('approval_status as status_lv3', 'users_exit.app_status_id_lv3 = status_lv3.id', 'left'); $this->db->join('approval_status as status_hrd', 'users_exit.app_status_id_hrd = status_hrd.id', 'left'); $this->db->join('approval_status as status_it', 'users_exit.app_status_id_it = status_it.id', 'left'); $this->db->join('approval_status as status_mgr', 'users_exit.app_status_id_mgr = status_mgr.id', 'left'); $this->db->join('approval_status as status_perpus', 'users_exit.app_status_id_perpus = status_perpus.id', 'left'); $this->db->join('approval_status as status_koperasi', 'users_exit.app_status_id_koperasi = status_koperasi.id', 'left'); $this->db->join('approval_status as status_asset', 'users_exit.app_status_id_asset = status_asset.id', 'left'); if ($id != null) { $this->db->where('users_exit.id', $id); } if ($is_approver !== $sess_nik && $is_admin != 1) { //$this->db->where("(users_exit.user_id= $sess_id $sub_id $subsub_id )",null, false); $this->db->where("(users_exit.user_id = {$sess_id} OR users_exit.user_app_lv1 = '{$sess_nik}' OR users_exit.user_app_lv2 = '{$sess_nik}' OR users_exit.user_app_lv3 = '{$sess_nik}' OR users_exit.user_app_asset = '{$sess_nik}' OR users_exit.created_by = '{$sess_id}')", null, false); } $this->db->where('is_purposed', 1); $this->db->order_by('users_exit.id', 'desc'); } $this->trigger_events('extra_where'); //run each where that was passed if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['users_exit']); return $this; }
public function form_cuti_supervisor($id) { $this->trigger_events('form_cuti_supervisor'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { $sess_id = $this->session->userdata('user_id'); $is_admin = is_admin(); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } //default selects $this->db->select(array($this->tables['users_cuti'] . '.*', $this->tables['users_cuti'] . '.id as id', $this->tables['alasan_cuti'] . '.title as alasan_cuti', $this->tables['comp_session'] . '.year as session_year', $this->tables['users'] . '.username as name', 'status_lv1.title as approval_status_lv1', 'status_lv2.title as approval_status_lv2', 'status_lv3.title as approval_status_lv3', 'status_hrd.title as approval_status_hrd')); $this->db->join('alasan_cuti', 'users_cuti.alasan_cuti_id = alasan_cuti.HRSLEAVETYPEID', 'left'); $this->db->join('comp_session', 'users_cuti.id_comp_session = comp_session.id', 'left'); $this->db->join('users', 'users_cuti.user_id = users.id', 'left'); $this->db->join('approval_status as status_lv1', 'users_cuti.approval_status_id_lv1 = status_lv1.id', 'left'); $this->db->join('approval_status as status_lv2', 'users_cuti.approval_status_id_lv2 = status_lv2.id', 'left'); $this->db->join('approval_status as status_lv3', 'users_cuti.approval_status_id_lv3 = status_lv3.id', 'left'); $this->db->join('approval_status as status_hrd', 'users_cuti.approval_status_id_hrd = status_hrd.id', 'left'); $this->db->where('users_cuti.id', $id); if ($is_admin != 1) { //$this->db->where("(users_cuti.user_id= $sess_id $sub_id $subsub_id )",null, false); } $this->db->order_by('users_cuti.id', 'desc'); } $this->trigger_events('extra_where'); //run each where that was passed if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['users_cuti']); return $this; }
/** * recruitment * * @return object recruitment * @author Abdul Ghanni **/ public function recruitment($id = null) { $this->trigger_events('recruitment'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { $admin = is_admin(); $is_approver = $this->approval->approver('recruitment'); $sess_id = $this->session->userdata('user_id'); $sess_nik = get_nik($sess_id); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } //default selects $this->db->select(array($this->tables['recruitment'] . '.*', $this->tables['recruitment'] . '.id as id', $this->tables['recruitment'] . '.created_on as date_created', 'kualifikasi' . '.*', 'kemampuan' . '.*', 'status.title as status', 'urgensi.title as urgensi', 'jurusan.title as jurusan', 'ipk.title as ipk', 'toefl.title as toefl', 'brevet.title as brevet')); $this->db->join('users', 'users_recruitment.user_id = users.id', 'left'); $this->db->join('users_recruitment_kualifikasi as kualifikasi', 'users_recruitment.user_kualifikasi_id = kualifikasi.id', 'left'); $this->db->join('users_recruitment_kemampuan as kemampuan', 'users_recruitment.user_kemampuan_id = kemampuan.id', 'left'); $this->db->join('recruitment_status as status', 'users_recruitment.status_id = status.id', 'left'); $this->db->join('recruitment_urgensi as urgensi', 'users_recruitment.urgensi_id = urgensi.id', 'left'); $this->db->join('recruitment_jurusan as jurusan', 'kualifikasi.jurusan = jurusan.id', 'left'); $this->db->join('recruitment_brevet as brevet', 'kemampuan.brevet_id = brevet.id', 'left'); $this->db->join('ipk as ipk', 'kualifikasi.ipk = ipk.id', 'left'); $this->db->join('toefl as toefl', 'kualifikasi.toefl = toefl.id', 'left'); $this->db->where('users_recruitment.is_deleted', 0); //$this->db->where('users.active', 0); //$this->db->where('receiver_id', (!empty($nik)) ? $nik : $this->session->userdata('user_id')); $this->db->order_by('users_recruitment.id', 'desc'); if ($is_approver !== $sess_nik && $admin != 1) { //$this->db->where("(users_recruitment.user_id= $sess_id $sub_id $subsub_id )",null, false); $this->db->where("(users_recruitment.user_id = {$sess_id} OR users_recruitment.user_app_lv1 = '{$sess_nik}' OR users_recruitment.user_app_lv2 = '{$sess_nik}' OR users_recruitment.user_app_lv3 = '{$sess_nik}' OR users_recruitment.created_by = '{$sess_id}')", null, false); } if ($id != null) { $this->db->where('users_recruitment.id', $id); } } if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['recruitment']); return $this; }
if (!is_superadmin() && $vuidtype == '') { if (getGP('type', 'P') != '公开') { $wheresql .= " AND uid = {$_USER->id}"; } else { $wheresql .= " AND type ='公开' and uid != {$_USER->id}"; } } if ($vuidtype != '') { if (getGP('type', 'P') != '公开') { if ($vuidtype == '-1') { $wheresql .= get_subordinate($_USER->id, 'uid'); } else { $wheresql .= " and uid='" . $vuidtype . "'"; } } else { $wheresql .= " AND type ='公开'" . get_subordinate($_USER->id, 'uid'); } } $sql = "SELECT * FROM " . DB_TABLEPRE . "workdate WHERE 1 {$wheresql} ORDER BY id desc"; $result = $db->query($sql); while ($row = $db->fetch_array($result)) { $archive = array("" . $row[title] . "", "" . str_replace("-", ".", $row[startdate]) . "", "" . str_replace("-", ".", $row[enddate]) . "", "" . str_replace("-", ".", $row[completiondate]) . "", "" . $row['type'] . "", "" . get_realname($row['uid']) . "", "" . $row['content'] . ""); $content[] = $archive; } $excel = new ExcelWriter($outputFileName); if ($excel == false) { echo $excel->error; } foreach ($content as $v) { $excel->writeLine($v); }
} show_msg('手机短信删除成功!', 'admin.php?ac=smsindex&fileurl=sms&message=1'); } elseif ($do == 'excel') { $datename = "sms_" . get_date('YmdHis', PHP_TIME); $outputFileName = 'data/excel/' . $datename . '.xls'; $content = array(); $archive = array("状态", "接收手机", "接收人", "发送人", "发送时间", "内容"); $content[] = $archive; $wheresql = ''; $vuidtype = getGP('vuidtype', 'P'); //员工 if (!is_superadmin() && $vuidtype == '') { $wheresql .= " AND sendperson ='" . $_USER->id . "'"; } if ($vuidtype != '') { $wheresql .= get_subordinate($_USER->id, 'sendperson'); } $sql = "SELECT * FROM " . DB_TABLEPRE . "phone_send WHERE 1 {$wheresql} ORDER BY id desc"; $result = $db->query($sql); while ($row = $db->fetch_array($result)) { if ($row[type] == '1') { $type = '成功'; } else { $type = '失败'; } $archive = array("" . $type . "", "" . $row[receivephone] . "", "" . $row[receiveperson] . "", "" . get_realname($row['sendperson']) . "", "" . str_replace("-", ".", $row[date]) . "", "" . $row['content'] . ""); $content[] = $archive; } $excel = new ExcelWriter($outputFileName); if ($excel == false) { echo $excel->error;
public function form_absen_detail($id) { $this->trigger_events('form_absen_supervisor'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { $sess_id = $this->session->userdata('user_id'); $is_admin = is_admin(); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } //default selects $this->db->select(array($this->tables['users_absen'] . '.*', $this->tables['users_absen'] . '.id as id', $this->tables['keterangan_absen'] . '.title as keterangan_absen', $this->tables['comp_session'] . '.year as session_year', $this->tables['users'] . '.username as name')); $this->db->join('keterangan_absen', 'users_absen.keterangan_id = keterangan_absen.id', 'left'); $this->db->join('comp_session', 'users_absen.id_comp_session = comp_session.id', 'left'); $this->db->join('users', 'users_absen.user_id = users.id', 'left'); $this->db->where('users_absen.id', $id); if ($is_admin != 1) { //$this->db->where("(users_absen.user_id= $sess_id $sub_id $subsub_id )",null, false); } $this->db->order_by('users_absen.id', 'desc'); } $this->trigger_events('extra_where'); //run each where that was passed if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['users_absen']); return $this; }
/** * form_resignment * * @return object form_resignment * @author Deni **/ public function form_resignment($id = null) { $this->trigger_events('form_resignment'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { $sess_id = $this->session->userdata('user_id'); $sess_nik = get_nik($sess_id); $is_approver = $this->approval->approver('resignment'); $is_admin = is_admin(); $is_admin_payroll = is_admin_payroll(); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } //default selects $this->db->select(array($this->tables['users_resignment'] . '.*', $this->tables['users_resignment'] . '.id as id', 'status_lv1.title as approval_status_lv1', 'status_lv2.title as approval_status_lv2', 'status_lv3.title as approval_status_lv3', 'status_hrd.title as approval_status_hrd', 'users_resignment_wawancara.alasan_resign_id', 'users_resignment_wawancara.desc_resign', 'users_resignment_wawancara.procedure_resign', 'users_resignment_wawancara.kepuasan_resign', 'users_resignment_wawancara.saran_resign', 'users_resignment_wawancara.rework_resign')); $this->db->join('users', 'users.id = users_resignment.user_id', 'LEFT'); //$this->db->join('alasan_resign', 'users_resignment.alasan_resign_id = alasan_resign.id', 'LEFT'); $this->db->join('approval_status as status_lv1', 'users_resignment.app_status_id_lv1 = status_lv1.id', 'left'); $this->db->join('approval_status as status_lv2', 'users_resignment.app_status_id_lv2 = status_lv2.id', 'left'); $this->db->join('approval_status as status_lv3', 'users_resignment.app_status_id_lv3 = status_lv3.id', 'left'); $this->db->join('approval_status as status_hrd', 'users_resignment.app_status_id_hrd = status_hrd.id', 'left'); $this->db->join('users_resignment_wawancara', 'users_resignment.id = users_resignment_wawancara.user_resignment_id', 'left'); if ($id != null) { $this->db->where('users_resignment.id', $id); } if ($is_approver !== $sess_nik && $is_admin != 1 && $is_admin_payroll != 1) { //$this->db->where("(users_resignment.user_id= $sess_id $sub_id $subsub_id )",null, false); $this->db->where("(users_resignment.user_id = {$sess_id} OR users_resignment.user_app_lv1 = '{$sess_nik}' OR users_resignment.user_app_lv2 = '{$sess_nik}' OR users_resignment.user_app_lv3 = '{$sess_nik}' OR users_resignment.created_by = '{$sess_id}')", null, false); } $this->db->order_by('users_resignment.id', 'desc'); } $this->trigger_events('extra_where'); //run each where that was passed if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['users_resignment']); return $this; }
/** * form_medical * * @return object form_medical * @author Deni **/ public function form_medical($id = null) { $this->trigger_events('form_medical'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { $sess_id = $this->session->userdata('user_id'); $sess_nik = get_nik($sess_id); $is_approver = $this->approval->approver('medical'); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } $is_admin = is_admin(); //default selects $this->db->select(array($this->tables['users_medical'] . '.*', $this->tables['users_medical'] . '.id as id')); $this->db->join('users', 'users.id = users_medical.user_id', 'LEFT'); if ($id != null) { $this->db->where('users_medical.id', $id); } //$this->db->where('users_medical.is_deleted', 0); if ($is_approver !== $sess_nik && $is_admin != 1) { $this->db->where("(users_medical.user_id = {$sess_id} OR users_medical.user_app_lv1 = '{$sess_nik}' OR users_medical.user_app_lv2 = '{$sess_nik}' OR users_medical.user_app_lv3 = '{$sess_nik}' OR users_medical.created_by = '{$sess_id}')", null, false); } $this->db->order_by('users_medical.id', 'desc'); } $this->trigger_events('extra_where'); //run each where that was passed if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['users_medical']); return $this; }
} show_msg('短消息删除成功!', 'admin.php?ac=index&fileurl=sms&userkeytype=' . getGP('userkeytype', 'P') . ''); } elseif ($do == 'excel') { $datename = "sms_" . get_date('YmdHis', PHP_TIME); $outputFileName = 'data/excel/' . $datename . '.xls'; $content = array(); $archive = array("接收人", "发送人", "发送时间", "内容"); $content[] = $archive; $wheresql = ''; $vuidtype = getGP('vuidtype', 'P'); if (!is_superadmin() && $vuidtype == '') { $wheresql .= " AND uid ='" . $_USER->id . "'"; } if ($vuidtype != '') { if ($vuidtype == '-1') { $wheresql .= get_subordinate($_USER->id, 'uid'); } else { $wheresql .= " and uid='" . $vuidtype . "'"; } } $sql = "SELECT * FROM " . DB_TABLEPRE . "sms_send WHERE 1 {$wheresql} ORDER BY id desc"; $result = $db->query($sql); while ($row = $db->fetch_array($result)) { $archive = array("" . $row['receiveperson'] . "", "" . get_realname($row['uid']) . "", "" . str_replace("-", ".", $row[date]) . "", "" . $row['content'] . ""); $content[] = $archive; } $excel = new ExcelWriter($outputFileName); if ($excel == false) { echo $excel->error; } foreach ($content as $v) {
public function form_spd_dalam_report($id = null) { $sess_id = $this->session->userdata('user_id'); $sess_nik = get_nik($sess_id); $is_admin = is_admin(); if (!empty(is_have_subordinate(get_nik($sess_id)))) { $sub_id = get_subordinate($sess_id); } else { $sub_id = ''; } if (!empty(is_have_subsubordinate($sess_id))) { $subsub_id = 'OR ' . get_subsubordinate($sess_id); } else { $subsub_id = ''; } $this->trigger_events('form_spd_dalam_report'); if (isset($this->_ion_select) && !empty($this->_ion_select)) { foreach ($this->_ion_select as $select) { $this->db->select($select); } $this->_ion_select = array(); } else { //default selects $sess_nik = !empty(get_nik($this->session->userdata('user_id'))) ? get_nik($this->session->userdata('user_id')) : $this->session->userdata('user_id'); $this->db->select(array($this->tables['users_spd_dalam_report'] . '.*', $this->tables['users_spd_dalam_report'] . '.id as id', $this->tables['users_spd_dalam'] . '.id as spd_id')); $this->db->join('users_spd_dalam_report', 'users_spd_dalam.id = users_spd_dalam_report.user_spd_dalam_id', 'left'); if ($is_admin != 1) { $this->db->where("(users_spd_dalam.task_receiver = '{$sess_nik}' OR users_spd_dalam.task_creator = '{$sess_nik}' )", null, false); } $this->db->where('users_spd_dalam.is_deleted', 0); } $this->trigger_events('extra_where'); //run each where that was passed if (isset($this->_ion_where) && !empty($this->_ion_where)) { foreach ($this->_ion_where as $where) { $this->db->where($where); } $this->_ion_where = array(); } if (isset($this->_ion_like) && !empty($this->_ion_like)) { foreach ($this->_ion_like as $like) { $this->db->or_like($like); } $this->_ion_like = array(); } if (isset($this->_ion_limit) && isset($this->_ion_offset)) { $this->db->limit($this->_ion_limit, $this->_ion_offset); $this->_ion_limit = NULL; $this->_ion_offset = NULL; } else { if (isset($this->_ion_limit)) { $this->db->limit($this->_ion_limit); $this->_ion_limit = NULL; } } //set the order if (isset($this->_ion_order_by) && isset($this->_ion_order)) { $this->db->order_by($this->_ion_order_by, $this->_ion_order); $this->_ion_order = NULL; $this->_ion_order_by = NULL; } $this->response = $this->db->get($this->tables['users_spd_dalam']); return $this; }