Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <-----------------controller------------------>
- function cari(){
- $cat = $this->input->post('pilih');
- if ($cat == 1) {
- $tgl_awal = $this->input->post('tanggal');
- $tgl_akhir = $this->input->post('tanggal_2');
- $data['View_training'] = $this->VT->cari_plan_tgl($tgl_awal,$tgl_akhir);
- $data['isi']='Data_view';
- $this->load->view('template', $data);
- }
- elseif ($cat == 2){
- $page=$this->uri->segment(3);
- if(!$page):
- $offset = 0;
- else:
- $offset = $page;
- endif;
- $data['View_training']="";
- $judul = $this->input->post('materi');
- if(!empty($judul))
- {
- $data['View_training'] = $this->input->post('materi');
- $this->session->set_userdata('materi',$judul);
- }
- else
- {
- $data['View_training'] = $this->session->userdata('materi');
- }
- $data['View_training'] = $this->VT->cari_plan_judul($judul,5,$offset);
- $tot_hal = $this->VT->tot_hal($judul);
- $config['base_url'] = base_url() . 'index.php/cuser/cari/';
- $config['total_rows'] = $tot_hal->num_rows();
- $config['per_page'] =5;
- $config['uri_segment'] = 3;
- $this->pagination->initialize($config);
- $data['isi']='Data_view';
- $this->load->view('template', $data);
- }
- else {
- redirect ("cuser/view" , "refresh");
- }
- }
- <---------------------------------------------------->
- <-------------model------------------->
- function cari_plan_tgl($tgl_awal,$tgl_akhir){
- return $this->db->query("select * from view_plan where TGL_MULAI between '$tgl_awal' and '$tgl_akhir' ");
- }
- function cari_plan_judul ($judul,$batas,$offset) {
- $q = $this->db->query("select * from view_plan where NAMA_M_TRAINING like '%$judul%' LIMIT $offset,$batas");
- return $q;
- }
- function tot_hal($kata)
- {
- $q = $this->db->query("select * from view_plan where NAMA_M_TRAINING like '%$kata%'");
- return $q;
- }
- <--------------------------------------->
Advertisement
Add Comment
Please, Sign In to add comment