<?php
defined('BASEPATH') OR exit('No direct script access allowed');
error_reporting(0);
class Jadwal extends CI_Controller {
      function __construct(){
            parent::__construct();
			$this->load->library('session');
			$this->load->model('m_home');
			$this->load->model('m_pesan');
			$this->load->model('m_kategori');
			$this->load->model('m_fasilitas');
			$this->load->model('m_pesan');
			$this->load->model('m_icon');
      }
	public function index()
	{
	//template
	$bln = date('m');
	$thn = date('Y');
	$cekDataDuplicate = $this->m_home->cekDataDuplicate();
	$headeractive = $this->uri->segment(1);
	$cek = $this->m_home->getmenu($headeractive);
	$title = $cek->title;
	$description = $cek->description;
	$data['title'] = $title;
	$data['description'] =$description;
	$data['headeractive'] = $headeractive;
	$data['jadwal'] = $this->m_pesan->jadwalaktif($bln,$thn);	
	$data['jadwalfull'] = $this->m_pesan->jadwalfull();	
	$data['icon'] = $this->m_icon->tampilhome();	
	/*	
	//cek jatuh tempo 
	$cekdata = $this->m_pesan->pesan_lama();	
	foreach($cekdata->result() as $row){
	$jttempo = date('Y-m-d', strtotime('+3 days', strtotime( $row->tglpesan )));
	
	$jtsekarang = date('Y-m-d');
	//$tempo = $jttempo - $jthari;
	if($jtsekarang >= $jttempo){
		$idpesan = $row->idpesan;

		$data_save = array(
								'status' => '2'
						);			
		$where = array(
						'idpesan' => $idpesan,
						'disetujui' => 0
				);
		$this->m_pesan->update($where,$data_save,'pesan');						
	}
	}
	*/	
	$this->load->view('top', $data);	
	$this->load->view('header',$data);	
	$this->load->view('jadwal',$data);	
	$this->load->view('foot',$data);	
	//$this->load->view('footjs');	
	}
	function cek()
	{
	if(isset($_POST['pilihbulan'])){
	$pilihbulan = $this->security->xss_clean($this->input->post('pilihbulan'));	
	$data = explode("-" , $pilihbulan);
	$thn = $data[0];
	$bln = $data[1];
	$headeractive = $this->uri->segment(1);
	$cek = $this->m_home->getmenu($headeractive);
	$title = $cek->title;
	$description = $cek->description;
	$data['title'] = $title;
	$data['description'] =$description;
	$data['headeractive'] = $headeractive;
	$data['thn'] = $thn;
	$data['bln'] = $bln;
	$data['jadwal'] = $this->m_pesan->jadwalaktif($bln,$thn);	
	$data['jadwalfull'] = $this->m_pesan->jadwalfull();	
	$data['icon'] = $this->m_icon->tampilhome();		
	$this->load->view('top', $data);	
	$this->load->view('header',$data);	
	$this->load->view('jadwal',$data);	
	$this->load->view('foot',$data);	
	//$this->load->view('footjs');		 
	}
	}		
}
