Пример #1
0
 protected function _getList($page = 1)
 {
     $this->_resetList();
     $param = array('page' => $page, 'limit' => $this->_limit(), 'order' => $this->_order(), 'filter' => $this->_getFilter());
     if ($this->post['act']) {
         URL::Redirect('jadwal');
     }
     $respon = $this->model->SelectGrid($param);
     return $respon;
 }
 protected function _getList($page = 1)
 {
     $this->_resetList();
     $param = array('page' => $page, 'limit' => $this->_limit(), 'order' => $this->_order(), 'filter' => $this->_getFilter());
     if ($this->post['act']) {
         if ($this->data['add_param']) {
             $add_param = '/' . $this->data['add_param'];
         }
         URL::Redirect(str_replace("/index{$add_param}/{$page}", "/index{$add_param}", URL::FullUri()));
     }
     $respon = $this->model->SelectGrid($param);
     return $respon;
 }
Пример #3
0
 function _actionIndex($halaman = '')
 {
     $this->_setHalaman($halaman);
     if ($this->post['act'] == 'reset') {
         URL::Redirect();
     }
     $this->data['row'] = $this->model->GetByHalaman($halaman);
     $id = $this->data['row'][$this->pk];
     if (!$this->data['row'] && $id) {
         $this->NoData();
     }
     $this->View($this->viewdetail);
 }
Пример #4
0
 function _actionIndex($page = 1)
 {
     if ($this->post['act'] == 'loginas') {
         $return = $this->auth->LoginAs($this->post['username']);
         if ($return['success']) {
             URL::Redirect('panelbackend');
         } else {
             $this->SetFlash('err_msg', "Login As Gagal !");
             URL::Redirect("{$this->page_ctrl}/index");
         }
     }
     parent::_actionIndex($page);
 }
Пример #5
0
 function isValid($record)
 {
     $rules = array(array('field' => 'nm_pasien', 'label' => 'Nama', 'rules' => 'required'), array('field' => 'alm_pasien', 'label' => 'Alamat', 'rules' => 'required'), array('field' => 'telp_pasien', 'label' => 'No. Telp.', 'rules' => 'required'), array('field' => 'komentar', 'label' => 'Kritik dan Saran', 'rules' => 'required'), array('field' => 'telp_pasien', 'label' => 'No. Telp.', 'rules' => 'phone'));
     $validation = new FormValidation($rules);
     $error_msg = '';
     if ($validation->run() == FALSE) {
         $error_msg .= $validation->GetError();
     }
     if ($error_msg) {
         $this->SetFlash('row_komentar', $record);
         $this->SetFlash('err_msg', $error_msg);
         URL::Redirect('#kritiksaran');
         exit;
     }
 }
Пример #6
0
 function _actionEdit($id = null)
 {
     if ($this->post['act'] == 'reset') {
         URL::Redirect();
     }
     $this->data['row'] = $this->model->GetByPk($id);
     $id_member = $this->data['row']['id_member'];
     if (!$this->data['row'] && $id) {
         $this->NoData();
     }
     ## EDIT HERE ##
     if ($this->post['act'] === 'save') {
         $id_member = $record['id_member'] = $this->post['id_member'];
         $record['tgl_pinjam'] = $this->post['tgl_pinjam'];
         $record['tgl_kembali'] = $this->post['tgl_kembali'];
         $record['jaminan'] = $this->post['jaminan'];
         $record['kode_jaminan'] = $this->post['kode_jaminan'];
         $this->setLogRecord($record, $id);
         if ($id) {
             $return = $this->model->Update($record, "{$this->pk} = {$id}");
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("{$this->page_ctrl}/edit/{$id}");
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal diubah";
             }
         } else {
             $return = $this->model->Insert($record);
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("{$this->page_ctrl}/edit/" . $return['data'][$this->pk]);
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal disimpan";
             }
         }
     }
     if ($id_member) {
         $modelmember = new MemberModel();
         $this->data['row']['member'] = array('id' => $id_member, 'label' => $modelmember->GOne("nama", "where id_member = '{$id_member}'"));
     }
     $this->View($this->viewdetail);
 }
Пример #7
0
 public function _actionIndex($page = 1)
 {
     if ($this->post['act'] == 'goaksi') {
         $user_id_str = "'" . implode("','", $this->post['user']) . "'";
         switch ($this->post['jenisaksi']) {
             case 'aktif':
                 $return = $this->model->Execute("update public_sys_user set is_active = '1' where user_id in ({$user_id_str})");
                 break;
             case 'unaktif':
                 $return = $this->model->Execute("update public_sys_user set is_active = '0' where user_id in ({$user_id_str})");
                 break;
         }
         if ($return) {
             $this->SetFlash('suc_msg', "Data berhasil disimpan");
         } else {
             $this->SetFlash('err_msg', "Data gagal disimpan");
         }
         URL::Redirect($this->page_ctrl);
     }
     parent::_actionIndex($page);
 }
Пример #8
0
 function _actionEdit($halaman = '', $id = null)
 {
     $this->_setHalaman($halaman);
     if ($this->post['act'] == 'reset') {
         URL::Redirect();
     }
     $this->data['row'] = $this->model->GetByHalaman($halaman);
     $id = $this->data['row'][$this->pk];
     if (!$this->data['row'] && $id) {
         $this->NoData();
     }
     ## EDIT HERE ##
     if ($this->post['act'] === 'save') {
         $record = array();
         $record['nama'] = $this->post['nama'];
         $record['isi'] = $this->post['isi'];
         $record['halaman'] = $halaman;
         $this->setLogRecord($record, $id);
         if ($id) {
             $return = $this->model->Update($record, "halaman = '{$halaman}'");
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("{$this->page_ctrl}/edit/{$halaman}");
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal diubah";
             }
         } else {
             $return = $this->model->Insert($record);
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("{$this->page_ctrl}/edit/{$halaman}");
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal disimpan";
             }
         }
     }
     $this->View($this->viewdetail);
 }
Пример #9
0
 function _actionEdit($id = null)
 {
     if ($this->post['act'] == 'reset') {
         URL::Redirect();
     }
     $this->data['row'] = $this->model->GetByPk($id);
     if (!$this->data['row'] && $id) {
         $this->NoData();
     }
     ## EDIT HERE ##
     if ($this->post['act'] === 'save') {
         $record = array();
         $record['nama'] = $this->post['nama'];
         $record['alamat'] = $this->post['alamat'];
         $record['no_identitas'] = $this->post['no_identitas'];
         $record['no_hp'] = $this->post['no_hp'];
         $record['email'] = $this->post['email'];
         $this->setLogRecord($record, $id);
         if ($id) {
             $return = $this->model->Update($record, "{$this->pk} = {$id}");
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("{$this->page_ctrl}/edit/{$id}");
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal diubah";
             }
         } else {
             $return = $this->model->Insert($record);
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("{$this->page_ctrl}/edit/" . $return['data'][$this->pk]);
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal disimpan";
             }
         }
     }
     $this->View($this->viewdetail);
 }
Пример #10
0
 function _actionProfile()
 {
     $this->data['page_title'] = 'Profile';
     $this->model = new SysUserModel();
     $id = $_SESSION[SESSION_APP]['user_id'];
     $this->data['edited'] = true;
     $this->data['row'] = $this->model->GetByPk($id);
     if (!$this->data['row'] && $id) {
         $this->NoData();
     }
     ## EDIT HERE ##
     if ($this->post['act'] === 'save') {
         $valid = $this->_isValidProfile();
         if (!$valid) {
             $this->View('panelbackend/profile');
             return;
         }
         $record = array();
         $record['username'] = $this->post['username'];
         $record['name'] = $this->post['name'];
         if (!empty($this->post['password'])) {
             $record['password'] = sha1(md5($this->post['password']));
         }
         $this->setLogRecord($record, $id);
         if ($id) {
             $return = $this->model->Update($record, "user_id = {$id}");
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("panelbackend/home/profile");
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal diubah";
             }
         }
     }
     $this->View('panelbackend/profile');
 }
Пример #11
0
 function _actionLogout()
 {
     $_SESSION[SESSION_APP]['login'] = false;
     unset($_SESSION[SESSION_APP]);
     URL::Redirect('panelbackend');
 }
Пример #12
0
 public function _actionDelete($id = null)
 {
     $retrun = $this->_addDelete($id);
     if ($retrun) {
         $return = $this->model->delete("{$this->pk} = {$id}");
     }
     if ($return) {
         $this->SetFlash('suc_msg', $return['success']);
         URL::Redirect("{$this->page_ctrl}");
     } else {
         $this->SetFlash('err_msg', "Data gagal didelete");
         URL::Redirect("{$this->page_ctrl}/detail/{$id}");
     }
 }
Пример #13
0
 function _actionDelete($halaman, $id = null)
 {
     $this->_setHalaman($halaman);
     $return = $this->model->delete("{$this->pk} = {$id}");
     if ($return) {
         $this->SetFlash('suc_msg', $return['success']);
         URL::Redirect("{$this->page_ctrl}/index/{$halaman}");
     } else {
         $this->SetFlash('err_msg', "Data gagal didelete");
         URL::Redirect("{$this->page_ctrl}/detail/{$halaman}/{$id}");
     }
 }
Пример #14
0
 function _actionDeleteFile($id_buku)
 {
     $return = $this->modelfile->delete("id_buku = {$id_buku}");
     if ($return) {
         $this->model->update(array('nama_file' => ''), "id_buku = {$id_buku}");
         $this->SetFlash('suc_msg', $return['success']);
     } else {
         $this->SetFlash('err_msg', "Data gagal didelete");
     }
     URL::Redirect("{$this->page_ctrl}/edit/{$id_buku}");
 }
Пример #15
0
 function _actionEdit($id = null)
 {
     if ($this->post['act'] == 'reset') {
         URL::Redirect();
     }
     $this->data['row'] = $this->model->GetByPk($id);
     if (!$this->data['row'] && $id) {
         $this->NoData();
     }
     ## EDIT HERE ##
     if ($this->post['act'] === 'save') {
         $record = array();
         $record['id_member'] = $this->post['id_member'];
         $record['nama'] = $this->post['nama'];
         $record['tgl_lahir'] = $this->post['tgl_lahir'];
         $record['anggota_sejak'] = $this->post['anggota_sejak'];
         $record['tgl_registrasi'] = $this->post['tgl_registrasi'];
         $record['berlaku_sampai'] = $this->post['berlaku_sampai'];
         $record['jenis_kelamin'] = $this->post['jenis_kelamin'];
         $record['alamat'] = $this->post['alamat'];
         $record['kode_pos'] = $this->post['kode_pos'];
         $record['alamat_surat'] = $this->post['alamat_surat'];
         $record['no_hp'] = $this->post['no_hp'];
         $record['no_identitas'] = $this->post['no_identitas'];
         $record['catatan'] = $this->post['catatan'];
         $record['email'] = $this->post['email'];
         $record['password'] = $this->post['password'];
         $this->IsValid($record);
         $this->setLogRecord($record, $id);
         if ($id) {
             $return = $this->model->Update($record, "{$this->pk} = {$id}");
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("{$this->page_ctrl}/edit/{$id}");
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal diubah";
             }
         } else {
             $return = $this->model->Insert($record);
             if ($return) {
                 $this->SetFlash('suc_msg', $return['success']);
                 URL::Redirect("{$this->page_ctrl}/edit/" . $return['data'][$this->pk]);
             } else {
                 $this->data['row'] = $record;
                 $this->data['err_msg'] = "Data gagal disimpan";
             }
         }
     }
     $this->View($this->viewdetail);
 }