mudzlam

salah

Sep 16th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.77 KB | None | 0 0
  1.     function updateDriverP()
  2.     {
  3.         $config['upload_path'] = './assets/uploads/';
  4.         $config['allowed_types'] ='gif|jpg|png|swf';
  5.         $config['max_size'] = '5000000';
  6.         $config['max_width'] ='1600';
  7.         $config['max_height'] = '1200';
  8.        
  9.         $this->load->library('upload',$config);
  10.         if ( ! $this->upload->do_upload())
  11.         {
  12.             $error = array('error' => $this->upload->display_errors());
  13.             $this->cekLevel();
  14.             $this->load->view('vdriver/editDriver',$error);
  15.             $this->load->view('vapp_right_menu');      
  16.             $this->load->view('vapp_footer');
  17.         }
  18.  
  19.         else
  20.         {
  21.             $data =array('upload_data' => $this->upload->data());
  22.  
  23.  
  24.             $data['title'] = 'Update Driver';
  25.             $data['action'] = site_url('erp/driver/updateDriverP/');
  26.             $data['link_back'] = anchor('erp/driver/','Back to list Driver',array('class'=>'back'));
  27.            
  28.             $this->load->helper('form');
  29.             $this->load->helper('html');
  30.             $this->load->model('m_driver');
  31.  
  32.             $this->_set_fields_edit();
  33.            
  34.             $this->_set_rules_edit();
  35.            
  36.             $this->form_validation->set_rules('id_driver', 'ID Driver', 'trim|required');
  37.             $this->form_validation->set_rules('nama_driver', 'Name', 'trim|required');
  38.             $this->form_validation->set_rules('no_polisi', 'Kuota', 'trim|required');
  39.             $this->form_validation->set_rules('dob', 'Day of Birth', 'trim|required');
  40.             $this->form_validation->set_rules('jk', 'GEnder', 'trim|required');
  41.             $this->form_validation->set_rules('religion', 'Religion', 'trim|required');
  42.             $this->form_validation->set_rules('tgl_gabung', 'Join Date', 'trim|required');
  43.             $this->form_validation->set_rules('pekerjaan', 'Pekerjaan', 'trim|required');
  44.             $this->form_validation->set_rules('alamat', 'Alamat', 'trim|required');
  45.             $this->form_validation->set_rules('photo', 'Photo', 'trim|required');
  46.  
  47.             $this->form_validation->set_message('required', '* required');
  48.             $this->form_validation->set_message('isset', '* required');
  49.             $this->form_validation->set_error_delimiters('<p class="error">', '</p>');
  50.  
  51.  
  52.             if ($this->form_validation->run() == FALSE)
  53.             {
  54.                 $data['message'] = 'eror validasi';
  55.             }
  56.             else
  57.             {
  58.                
  59.                 // save data
  60.                 $id = $this->input->post('id_driver');
  61.                 $person = array(
  62.                     'nama_driver' => $this->input->post('nama_driver'),
  63.                     'no_polisi' => $this->input->post('no_polisi'),
  64.                     'dob' => $this->input->post('dob'),
  65.                     'jk' => $this->input->post('jk'),
  66.                     'religion' => $this->input->post('religion'),
  67.                     'tgl_gabung' => $this->input->post('tgl_gabung'),
  68.                     'pekerjaan' => $this->input->post('pekerjaan'),
  69.                     'alamat' => $this->input->post('alamat'),
  70.                     'photo' => $_FILES['userfile']['name']);
  71.                 $this->m_driver->updateDriver($id,$person);
  72.  
  73.                 $data['message'] = '<div class="success">update header success</div>';
  74.  
  75.             }
  76.         redirect('erp/driver/','refresh');
  77.         }
  78.     }
Advertisement
Add Comment
Please, Sign In to add comment