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

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

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

	function popup_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){
            show_404();
            exit();
        }
        $data['pihakasal']=$this->uri->segment('4');        
        if(!is_numeric($data['pihakasal']) OR !intval($data['pihakasal'])>0){
            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){
            show_404();
            exit();
        }

        $this->load->model('generate_template/m_template_akta_pk_mil','template');
        $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->template->getDataDocumentTemplate('120','40','510','1','');
        $this->load->view('generate_template/popup_akta_pk_mil', $data, FALSE);
    }

    function cetak_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_akta_pk_mil','template');
    	if($data['jenisTemplate']==1){
    		$data['dataTemplate'] = $this->template->cetak_permintaan_pk($idperkara,$idpembuatakta,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('120','40','510','1','');
    		$this->load->view('generate_template/cetak_akta_pk_terdakwa',$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('120','40','510','1','');
    		$this->load->view('generate_template/cetak_mil_akta_pk_oditur',$data,FALSE);
    	}else{
            show_404();
            exit();
        }
    }


    function cetak_pemberitahuan(){
        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){
            show_404();
            exit();
        }
        $data['pihakasal']=$this->uri->segment('4');        
        if(!is_numeric($data['pihakasal']) OR !intval($data['pihakasal'])>0){
            show_404();
            exit();
        }
        $data['encpihak']=$this->uri->segment('5');
        $idpemohon=$this->encrypt->decode(base64_decode($data['encpihak']));
        if(!is_numeric($idpemohon) OR !intval($idpemohon)>0){
            show_404();
            exit();
        }
        $this->load->model('generate_template/m_template_akta_pk_mil','template');
        $data['dataPutusan']=$this->template->getDataPutusan($idperkara);
        $data['info_penadatangan']=$this->template->getDataPejabat();
        $data['info']=$this->template->getInfo($idperkara);
        $data['template']=$this->template->getDataDocumentTemplate('120','40','510','1','');
        $this->load->view('generate_template/popup_pemberitahuan_pk_mil', $data, FALSE);
        /*
        
        */
    }

    function cetak_pemberitahuan_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();
        }
        $this->load->model('generate_template/m_template_akta_pk_mil','template');
        $data['dataTemplate'] = $this->template->cetak_pemberitahuan_pk($idperkara,68,$idput);
        $data['template']=$this->template->getDataDocumentTemplate('120','40','520','1','');
        $this->load->view('generate_template/cetak_pemberitahuan_pk',$data,FALSE);
    }


function cetak_pelimpahan_pk(){ 
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }
        $segment = $this->uri->segment_array();

        $idperkara=$this->encrypt->decode(base64_decode($segment[3]));
        //$data['idput'] = $this->input->post('putusan',TRUE);
        $idput=1;

        
        //$data['idpembuatakta'] = $this->input->post('pembuat',TRUE);
        //$idpembuatakta=$this->encrypt->decode(base64_decode($segment[4]));

        $this->load->model('generate_template/m_template_akta_pk_mil','pelimpahan');
        $data['dataperkara']=$this->pelimpahan->getDataPutusan($idperkara);
        //$data['dataterdakwa']=$this->pelimpahan-infoDataTerdakwa($idperkara);
        //$data['datapejabat']=$this->pelimpahan->getDataPejabat();
        $data['dataterdakwa']=$this->pelimpahan->infoDataTerdakwa2($idperkara);
        //print_r($data['dataterdakwa']);
        //exit();
        $data['dataTemplate'] = $this->pelimpahan->cetak_permintaan_pk($idperkara,68,$idput);
        $data['pelimpahan']=$this->pelimpahan->getDataDocumentTemplate('120','40','510','2','');
        $this->load->view('generate_template/cetak_pelimpahan_pk',$data,FALSE);
    }



}
