86 lines
3.2 KiB
PHP
86 lines
3.2 KiB
PHP
<?php
|
|
class M_petugas extends CI_Model {
|
|
function index() {
|
|
$this->db->join('master_tipeuser', 'master_tipeuser.mt_id = master_user.mu_tipeuser_id','left');
|
|
$this->db->where('mu_tipeuser_id', '4');
|
|
$query = $this->db->get('master_user');
|
|
return $query->result();
|
|
}
|
|
|
|
function insert() {
|
|
$petugas = $this->input->post('petugas');
|
|
if($this->input->post('petugas')=="5"){
|
|
$petugas = null;
|
|
}
|
|
$insert_userlogin = array(
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_password' => md5($this->input->post('passworduser')),
|
|
'mu_tipeuser_id' => "4",
|
|
'mu_status' => $this->input->post('status'),
|
|
'mu_nama_lengkap' => $this->input->post('namalengkap'),
|
|
'mu_jenis_kelamin' => $this->input->post('jkuser'),
|
|
'mu_petugas_penunjang' => $petugas,
|
|
);
|
|
$insert = $this->db->insert('master_user', $insert_userlogin);
|
|
}
|
|
|
|
function edit($id) {
|
|
$this->db->where('mu_id', $id);
|
|
$query = $this->db->get('master_user');
|
|
return $query;
|
|
}
|
|
|
|
function prosesedit() {
|
|
$password = $this->input->post('passworduser');
|
|
$petugas = $this->input->post('petugas');
|
|
if($this->input->post('petugas')=="5"){
|
|
$petugas = null;
|
|
}
|
|
if(empty($password)){
|
|
$update_userlogin = array(
|
|
'mu_nama_lengkap' => $this->input->post('namalengkap'),
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_tipeuser_id' => "4",
|
|
'mu_status' => $this->input->post('status'),
|
|
'mu_jenis_kelamin' => $this->input->post('jkuser'),
|
|
'mu_petugas_penunjang' => $petugas,
|
|
);
|
|
}else{
|
|
$update_userlogin = array(
|
|
'mu_nama_lengkap' => $this->input->post('namalengkappasien'),
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_password' => md5($this->input->post('passworduser')),
|
|
'mu_tipeuser_id' => "4",
|
|
'mu_status' => $this->input->post('status'),
|
|
'mu_jenis_kelamin' => $this->input->post('jkuser'),
|
|
'mu_petugas_penunjang' => $petugas,
|
|
);
|
|
}
|
|
|
|
$id = $this->input->post('id');
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->update('master_user', $update_userlogin);
|
|
}
|
|
|
|
function delete($id) {
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->delete('master_user');
|
|
}
|
|
|
|
function disabled($id) {
|
|
$update_data = array(
|
|
'mu_status' => 0,
|
|
);
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->update('master_user', $update_data);
|
|
}
|
|
|
|
function aktif($id) {
|
|
$update_data = array(
|
|
'mu_status' => 1,
|
|
);
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->update('master_user', $update_data);
|
|
}
|
|
}
|
|
?>
|