<?php 
defined('BASEPATH') OR exit('No direct script access allowed');
class c_template_penetapan_pidana_pra extends CI_Controller {
	function index(){
        if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        }   
    	$this->load->view('dashboard', FALSE);
    }
    
    function popup_penetapan_majelis_hakim_pid(){
        if($this->session->userdata('is_logged_in')==FALSE){
        redirect('login'); }

        $segment = $this->uri->segment_array();
        $data['enc']=$this->uri->segment('3'); 

        $this->load->model('generate_template/m_template_penetapan','template');
        $data['penandatangan']=$this->template->getDataPN();

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        
        $data['judul']= 'PENETAPAN MAJELIS HAKIM/HAKIM';
        $data['jnsperkara']= 'PRAPERADILAN';
        $data['alur'] = 201;
        $this->load->view('generate_template/popup_penetapan_majelis_hakim_pid', $data, FALSE);
    }

    function cetak_pen_prapid_gugur(){
        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();
        }   
        $this->load->model('generate_template/m_template_penetapan_pidana_pra','template');
        $data['data_template'] = $this->template->get_cetak_pen_prapid_gugur($idperkara);
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $data['template']=$this->template2->getDataDocumentTemplate('119','15','212','1','');
        $this->load->view('generate_template/cetak_penetapan_pidana_pra_gugur', $data, FALSE);        
    }

    
    function cetak_sidang_prapid(){
        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_id=array(
                    'source_file'=>'peradilan_umum/pidana/penetapan/4_4_PEN_HARI_SIDANG_PRAPERADILAN.rtf',
                    'perkara_id'=>$idperkara);   
                            
        $this->load->model('generate_template/var_template'); 
        $this->var_template->kirim_variabel($data_id);
    }

    function cetak_pen_hakim_prapid(){
        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']));
        
        $this->load->model('generate_template/m_template_penetapan_pidana_pra','template');
        // $data['data_template'] = $this->template->get_cetak_pen_prapid_gugur($idperkara);
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $data['template']=$this->template2->getDataDocumentTemplate('119','12','20','1','');
        // $this->load->view('generate_template/cetak_penetapan_pidana_pra_hakim_tanpa_kuasa', $data, FALSE);
        $ditetapkan_oleh    = $this->input->post('ditetapkanoleh',TRUE);        
        $tgl_penetapan      = $this->input->post('tgl_penetapan',TRUE);
        $data_id=array(
                    'source_file'=>'peradilan_umum/pidana/penetapan/2_1_PEN_HAKIM_PRA_DIAJUKAN_KUASA.rtf',
                    'perkara_id'=>$idperkara,
                    'ditetapkan_oleh'=>$ditetapkan_oleh,
                    'tgl_penetapan'=>$tgl_penetapan);           
        $this->session->set_userdata('data_id',$data_id);
        redirect ("c_new_template/kirim_variabel");
    }

    function popup_relaas_panggilan_praperadilan(){
        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();
        }   
        $this->load->model('generate_template/m_template_penetapan_pidana_pra','template');
        $data['getListJurusita'] = $this->template->getListJurusita($idperkara);
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $data['template']=$this->template2->getDataDocumentTemplate('119','14','200','','relaas panggilan');
        $this->load->view('generate_template/popup_relaas_pidana_pra_panggilan', $data, FALSE);
    }


    function cetak_relaas_panggilan_praperadilan(){
        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['jenisRelaas'] = $this->input->post('jenisRelaas',TRUE);  
        if(!is_numeric($data['jenisRelaas']) OR !intval($data['jenisRelaas'])>0){
            show_404();
            exit();
        }
        $data['jursitLbl'] = $this->input->post('jursitLbl',TRUE);
        $data['jurusita'] = $this->input->post('jurusita',TRUE);           
        $jurusita=$this->encrypt->decode(base64_decode($data['jurusita']));
        if(!is_numeric($jurusita) OR !intval($jurusita)>0){
            show_404();
            exit();
        }   
        $this->load->model('generate_template/m_template_penetapan_pidana_pra','template');
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        if($data['jenisRelaas']==1){
            $data['data_template'] = $this->template->get_cetak_relaas_panggilan_pemohon($idperkara);
            $data['template']=$this->template2->getDataDocumentTemplate('119','14','200','1','');
        }elseif($data['jenisRelaas']==2){
            $data['data_template'] = $this->template->get_cetak_relaas_panggilan_pemohon($idperkara);
            $data['template']=$this->template2->getDataDocumentTemplate('119','14','200','2','');
        }elseif($data['jenisRelaas']==3){
            $data['data_template'] = $this->template->get_cetak_relaas_panggilan_termohon($idperkara);
            $data['template']=$this->template2->getDataDocumentTemplate('119','14','200','3','');
        }else{
            show_404();
            exit();
        }
        $this->load->view('generate_template/cetak_relaas_pidana_pra_panggilan', $data, FALSE);    
    }
}
?>