69 lines
2.8 KiB
PHP
69 lines
2.8 KiB
PHP
<?php
|
|
class M_userlogin extends CI_Model {
|
|
function index() {
|
|
$this->db->join('master_tipeuser', 'master_tipeuser.mt_id = master_user.mu_tipeuser_id','left');
|
|
$this->db->join('master_klinik', 'master_klinik.mk_id = master_user.mu_klinik_id','left');
|
|
$this->db->join('master_loket', 'master_loket.ml_id = master_user.mu_loket_id','left');
|
|
$query = $this->db->get('master_user');
|
|
return $query->result();
|
|
}
|
|
|
|
function insert() {
|
|
$loketdat = $this->input->post('loket');if(empty($loketdat)){$loketdat=null;}
|
|
$klinik = $this->input->post('klinik');if(empty($klinik)){$klinik=null;}
|
|
$insert_userlogin = array(
|
|
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_password' => md5($this->input->post('passworduser')),
|
|
'mu_klinik_id' => $klinik,
|
|
'mu_loket_id' => $loketdat,
|
|
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
|
);
|
|
$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() {
|
|
$loketdat = $this->input->post('loket');if(empty($loketdat)){$loketdat=null;}
|
|
$klinik = $this->input->post('klinik');if(empty($klinik)){$klinik=null;}
|
|
$password = $this->input->post('passworduser');
|
|
if(empty($password)){
|
|
$update_userlogin = array(
|
|
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_klinik_id' => $klinik,
|
|
'mu_loket_id' => $loketdat,
|
|
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
|
);
|
|
}else{
|
|
$update_userlogin = array(
|
|
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
|
'mu_nama_user' => $this->input->post('namauser'),
|
|
'mu_password' => md5($this->input->post('passworduser')),
|
|
'mu_klinik_id' => $klinik,
|
|
'mu_loket_id' => $loketdat,
|
|
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
|
);
|
|
}
|
|
$id = $this->input->post('id');
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->update('master_user', $update_userlogin);
|
|
}
|
|
|
|
function view($id) {
|
|
$this->db->where('mu_id', $id);
|
|
$query = $this->db->get('master_user');
|
|
return $query;
|
|
}
|
|
|
|
function delete($id) {
|
|
$this->db->where('mu_id', $id);
|
|
$this->db->delete('master_user');
|
|
}
|
|
}
|
|
?>
|