Advertisement
Guest User

Data_Guru.php

a guest
Jan 28th, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.90 KB | None | 0 0
  1. <?php
  2.  
  3. class Data_Guru extends CI_Controller{
  4.  
  5.  
  6.     public function index()
  7.     {
  8.         $data['guru']=$this->m_guru->tampil_data()->result();
  9.  
  10.         $this->load->view('admin/page');
  11.         $this->load->view('admin/header');
  12.         $this->load->view('admin/sidebar');
  13.         $this->load->view('admin/data_guru',$data);
  14.         $this->load->view('admin/footer');
  15.     }
  16.  
  17.     public function tambah_aksi()
  18.     {
  19.         $nama_guru      = $this->input->post('nama_guru');
  20.         $alamat         = $this->input->post('alamat');
  21.         $jk             = $this->input->post('jk');
  22.         $status         = $this->input->post('status');
  23.         $no             = $this->input->post('no');
  24.  
  25.         $data = array(
  26.             'nama_guru'     => $nama_guru,
  27.             'alamat '       => $alamat,
  28.             'jk'            => $jk,
  29.             'status'        => $status,
  30.             'no_hp'         => $no,
  31.         );
  32.  
  33.         $this->m_guru->tambah_guru($data,'tb_guru');
  34.         redirect('admin/data_guru');
  35.     }
  36.  
  37.     public function edit($nip)
  38.     {
  39.         $where = array('nip' =>$nip);
  40.         $data['guru'] = $this->m_guru->edit_guru($where, 'tb_guru')->result();
  41.         $this->load->view('template/sidebar');
  42.         $this->load->view('template/header');
  43.         $this->load->view('template/edit_guru',$data);
  44.         $this->load->view('template/page');
  45.         $this->load->view('template/footer');
  46.     }
  47.  
  48.     public function update()
  49.     {
  50.         $nip            = $this->input->post('nip');
  51.         $nama_guru      = $this->input->post('nama_guru');
  52.         $alamat         = $this->input->post('alamat');
  53.         $jk             = $this->input->post('jk');
  54.         $status         = $this->input->post('status');
  55.         $no             = $this->input->post('no');
  56.  
  57.         $data = array(
  58.             'nama_guru'     => $nama_guru,
  59.             'alamat '       => $alamat,
  60.             'jk'            => $jk,
  61.             'status'        => $status,
  62.             'no_hp'         => $no,
  63.            
  64.         );
  65.  
  66.         $where = array(
  67.             'nip' => $nip
  68.         );
  69.  
  70.         $this->m_guru->update($where, $data, 'tb_guru');
  71.         redirect('admin/data_guru');
  72.     }
  73.  
  74.     public function hapus($nip)
  75.     {
  76.         $where = array('nip' => $nip);
  77.         $this->m_guru->hapus_data($where, 'tb_guru');
  78.         redirect('admin/data_guru');
  79.     }
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement