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

class c_template_pk_pemeriksaan extends CI_Controller {

	function index(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }       
    	$this->load->view('dashboard', FALSE);
    }

	function penetapan_majelis_hakim_pemeriksaan_pk(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }       

        $data['enc']=$this->uri->segment('3');
        $data['jenisTemp']=$this->uri->segment('4');
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            show_404();
            exit();
        }   

        $this->load->model('generate_template/m_template_mil','template');
        $this->load->model('penetapan/add_majelis_m');
        $this->load->model('perkara/pk','pk');
        $data['infopk'] = $this->pk->fetchpk($idperkara);
    	$data['penandatangan']=$this->template->getDataPN();

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2'); 
        $template=$this->template2->getDataDocumentTemplate('1','12','20','1','');
        $i=0;
        $jumdata=count($template->result());
        foreach ($template->result() as $template){
            if ($jumdata=='1'){
                $judul['0']=$template->namatemplate;
                $jnsperkara=$template->jnsperkara;
            }else{
                if ($i=='0'){
                    $judul=$template->namatemplate;
                    $judul=explode("Voluntair",$judul);
                    $jnsperkara=$template->jnsperkara;
                }
            }
        }

    	$this->load->view('generate_template/popup_majelis_hakim_pemeriksaan_pk', $data, FALSE);
    }

    function cetak_majelis_hakim_pemeriksaan_pk(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }       

        $jpen = $this->uri->segment('3');
        $data['enc']=$this->input->post('enc',TRUE);
        $ditetapkanoleh = $this->input->post('ditetapkanoleh',TRUE);
        $idperkara=$this->encrypt->decode(base64_decode($data['enc']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            show_404();
            exit();
        }  
        $pembuat=$ditetapkanoleh;
        if(!is_numeric($pembuat) OR !intval($pembuat)>0){
            show_404();
            exit();
        }   
       

    	$this->load->model('generate_template/m_template_mil','template');
        $this->load->model('perkara/pk','pk');
        $data['infopk'] = $this->pk->fetchpk($idperkara);
    	$data['dataTemplate'] = $this->template->getDataPenetapanHakimMil($idperkara,$pembuat);
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');
        $data['dataPutBef'] = $this->template->pk_infotputusan_bef($idperkara);
        $data['pk_infoMajelisHakim'] = $this->template->pk_infoMajelisHakim($idperkara);
        #K_120_40_510_3
        $data['template']=$this->template2->getDataDocumentTemplate('120','40','510','3','');
        
    	$this->load->view('generate_template/cetak_majelis_hakim_pemeriksaan_pk',$data,FALSE);
}

function cetakTapsidPkMil(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }       

        $ditetapkanoleh = $this->input->post('ditetapkanoleh',TRUE);
        $idperkara=$this->encrypt->decode(base64_decode($this->uri->segment('3')));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            show_404();
            exit();
        }  
       
        $this->load->model('generate_template/m_template_mil','template');
        $this->load->model('perkara/pk','pk');
        $data['infopk'] = $this->pk->fetchpk($idperkara);
        $data['dataTemplate'] = $this->template->getDataPenetapanHakimMil($idperkara,'64');
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');
        $data['dataPutBef'] = $this->template->pk_infotputusan_bef($idperkara);
        $data['pk_infoMajelisHakim'] = $this->template->pk_infoMajelisHakim($idperkara);
        #K_120_40_510_3
        $data['template']=$this->template2->getDataDocumentTemplate('120','40','510','4','');
        
        $this->load->view('generate_template/cetak_majelis_hakim_pemeriksaan_pk',$data,FALSE);
    }

    function cetakBAPPkMil(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }       

        $idperkara=$this->encrypt->decode(base64_decode($this->uri->segment('3')));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            show_404();
            exit();
        }  
       
        $this->load->model('generate_template/m_template_mil','template');
        $this->load->model('perkara/pk','pk');
        $data['infopk'] = $this->pk->fetchpk($idperkara);
        $data['dataTemplate'] = $this->template->getDataPenetapanHakimMil($idperkara,'64');
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');
        $data['dataPutBef'] = $this->template->pk_infotputusan_bef($idperkara);
        $data['pk_infoMajelisHakim'] = $this->template->pk_infoMajelisHakim($idperkara);
        #K_120_40_510_3
        $data['template']=$this->template2->getDataDocumentTemplate('120','40','520','2','');
        
        $this->load->view('generate_template/cetak_BAPPkMil',$data,FALSE);
    }

    function cetakBAPendapat(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login');
        }       

        $idperkara=$this->encrypt->decode(base64_decode($this->uri->segment('3')));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            show_404();
            exit();
        }  
       
        $this->load->model('generate_template/m_template_mil','template');
        $this->load->model('perkara/pk','pk');
        $data['infopk'] = $this->pk->fetchpk($idperkara);
        $data['dataTemplate'] = $this->template->getDataPenetapanHakimMil($idperkara,'64');
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');
        $data['dataPutBef'] = $this->template->pk_infotputusan_bef($idperkara);
        $data['pk_infoMajelisHakim'] = $this->template->pk_infoMajelisHakim($idperkara);
        #K_120_40_510_3
        $data['template']=$this->template2->getDataDocumentTemplate('120','40','520','3','');
        
        $this->load->view('generate_template/cetak_BAPPkMil',$data,FALSE);
    }

}
?>