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

class c_template_tun_akta_permintaan_pk extends CI_Controller {
	public function index(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }       

		$this->load->view('dashboard', FALSE);
	}

	function popup_tun_akta_permintaan_pk(){
        if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        }       
        $data['enc']=$this->uri->segment('3');
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        /*if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            echo 'ini id perkara';
            show_404();
            exit();
        } */
        $data['pihakasal']=$this->uri->segment('4'); 
        /*if(!is_numeric($data['pihakasal']) OR !intval($data['pihakasal'])>0){
            echo 'ini pihak asal' ;  
            show_404();
            exit();
        }*/
        $data['$encpemohon']=$this->uri->segment('5');
        $idpemohon=$this->encrypt->decode(base64_decode($data['$encpemohon']));
        /*if(!is_numeric($idpemohon) OR !intval($idpemohon)>0){
            echo 'ini id pemohon';
            show_404();
            exit();
        }*/

        $this->load->model('generate_template/m_template_tun_akta_permintaan_peninjauan_kembali','template');
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');
        $data['dataPutusan']=$this->template->getDataPutusan($idperkara);
        $data['info_penadatangan']=$this->template->getDataPejabat();
        $data['info_DataTerdakwa']=$this->template->infoDataTerdakwa($idperkara);
        $data['info_dataDataJaksaPK']=$this->template->getDataJaksaPK($idperkara);
        $data['info_DataPH_PK']=$this->template->infoDataPH_PK($idperkara);
        $data['info']=$this->template->getInfo($idperkara);
        $data['template']=$this->template2->getDataDocumentTemplate('9','40','510','1','');
        $this->load->view('generate_template/popup_tun_akta_permintaan_peninjauan_kembali_lama', $data, FALSE);
    }

    function cetak_tun_akta_permintaan_pk(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }       
        $data['enc'] = $this->input->post('enc',TRUE);
        //$idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        //if(!is_numeric($idperkara) OR !intval($idperkara)>0){
          //  show_404();
            //exit();
        //}
    	$data['idpembuatakta'] = $this->input->post('pembuat',TRUE);
        $idpembuatakta=$this->encrypt->decode(base64_decode($data['idpembuatakta']));
        //if(!is_numeric($idpembuatakta) OR !intval($idpembuatakta)>0){
        //    show_404();
        //    exit();
        //}
    	$data['idput'] = $this->input->post('putusan',TRUE);
        $idput=$this->encrypt->decode(base64_decode($data['idput']));
        //if(!is_numeric($idput) OR !intval($idput)>0){
        //    show_404();
        //    exit();
        //}
    	$data['jenisTemplate'] = $this->input->post('jenisAkta',TRUE);       
    	$this->load->model('generate_template/m_template_tun_akta_permintaan_peninjauan_kembali','template');
    	$data['datapihakpenggugat'] = $this->template->getPihakPenggugat($idperkara);
        $data['datapihaktergugat'] = $this->template->getPihakTergugat($idperkara);
        
        //if($data['jenisTemplate']==1){
    		$data['dataTemplate'] = $this->template->cetak_permintaan_pk($idperkara,$idpembuatakta,$idput);
            //$data['datapihaktergugat'] = $this->template->getPihakTergugat($idperkara);
            

            //$data['paraPihak'] = 
            //echo "idperkara:".$idperkara;
            //echo "idpembuatakta:".$idpembuatakta;
            //echo "idput:".$idput;
            $data['template']=$this->template->getDataDocumentTemplate('9','40','510','1','');
    		$this->load->view('generate_template/cetak_tun_akta_permintaan_peninjauan_kembali',$data,FALSE);
    	/*}elseif ($data['jenisTemplate']==2) {
    		$data['dataTemplate'] = $this->template->cetak_permintaan_pk($idperkara,$idpembuatakta,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','40','510','634','');
    		$this->load->view('generate_template/cetak_akta_pidana_permintaan_peninjauan_kembali_ahli_waris',$data,FALSE);
    	}elseif ($data['jenisTemplate']==3) {            
    		$data['dataTemplate'] = $this->template->cetak_permintaan_pk($idperkara,$idpembuatakta,$idput);
            $data['info_DataPH_PK']=$this->template->infoDataPH_PK($idperkara);
            $data['template']=$this->template->getDataDocumentTemplate('111','40','510','635','');
    		$this->load->view('generate_template/cetak_akta_pidana_permintaan_peninjauan_kembali_penasihat_hukum',$data,FALSE);
    	}elseif ($data['jenisTemplate']==4) {
    		$data['dataTemplate'] = $this->template->cetak_permintaan_pk($idperkara,$idpembuatakta,$idput);
            $data['infoDataJaksaPK'] = $this->template->getDataJaksaPK($idperkara);
            $data['template']=$this->template->getDataDocumentTemplate('111','40','510','636','');
    		$this->load->view('generate_template/cetak_akta_pidana_permintaan_peninjauan_kembali_penuntut_umum',$data,FALSE);
    	*/
        //}else{
        //    show_404();
        //    exit();
        //}
    }

}
