<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cetak_register_mediasi extends CI_Controller {

	function index(){
		if($this->session->userdata('is_logged_in')==FALSE){
			redirect('login');
		}
		$this->load->model('mediasi/register_mediasi_m','mediasi');
		$data['tahun'] = $this->mediasi->get_tahun();

		$this->load->vars($data);
		$this->load->view('register_mediasi/popup_cetak_register_mediasi');	
	}

	function cetak_register(){
		$bulan = $this->input->post('bulan',TRUE);
		$tahun = $this->input->post('tahun',TRUE);
		$xls   = $this->input->post('xls',TRUE);
		$jenis_register = $this->input->post('jenis_register',TRUE);
		if(!empty($bulan) and !empty($tahun) and !empty($jenis_register)){
			$this->nativesession->set_flash_session('bulan',$bulan);
			$this->nativesession->set_flash_session('tahun',$tahun);
			$this->nativesession->set_flash_session('view',$jenis_register);
			$this->nativesession->set_flash_session('xls',$xls);
			echo json_encode(array('st'=>1,'msg'=>'Silahkan Membuka Laporan Pada Tab'));
		}else{
			echo json_encode(array('st'=>0,'msg'=>'Parameter Kurang Lengkap'));
		}

	}

	function cetak_register_lap(){
		$bulan = $this->nativesession->get_flash_session('bulan');
		$tahun = $this->nativesession->get_flash_session('tahun');
		$register = $this->nativesession->get_flash_session('view');
		$xls = $this->nativesession->get_flash_session('xls');
		$this->load->model('mediasi/register_mediasi_m','mediasi');
		if($register==='mediasi_pengadilan'){
			$data['bulan'] = $bulan;
			$data['tahun'] = $tahun;
			$data['register']= $register;
			$data['xls']=$xls;
			$periode=$tahun."-".$bulan;
			$data['data_reg_mediasi'] = $this->mediasi->get_reg_mediasi($periode);
			$data['fileview']= "mediasi.php";			
			$this->load->vars($data);
			$this->load->view('register_mediasi/head_mediasi');
		}elseif($register==='mediasi_diluar_pengadilan'){
			$data['bulan'] = $bulan;
			$data['tahun'] = $tahun;
			$data['register']= $register;
			$data['xls']=$xls;
			$periode=$tahun."-".$bulan;
			$data['data_reg_mediasi'] = $this->mediasi->get_reg_mediasi_luar($periode);
			$data['fileview']= "mediasi_di_luar_pengadilan.php";						
			$this->load->vars($data);
			$this->load->view('register_mediasi/head_mediasi');
		}elseif($register==='mediator'){
			$data['bulan'] = $bulan;
			$data['tahun'] = $tahun;
			$data['register']= $register;
			$data['xls']=$xls;
			$periode=$tahun."-".$bulan;
			$data['data_reg_mediasi'] = $this->mediasi->get_reg_mediator($periode);
			$data['fileview']= "mediator.php";						
			$this->load->vars($data);
			$this->load->view('register_mediasi/head_mediasi');
		}else{
			show_404();
		}
	}

}

?>
