first commit - report data
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
class M_user extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$this->db->join('m_tipeuser', 'mt_id = mu_tipeuser_id', 'LEFT');
|
||||
$query = $this->db->get('m_user');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$setstatus = 0;
|
||||
if($this->input->post('status')==1){
|
||||
$setstatus = 1;
|
||||
}
|
||||
$loket = $this->input->post('loket');if(empty($loket)){$loket=null;}
|
||||
$klinik = $this->input->post('klinik');if(empty($klinik)){$klinik=null;}
|
||||
|
||||
$insert = array(
|
||||
'mu_namalengkap' => $this->input->post('nama'),
|
||||
'mu_namauser' => $this->input->post('user'),
|
||||
'mu_password' => md5($this->input->post('passworduser')),
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
'mu_status' => $setstatus,
|
||||
'mu_loket_id' => $loket,
|
||||
'mu_klinik_id' => $klinik,
|
||||
);
|
||||
$insert = $this->db->insert('m_user', $insert);
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$query = $this->db->get('m_user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$setstatus = 0;
|
||||
if($this->input->post('status')==1){
|
||||
$setstatus = 1;
|
||||
}
|
||||
$password = $this->input->post('passworduser');
|
||||
if(empty($password)){
|
||||
$update = array(
|
||||
'mu_namalengkap' => $this->input->post('nama'),
|
||||
'mu_namauser' => $this->input->post('user'),
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
'mu_status' => $this->input->post('status'),
|
||||
);
|
||||
}else{
|
||||
$update = array(
|
||||
'mu_namalengkap' => $this->input->post('nama'),
|
||||
'mu_namauser' => $this->input->post('user'),
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
'mu_password' => md5($this->input->post('passworduser')),
|
||||
'mu_status' => $this->input->post('status'),
|
||||
);
|
||||
}
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->update('m_user', $update);
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->delete('m_user');
|
||||
}
|
||||
|
||||
function disabled($id) {
|
||||
$update = array(
|
||||
'mu_status' => 0,
|
||||
);
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->update('m_user', $update);
|
||||
}
|
||||
|
||||
function active($id) {
|
||||
$update = array(
|
||||
'mu_status' => 1,
|
||||
);
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->update('m_user', $update);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user