Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function inputsiswa(){
- $hitung=$this->siswa->hitung()+1;
- $noreg=date('dmY').'-'.$hitung;
- $nama_lengkap=strtoupper($this->request->post('nama_lengkap'));
- $asal_sekolah=strtoupper($this->request->post('asal_sekolah'));
- $kelamin=$this->request->post('kelamin');
- $tmpt_lhr=strtoupper($this->request->post('tmpt_lhr'));
- $tgl_lhr=$this->request->post('tgl_lhr');
- $alamat=ucwords($this->request->post('alamat'));
- $email=$this->request->post('email');
- $telpon=$this->request->post('telpon');
- $jurusan=$this->request->post('jurusan');
- $tgl_masuk=$this->request->post('tgl_masuk');
- $keterangan=ucfirst($this->request->post('keterangan'));
- $user_id=$this->user->hitung()+1;
- $status=$this->request->post('status');
- $this->upload->setOption(
- array(
- 'folderLocation' => 'public/img_siswa',
- 'autoCreateFolder' => true,
- 'permittedFileType' => 'gif|png|jpg|jpeg',
- 'maximumSize' => 5000000,
- 'setFileName'=>$noreg,
- )
- );
- $this->upload->setErrorMessage(
- array(
- 10 => 'Folder tidak tersedia.',
- 3 => 'File yang anda upload terlalu besar.'
- )
- );
- $data['messages'] = '';
- if(isset($_FILES['foto'])){
- $file = $this->upload->now($_FILES['foto']);
- if($file){
- $foto = $this->upload->getFileInfo();
- $foto=$foto['name'];
- }else {
- $data['messages'] = $this->upload->getError('message');
- $foto='';
- }
- }
- $username=strtolower($this->request->post('username'));
- $password=md5($this->request->post('password'));
- $db_siswa=array(
- 'noreg'=>$noreg,
- 'nama_lengkap'=>$nama_lengkap,
- 'asal_sekolah'=>$asal_sekolah,
- 'kelamin'=>$kelamin,
- 'tmpt_lhr'=>$tmpt_lhr,
- 'tgl_lhr'=>$tgl_lhr,
- 'alamat'=>$alamat,
- 'email'=>$email,
- 'telpon'=>$telpon,
- 'jurusan'=>$jurusan,
- 'tgl_masuk'=>$tgl_masuk,
- 'keterangan'=>$keterangan,
- 'status'=>$status,
- 'foto'=>$foto,
- 'user_id'=>$user_id,
- );
- $db_user=array(
- 'username'=>$username,
- 'password'=>$password,
- 'level'=>'siswa',
- );
- $this->user->input($db_user);
- $this->siswa->input($db_siswa);
- $data['title'] = 'Input Siswa';
- $data['konten'] = 'konten/view_siswa';
- $data['message']='Anda berhasil input siswa';
- $data['data_siswa']=$this->siswa->viewall();
- $data['data_jurusan']=$this->jurusan->viewall();
- $this->output('home', $data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement