app = $app; $this->db = $db; $this->session = $session; $this->mode = (string) Param::Get('mode'); $this->id_grup = (int) Param::Get("Grup_MenuID", 0); $this->parent_code = (string) $session->get('WEB_APP')['PARENT_CODE']; } public function table_detail() { if (in_array($this->mode, ['add','edit','del'])) { $sql = new SQL($this->app); $sql->set_table("app_menu_grup"); $sql->add_param("Nama_Grup"); $sql->add_param("Ket"); $sql->add_param("Aktif"); $sql->add_param_stamp(); $sql->add_param_userid(); $sql->add_where("Grup_MenuID"); if ($this->mode === "add") { $sql->InsertDB(); } else if ($this->mode === "edit") { $sql->UpdateDB(); } else if ($this->mode === "del") { $sql->DeleteDB(); } } $tcari = Param::Get("Cari_Grup", ""); $twhere = ''; $apar = []; if (!empty($tcari)) { $twhere = 'Nama_Grup LIKE ?'; $apar[] = '%'.$tcari.'%'; } $obj = new Table($this->app); $obj->set_table('app_menu_grup', '*,IF(Grup_MenuID=1,0,1) IDel', $twhere, $apar); $obj->add_field("Grup_MenuID", "ID", "hid"); $obj->add_field("Nama_Grup", "Nama Grup"); $obj->add_field("Ket", "Keterangan"); $obj->add_field("DateStamp", "Update Terakhir", "c", 'sqljam'); $obj->add_field("Aktif", "Aktif", "c", "checkbox"); $obj->set_field_order("Nama_Grup", "A"); $obj->add_row_btn("menu-button", "Menu", "MenuGrupJS.menu_show"); $obj->add_row_btn("clipboard", "Ubah", "MenuGrupJS.detail_ubah"); $obj->add_row_btn("trash", "Hapus", "MenuGrupJS.detail_hapus", "IDel", 1); $obj->set_func_btn("MenuGrupJS.detail_tambah", "+ Grup"); $this->app->json([ $obj->json_table("divDetail") ]); } public function detail_grup() { $agrup = [ 'Nama_Grup' => '', 'Ket' => '', 'Aktif' => 1, 'Grup_MenuID' => 0 ]; if ($this->mode === 'edit') { $agrup = $this->db->fetchRow('SELECT * FROM app_menu_grup WHERE Grup_MenuID=?', [$this->id_grup]); } $form = new Form($this->app); $form->textbox("Nama Grup Menu", "Nama_Grup", $agrup['Nama_Grup'], true, false, "text", "nama grup menu"); $form->textarea("Keterangan Grup", "Ket", $agrup['Ket'], true, false, 1, "keterangan grup menu"); $form->switch("Status Aktif", "Aktif", $agrup['Aktif'], true, false, ["1","0"]); $form->hidden("Grup_MenuID", $agrup['Grup_MenuID']); $form->hidden("mode", $this->mode); $ajson['html'] = $form->show(3); $this->app->json($ajson); } public function detail_menu() { $agrup = $this->db->fetchRow('SELECT Grup_MenuID,Nama_Grup,CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_menu_grup WHERE Grup_MenuID=?', [$this->session->get('WEB_APP')['PARENT_CODE'], $this->id_grup]); $amenu = explode(",", $agrup['Menu']); $amodul = $this->db->fetchAll("SELECT * FROM app_menu WHERE Level=0 AND Modul<>'IND' AND Aktif=1 ORDER BY Urut ASC"); $hasil = '
| Nama Menu | Keterangan | |
|---|---|---|
| %s | %s |