コード例 #1
0
 public function user_simpan()
 {
     if (akses::aksesLogin() == TRUE or akses::aksesUser() == TRUE) {
         $nama = $this->input->post('nama');
         $user = $this->input->post('user');
         $pass1 = $this->input->post('pass1');
         $pass2 = $this->input->post('pass2');
         $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
         $this->form_validation->set_rules('nama', 'Nama', 'required');
         $this->form_validation->set_rules('user', 'Username', 'trim|required|min_length[4]');
         $this->form_validation->set_rules('pass1', 'Password', 'trim|required|min_length[5]|matches[pass2]');
         $this->form_validation->set_rules('pass2', 'Ulang Password', 'trim|required|min_length[5]');
         if ($this->form_validation->run() == FALSE) {
             $msg_error = array('nama' => form_error('nama'), 'user' => form_error('user'), 'pass1' => form_error('pass1'), 'pass2' => form_error('pass2'));
             $has_error = array('nama' => 'has-error', 'user' => 'has-error', 'pass1' => 'has-error', 'pass2' => 'has-error');
             $this->session->set_flashdata('form_error', $msg_error);
             $this->session->set_flashdata('has_error', $has_error);
             $this->session->set_flashdata('nama', $nama);
             $this->session->set_flashdata('user', $user);
             redirect('page=pengaturan&act=user_list');
         } else {
             $pass_secure = $this->encrypt->encode_url($pass1);
             //                if($pass1 != $pass2){
             //                    $this->session->set_flashdata('nama', $nama);
             //                    $this->session->set_flashdata('user', $user);
             //                    $this->session->set_flashdata('pengaturan','<div class="alert alert-danger">Password tidak sama !!</div>');
             //                }else{
             $cek = $this->db->query("SELECT * FROM tbl_user WHERE username='******'")->num_rows();
             if ($cek == 1) {
                 $this->session->set_flashdata('nama', $nama);
                 $this->session->set_flashdata('user', $user);
                 $this->session->set_flashdata('pengaturan', '<div class="alert alert-danger">Username tidak bisa digunakan / sudah ada !!</div>');
                 redirect('page=pengaturan&act=user_list');
             } else {
                 $data = array('nama' => $ym, 'nama' => $nama, 'username' => $user, 'password' => $pass_secure, 'status' => 'active', 'level' => 'user');
                 $s = crud::simpan('tbl_user', $data);
                 if ($s == TRUE) {
                     $this->session->set_flashdata('produk', '<div class="alert alert-success">Username : <b>' . $user . '</b>, berhasil ditambahkan !!</div>');
                     redirect('page=pengaturan&act=user_list');
                 } else {
                     $this->session->set_flashdata('pengaturan', '<div class="alert alert-danger">Username gagal disimpan !!</div>');
                     redirect('page=pengaturan&act=user_list');
                 }
             }
             //                }
         }
     } else {
         $this->session->set_flashdata('login', '<div class="alert alert-danger">Maaf, anda session habis. Silahkan login ulang.</div>');
         redirect(site_url());
     }
 }
コード例 #2
0
 public function trans_menu_tambahan()
 {
     $kas = $this->cart->contents();
     $no_nota = $this->input->get('id_pesanan');
     $no_meja = $this->input->get('id_meja');
     $total = $this->input->get('total');
     foreach ($kas as $cart) {
         $nota_det = array('id_meja' => $cart['options']['id_meja'], 'id_menu' => $cart['options']['id_menu'], 'tgl' => date('Y-m-d H:i:s'), 'no_nota' => $this->encrypt->decode_url($no_nota), 'menu' => '+ ' . $cart['name'], 'harga' => $cart['price'], 'jml' => $cart['qty'], 'subtotal' => $cart['subtotal']);
         crud::simpan('tbl_orderlist_det', $nota_det);
     }
     crud::update('tbl_orderlist', 'no_nota', $this->encrypt->decode_url($no_nota), array('tgl_update' => date('Y-m-d H:i:s'), 'total' => $total));
     $this->cart->destroy();
     redirect('pesan/detail.php?id=' . $no_meja);
 }
コード例 #3
0
 public function menu_simpan()
 {
     $kat = $this->input->post('kategori');
     $kode = $this->input->post('kode');
     $menu = $this->input->post('menu');
     $harga = $this->input->post('harga');
     $ket = $this->input->post('ket');
     $folder = realpath('../assets/gbr');
     $file = $_FILES['file']['name'];
     $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
     $this->form_validation->set_rules('kategori', 'Kategori', 'required');
     $this->form_validation->set_rules('kode', 'Kode Menu', 'required');
     $this->form_validation->set_rules('menu', 'Menu', 'required');
     $this->form_validation->set_rules('harga', 'Harga', 'required');
     $this->form_validation->set_rules('ket', 'Keterangan', 'required');
     if ($this->form_validation->run() == FALSE) {
         $msg_error = array('kategori' => form_error('penjahit'), 'kode' => form_error('kode'), 'menu' => form_error('menu'), 'harga' => form_error('harga'), 'file' => form_error('file'));
         $has_error = array('kategori' => 'has-error', 'kode' => 'has-error', 'menu' => 'has-error', 'harga' => 'has-error', 'file' => 'has-error');
         $this->session->set_flashdata('form_error', $msg_error);
         $this->session->set_flashdata('has_error', $has_error);
         redirect('page=menu&act=menu_tambah');
     } else {
         if (!empty($file)) {
             // Konfigurasi upload gambar
             $config['upload_path'] = $folder;
             $config['allowed_types'] = 'jpg|png';
             $config['max_size'] = '4096';
             $config['remove_spaces'] = TRUE;
             $config['file_name'] = 'menu_' . strtolower($menu);
             $this->load->library('upload', $config);
             if (!$this->upload->do_upload('file')) {
                 $this->session->set_flashdata('menu', '<div class="alert alert-danger">Error : <b>' . $this->upload->display_errors() . '</b></div>');
                 redirect('page=menu&act=menu_tambah');
             } else {
                 $f = $this->upload->data();
                 $data = array('id_kategori' => $kat, 'kode' => $kode, 'menu' => $menu, 'harga' => $harga, 'file' => $f['orig_name'], 'ket' => $ket);
             }
         } else {
             $data = array('id_kategori' => $kat, 'kode' => $kode, 'menu' => $menu, 'harga' => $harga, 'ket' => $ket);
         }
         crud::simpan('tbl_menu', $data);
         $this->session->set_flashdata('menu', '<div class="alert alert-success">Data menu sudah disimpan !!!</div>');
         redirect('page=menu&act=menu_tambah');
     }
 }
コード例 #4
0
 public function meja_simpan()
 {
     $meja = $this->input->post('meja');
     $folder = realpath('../assets/foto/meja/');
     $file = $_FILES['file']['name'];
     $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
     $this->form_validation->set_rules('meja', 'Meja', 'required');
     if ($this->form_validation->run() == FALSE) {
         $msg_error = array('meja' => form_error('meja'));
         $has_error = array('meja' => 'has-error');
         $this->session->set_flashdata('form_error', $msg_error);
         $this->session->set_flashdata('has_error', $has_error);
         redirect('page=meja&act=meja_tambah');
     } else {
         if (!empty($file)) {
             // Konfigurasi upload gambar
             $config['upload_path'] = $folder;
             $config['allowed_types'] = 'jpg|png';
             $config['max_size'] = '4096';
             $config['remove_spaces'] = TRUE;
             $config['file_name'] = 'meja_' . strtolower($meja);
             $this->load->library('upload', $config);
             if (!$this->upload->do_upload('file')) {
                 $this->session->set_flashdata('meja', 'Error : <b>' . $this->upload->display_errors() . '</b>.');
                 redirect('page=meja&act=meja_tambah');
             } else {
                 $f = $this->upload->data();
                 $data = array('no_meja' => $meja, 'foto' => $f['orig_name'], 'status' => '0');
             }
         } else {
             $data = array('no_meja' => $meja, 'status' => '0');
         }
         crud::simpan('tbl_meja', $data);
         $this->session->set_flashdata('meja', '<div class="alert alert-succeded">Data meja sudah disimpan !!!</div>');
         redirect('page=meja&act=meja_tambah');
     }
 }