Skip to content

Commit

Permalink
(#532) Gabung tabel user_grup
Browse files Browse the repository at this point in the history
  • Loading branch information
totoprayogo1916 authored Nov 8, 2023
1 parent 71a034b commit 815390f
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 36 deletions.
5 changes: 4 additions & 1 deletion donjo-app/Controllers/Man_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Controllers;

use App\Models\UserGrup;
use Kenjis\CI3Compatible\Core\CI_Controller;

class Man_user extends CI_Controller
Expand Down Expand Up @@ -60,6 +61,8 @@ public function index($p = 1, $o = 0)

public function form($p = 1, $o = 0, $id = '')
{
$userGrup = new UserGrup();

$data['p'] = $p;
$data['o'] = $o;

Expand All @@ -71,7 +74,7 @@ public function form($p = 1, $o = 0, $id = '')
$data['form_action'] = site_url('man_user/insert');
}

$data['grup'] = $this->user_model->list_grup();
$data['grup'] = $userGrup->findAll();
$header = $this->header_model->get_data();

echo view('header', $header);
Expand Down
11 changes: 8 additions & 3 deletions donjo-app/Controllers/Sms.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Controllers;

use App\Models\UserGrup;
use Kenjis\CI3Compatible\Core\CI_Controller;

class Sms extends CI_Controller
Expand Down Expand Up @@ -213,21 +214,22 @@ public function pending($p = 1, $o = 0)

public function form($p = 1, $o = 0, $tipe = 0, $id = 0)
{
$userGrup = new UserGrup();
$data['p'] = $p;
$data['o'] = $o;

if ($id) {
$data['sms'] = $this->sms_model->get_sms($tipe, $id);
$data['form_action'] = site_url("sms/insert/{$tipe}");
$data['tipe']['tipe'] = $tipe;
$data['grup'] = $this->sms_model->list_grup();
$data['grup'] = $userGrup->findAll();
$data['kontak'] = $this->sms_model->list_kontak();
echo view('sms/ajax_sms_form', $data);
} else {
$data['sms'] = null;
$data['form_action'] = site_url("sms/insert/{$tipe}");
$data['tipe']['tipe'] = $tipe;
$data['grup'] = $this->sms_model->list_grup();
$data['grup'] = $userGrup->findAll();
$data['kontak'] = $this->sms_model->list_kontak();
echo view('sms/ajax_sms_form_kirim', $data);
}
Expand All @@ -248,11 +250,14 @@ public function carikontak($tipe = 0)

public function formaftercari($tipe = 0)
{
$userGrup = new UserGrup();

$data['sms']['DestinationNumber'] = $_POST['kontak'];
$data['sms']['TextDecoded'] = $_POST['text'];
$data['form_action'] = site_url("sms/insert/{$tipe}");
$data['tipe']['tipe'] = $tipe;
$data['grup'] = $this->sms_model->list_grup();
$data['grup'] = $userGrup->findAll();

echo view('sms/ajax_sms_form', $data);
}

Expand Down
8 changes: 0 additions & 8 deletions donjo-app/Models/Mandiri_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,4 @@ public function update_setting($id = 0)
$_SESSION['success'] = -1;
}
}

public function list_grup()
{
$sql = 'SELECT * FROM user_grup';
$query = $this->db->query($sql);

return $query->result_array();
}
}
8 changes: 0 additions & 8 deletions donjo-app/Models/Sms_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,6 @@ public function update_setting($ID = 0)
}
}

public function list_grup()
{
$sql = 'SELECT * FROM user_grup';
$query = $this->db->query($sql);

return $query->result_array();
}

public function list_grup_kontak()
{
$sql = 'SELECT * FROM kontak_grup group by nama_grup';
Expand Down
8 changes: 0 additions & 8 deletions donjo-app/Models/Surat_keluar_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,4 @@ public function update_setting($id = 0)
$_SESSION['success'] = -1;
}
}

public function list_grup()
{
$sql = 'SELECT * FROM user_grup';
$query = $this->db->query($sql);

return $query->result_array();
}
}
18 changes: 18 additions & 0 deletions donjo-app/Models/UserGrup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\Models;

use CodeIgniter\Model;

class UserGrup extends Model
{
protected $table = 'user_grup';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
'nama',
];
}
8 changes: 0 additions & 8 deletions donjo-app/Models/User_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,4 @@ public function update_setting($id = 0)
$_SESSION['success'] = -1;
}
}

public function list_grup()
{
$sql = 'SELECT * FROM user_grup';
$query = $this->db->query($sql);

return $query->result_array();
}
}

0 comments on commit 815390f

Please sign in to comment.