<?php



defined('BASEPATH') OR exit('No direct script access allowed');







class Page extends CI_Controller {







	/**



	 * Index Page for this controller.



	 *



	 * Maps to the following URL



	 * 		http://example.com/index.php/welcome



	 *	- or -



	 * 		http://example.com/index.php/welcome/index



	 *	- or -



	 * Since this controller is set as the default controller in



	 * config/routes.php, it's displayed at http://example.com/



	 *



	 * So any other public methods not prefixed with an underscore will



	 * map to /index.php/welcome/<method_name>



	 * @see https://codeigniter.com/user_guide/general/urls.html



	 */



	public function index()



	{	



		$this->load->model('M_pka');



		$row = $this->M_pka->cek_sesi_pka()->row_array();



		if ($this->session->userdata("sebagai") == "1" ) {



			$data['d'] = 'd-block';



			$data['s'] = 'd-none';



			if($this->M_pka->cek_sesi_pka()->num_rows()==0){



				$data['c'] = 'd-none';



				$data['pt'] = $row['periode_thn'];



			}else{



				



				$cek_sesi = $this->cari_sesi(date("Y-m-d"),$row["dari"],$row["sampai"]);



				if ($cek_sesi) {



				  	$data['c'] = 'd-block';



				  	$data['pt'] = $row['periode_thn'];



				}else{



				  	$data['c'] = 'd-none';



				}



			}



		  



		}else{



		  $data['d'] = 'd-none';



		  $data['s'] = 'd-block';



		  $cek_sesi = $this->cari_sesi(date("Y-m-d"),$row["dari"],$row["sampai"]);



		  if ($cek_sesi) {



		  	$data['c'] = 'd-block';



		  	$data['pt'] = $row['periode_thn'];



		  }else{



		  	$data['c'] = 'd-none';



		  }



		}



		$data["periode_dari"] = $row["dari"];



		$data["periode_sampai"] = $row["sampai"];



        //////////////////////sesi evaluasi//////////////



		$row1 = $this->M_pka->cek_sesi_ev_pka()->row_array();



		if($this->M_pka->cek_sesi_ev_pka()->num_rows()==0){



			$data['ev'] = 'd-none';



		}else{



			$cek_sesi1 = $this->cari_sesi(date("Y-m-d"),$row1["dari"],$row1["sampai"]);



			if ($cek_sesi1) {



			  	$data['ev'] = 'd-block';



			  	$data['pt_ev'] = $row1['periode_thn'];



			}else{



			  	$data['ev'] = 'd-none';



			}



		}



		



		///////////////////////////////////////////////////



		$this->load->view('page',$data);



	}



	private function cari_sesi ($date,$dari,$sampai){



        $begin = new DateTime($dari);



        $end   = new DateTime($sampai);



        $a = -1;



        $u =array();



        $b = $begin->modify('-1 day');



        for($i = $b; $i <= $end; $i->modify('+1 day')){



            $a++;



            $u[$a] = $i->format("Y-m-d");



        }



        // echo json_encode($u);



        // var_dump($u[0]);



        if(array_search($date, $u) == false){



            return FALSE; 



        }else{



            return TRUE;



        }



    }



	public function register()



	{



		$this->load->view('register');



	}



	public function login()



	{



		$this->load->view('login');



	}



	public function data_pka()



	{



		$this->load->view('contents/v_data_pka');



	}



	public function data_refisi_pka()



	{



		$this->load->view('contents/v_data_refisi_pka');



	}



	public function file_refisi()



	{



		$data["id_row"] = $this->input->post('id_row',TRUE);



		$this->load->view('contents/v_file_refisi',$data);







	}



	public function tambah_pka()



	{



		$this->load->model('M_pka');



		$row = $this->M_pka->cek_sesi_pka()->row_array();



		$data['pt'] = $row['periode_thn'];



		$this->load->view('contents/v_tambah_pka',$data);



	}



	public function file_pka()



	{



		$this->load->view('contents/v_file_pka');



	}



	public function file_read()



	{



		$data["id_row"] = $this->input->post('id_row',TRUE);



		$data["id_row2"] = $this->input->post('id_row2',TRUE);



		$this->load->model('M_pka');



		$row = $this->M_pka->cek_sesi_pka()->row_array();



		$data['pt'] = $row['periode_thn'];



		$this->load->view('contents/v_file_read',$data);







	}



	public function data_pka_admin()



	{



		$this->load->view('contents/v_data_pka_admin');



	}



	public function data_user_admin()



	{



		$this->load->view('contents/v_data_user_admin');



	}



	public function sesi_pka()



	{



		$this->load->view('contents/v_sesi_pka');



	}



	public function detail_pka_admin()



	{



		$data["id_row"] = $this->input->post('id_row',TRUE);



		$this->load->view('contents/v_detail_pka_admin',$data);



	}



	public function detail_pka()



	{



		$data["id_row"] = $this->input->post('id_row',TRUE);



		$this->load->view('contents/v_detail_pka',$data);



	}



	public function edit_pka_admin()



	{



		$data["id_row"] = $this->input->post('id_row',TRUE);



		$this->load->view('contents/v_edit_pka_admin',$data);



	}



	public function dashboard_user()



	{



		$this->load->view('contents/v_dashboard_user');



	}



	public function dashboard_admin()



	{



		$this->load->view('contents/v_dashboard_admin');



	}



	public function data_unit_misioner()



	{



		$this->load->view('contents/v_data_unit_misioner');



	}



	public function data_strategi()



	{



		$this->load->view('contents/v_data_strategi');



	}



	public function data_bidang()



	{



		$this->load->view('contents/v_data_bidang');



	}



	public function data_jenis_kegiatan()



	{



		$this->load->view('contents/v_data_jenis_kegiatan');



	}



	public function data_prioritas_kegiatan()



	{



		$this->load->view('contents/v_data_prioritas_kegiatan');



	}



    public function data_evaluasi_pka()



	{



		$this->load->model('M_pka');



		$row = $this->M_pka->cek_sesi_ev_pka()->row_array();



		$data['row'] = $row;



        // echo json_encode($row);



		$this->load->view('contents/v_data_evaluasi_pka',$data);



	}



    public function data_evaluasi_pka_admin()



	{



		$this->load->view('contents/v_data_evaluasi_pka_admin');



	}



	////////////////////////



	public function sesi_ev_pka()



	{



		$this->load->view('contents/v_sesi_ev_pka');



	}



    public function data_refisi_evaluasi_pka()



	{



		$this->load->model('M_pka');



		$row = $this->M_pka->cek_sesi_ev_pka()->row_array();



		$data['row'] = $row;



        // echo json_encode($row);



		$this->load->view('contents/v_data_rev_ev_pka',$data);



	}



    /////////user////////////



	public function detail_user()



	{



		$this->load->view('contents/v_detail_user');



	}



	///////////////////////////////////////////////////











	public function header_footer()



	{



		$this->load->view('template_email/v_header_footer');



	}



	public function template_mail_register()



	{



		$this->load->view('template_email/v_template_email_register');



	}



	public function template_mail_pka()



	{



		$this->load->view('template_email/v_template_email_pka');



	}



	public function template_mail_evaluasi_pka()



	{



		$this->load->view('template_email/v_template_email_evaluasi_pka');



	}







































	public function error_404()



	{



		$this->load->view('main/error_404');



	}



	public function beranda()



	{



		$this->load->view('contents/beranda');



	}



	public function buttons()



	{



		$this->load->view('contents/buttons');



	}



	public function card()



	{



		$this->load->view('contents/card');



	}



	public function color()



	{



		$this->load->view('contents/color');



	}



	public function border()



	{



		$this->load->view('contents/border');



	}



	public function animation()



	{



		$this->load->view('contents/animation');



	}



	public function other()



	{



		$this->load->view('contents/other');



	}



	public function charts()



	{



		$this->load->view('contents/charts');



	}



	public function tables()



	{



		$this->load->view('contents/tables');



	}



}



