first commit - report data
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
class M_hakakses extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$query = $this->db->get('m_tipeuser');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function tipeuseraktif() {
|
||||
$this->db->where('mt_status', 1);
|
||||
$query = $this->db->get('m_tipeuser');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert_tipeuser() {
|
||||
$setstatus = 0;
|
||||
if($this->input->post('status')==1){
|
||||
$setstatus = 1;
|
||||
}
|
||||
$insert = array(
|
||||
'mt_nama' => $this->input->post('nama'),
|
||||
'mt_status' => $setstatus,
|
||||
);
|
||||
$insert = $this->db->insert('m_tipeuser', $insert);
|
||||
}
|
||||
|
||||
function edit_tipeuser($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$query = $this->db->get('m_tipeuser');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit_tipeuser() {
|
||||
$setstatus = 0;
|
||||
if($this->input->post('status')==1){
|
||||
$setstatus = 1;
|
||||
}
|
||||
$update = array(
|
||||
'mt_nama' => $this->input->post('nama'),
|
||||
'mt_status' => $setstatus,
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('mt_id', $id);
|
||||
$this->db->update('m_tipeuser', $update);
|
||||
}
|
||||
|
||||
function view_tipeuser($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$query = $this->db->get('m_tipeuser');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete_tipeuser($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$this->db->delete('m_tipeuser');
|
||||
|
||||
$this->db->where('mh_tipeuser_id', $id);
|
||||
$this->db->delete('m_hakakses');
|
||||
}
|
||||
|
||||
function disabled_tipeuser($id) {
|
||||
$update = array(
|
||||
'mt_status' => 0,
|
||||
);
|
||||
$this->db->where('mt_id', $id);
|
||||
$this->db->update('m_tipeuser', $update);
|
||||
}
|
||||
|
||||
function active_tipeuser($id) {
|
||||
$update = array(
|
||||
'mt_status' => 1,
|
||||
);
|
||||
$this->db->where('mt_id', $id);
|
||||
$this->db->update('m_tipeuser', $update);
|
||||
}
|
||||
|
||||
function parentmenu() {
|
||||
$this->db->order_by("mm_urutan", "asc");
|
||||
$this->db->where('mm_level', 1);
|
||||
$query = $this->db->get('m_menu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function childmenu() {
|
||||
$this->db->order_by("mm_urutan", "asc");
|
||||
$this->db->where('mm_level', 2);
|
||||
$query = $this->db->get('m_menu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function menuall(){
|
||||
$this->db->order_by("mm_urutan", "asc");
|
||||
$query = $this->db->get('m_menu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function edit_hakakses($id) {
|
||||
$this->db->where('mh_tipeuser_id', $id);
|
||||
$query = $this->db->get('m_hakakses');
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user