first commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
class M_hakakses extends CI_Model {
|
||||
|
||||
function prosesedithakakses() {
|
||||
$this->db->where('mum_tipeuser_id', $this->input->post('id'));
|
||||
$this->db->delete('master_user_menu');
|
||||
|
||||
if(isset($_POST['akses'])){
|
||||
$postakses= $_POST['akses'];
|
||||
foreach($postakses as $key1 =>$valueakses)
|
||||
{
|
||||
$tambahaction=null;
|
||||
$editaction=null;
|
||||
$deleteaction=null;
|
||||
$dataakses= explode ("-",$valueakses);
|
||||
|
||||
if(isset($_POST['tambah'])){
|
||||
$posttambah= $_POST['tambah'];
|
||||
foreach($posttambah as $key2 =>$valuetambah)
|
||||
{
|
||||
if($dataakses[1]==$valuetambah){
|
||||
$tambahaction="tambah";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['edit'])){
|
||||
$postedit= $_POST['edit'];
|
||||
foreach($postedit as $key3 =>$valueedit)
|
||||
{
|
||||
if($dataakses[1]==$valueedit){
|
||||
$editaction="ubah";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['delete'])){
|
||||
$postdelete= $_POST['delete'];
|
||||
foreach($postdelete as $key4 =>$valuedelete)
|
||||
{
|
||||
if($dataakses[1]==$valuedelete){
|
||||
$deleteaction="hapus";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['view'])){
|
||||
$postview= $_POST['view'];
|
||||
foreach($postview as $key5 =>$valueview)
|
||||
{
|
||||
if($dataakses[1]==$valueview){
|
||||
$viewaction="lihat";
|
||||
}
|
||||
}
|
||||
}
|
||||
$insert_hakakses = array(
|
||||
'mum_tipeuser_id' => $this->input->post('id'),
|
||||
'mum_menu_id' => $dataakses[1],
|
||||
'mum_lihat' => $viewaction,
|
||||
'mum_tambah' => $tambahaction,
|
||||
'mum_ubah' => $editaction,
|
||||
'mum_hapus' => $deleteaction,
|
||||
);
|
||||
|
||||
$insert = $this->db->insert('master_user_menu', $insert_hakakses);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user