当前位置: 首页>>代码示例>>PHP>>正文


PHP crud::simpan方法代码示例

本文整理汇总了PHP中crud::simpan方法的典型用法代码示例。如果您正苦于以下问题:PHP crud::simpan方法的具体用法?PHP crud::simpan怎么用?PHP crud::simpan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在crud的用法示例。


在下文中一共展示了crud::simpan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: user_simpan

 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='" . $user . "'")->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());
     }
 }
开发者ID:mikhaelfelian,项目名称:PROJECT-RESTO-TIGERA,代码行数:51,代码来源:pengaturan.php

示例2: trans_menu_tambahan

 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);
 }
开发者ID:mikhaelfelian,项目名称:PROJECT-RESTO-TIGERA,代码行数:14,代码来源:transaksi.php

示例3: menu_simpan

 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');
     }
 }
开发者ID:mikhaelfelian,项目名称:PROJECT-RESTO-TIGERA,代码行数:45,代码来源:menu.php

示例4: meja_simpan

 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');
     }
 }
开发者ID:mikhaelfelian,项目名称:PROJECT-RESTO-TIGERA,代码行数:37,代码来源:meja.php


注:本文中的crud::simpan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。