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

class c_template_agama_perdata_pemberitahuan_putusan extends CI_Controller {

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

    function popup_sisa_panjar(){
        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_agama','template');
        $data['penandatangan']=$this->template->getDataPA();

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template3');
        $data['getListJurusita']=$this->template3->identitas_pihak($idperkara,'1');      

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $template_result=$this->template2->getDataDocumentTemplate('15','14','200','901','');
        
        foreach ($template_result->result() as $template)
        {
            if (count($template)=='1')
            {
                $data['judul']=$template->namatemplate;
                $data['jnsperkara']=$template->jnsperkara;
            }
            else
            {
                if ($i=='0')
                {
                    $judul=$template->namatemplate;
                    $data['judul']=explode("",$judul);
                    $data['jnsperkara']=$template->jnsperkara;
                }
            }
        }
        $data['judul']='Pengembalian Sisa Panjar';
        $this->load->view('generate_template/peradilan_agama/popup_pengembalian_sisa_panjar', $data, FALSE);
    }
	function popup_teguran_panjar(){
        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_agama','template');
        $data['penandatangan']=$this->template->getDataPA();

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template3');
        $data['getListJurusita']=$this->template3->identitas_pihak($idperkara,'1');      

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $template_result=$this->template2->getDataDocumentTemplate('15','14','200','901','');
        
        foreach ($template_result->result() as $template)
        {
            if (count($template)=='1')
            {
                $data['judul']=$template->namatemplate;
                $data['jnsperkara']=$template->jnsperkara;
            }
            else
            {
                if ($i=='0')
                {
                    $judul=$template->namatemplate;
                    $data['judul']=explode("",$judul);
                    $data['jnsperkara']=$template->jnsperkara;
                }
            }
        }
        $data['judul']='Teguran Tambah Panjar';
        $this->load->view('generate_template/peradilan_agama/popup_teguran_panjar', $data, FALSE);
    }
    function cetak_teguran_panjar(){

        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']));

        $data['ditetapkanoleh'] = $this->input->post('ditetapkanoleh',TRUE);

        $data['jumlah'] = $this->input->post('b_panjar',TRUE);
        

        $this->load->model('generate_template/m_template_penetapan_agama','template');
        $data['datapengadilan'] = $this->template->getDataPA();
        
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $data['template']=$this->template2->getDataDocumentTemplate('15','14','200','901','');

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template3');
        $data['datapenggugat'] = $this->template3->identitas_pihak($idperkara,'1');

        $this->load->view('generate_template/peradilan_agama/cetak_teguran_panjar', $data, FALSE);
    }
	 function cetak_pengembalian_sisa_panjar(){

        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']));

        $data['ditetapkanoleh'] = $this->input->post('ditetapkanoleh',TRUE);

        $data['jumlah'] = $this->input->post('b_panjar',TRUE);
        

        $this->load->model('generate_template/m_template_penetapan_agama','template');
        $data['datapengadilan'] = $this->template->getDataPA();
        
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $data['template']=$this->template2->getDataDocumentTemplate('15','14','200','901','');

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template3');
        $data['datapenggugat'] = $this->template3->identitas_pihak($idperkara,'1');

        $this->load->view('generate_template/peradilan_agama/cetak_pengembalian_sisa_panjar', $data, FALSE);
    }
    function popup_pemberitahuan_putusan_tergugat(){
        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['encidpihak']=$this->uri->segment('4');
            $idpihak=$this->encrypt->decode(base64_decode($data['encidpihak']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            show_404();
            exit();
        }


        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template');
        $data['getAlurPerkaraId'] = $this->template->getAlurPerkaraId($idperkara);
        $data['datajurusita']=$this->template->getListJurusita($idperkara);
        
        if ($this->uri->segment('5')==1)
        {
            $data['blangko_pbt']=$this->template->blangko_pbt_p($data['getAlurPerkaraId']);    
        }
        else
        {
            $data['blangko_pbt']=$this->template->blangko_pbt_t();       
        }
        

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $template=$this->template2->getDataDocumentTemplate('15','15','230','201','');
        
        $i=0;
        foreach ($template->result() as $template)
        {
            if (count($template)=='1')
            {
                $data['judul']=$template->namatemplate;
                $data['jnsperkara']=$template->jnsperkara;
            }
            else
            {
                if ($i=='0')
                {
                    $judul=$template->namatemplate;
                    $data['judul']=explode("",$judul);
                    $data['jnsperkara']=$template->jnsperkara;
                }
            }
        }
        $data['judul']='Pemberitahuan Isi Putusan';

    	$this->load->view('generate_template/peradilan_agama/popup_pbt', $data, FALSE);
    }
     function popup_pemberitahuan_putusan_tergugat_delegasi(){
        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['encidpihak']=$this->uri->segment('4');
            $idpihak=$this->encrypt->decode(base64_decode($data['encidpihak']));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            show_404();
            exit();
        }


        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template');
        $data['getListJurusita']=$this->template->getListJurusita($idperkara);
        
        if ($this->uri->segment('5')==1)
        {
            $data['blangko_pbt']=$this->template->blangko_pbt_p_delegasi();    
        }
        else
        {
            $data['blangko_pbt']=$this->template->blangko_pbt_t_delegasi();       
        }
        

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $template=$this->template2->getDataDocumentTemplate('15','15','230','201','');
        
        $i=0;
        foreach ($template->result() as $template)
        {
            if (count($template)=='1')
            {
                $data['judul']=$template->namatemplate;
                $data['jnsperkara']=$template->jnsperkara;
            }
            else
            {
                if ($i=='0')
                {
                    $judul=$template->namatemplate;
                    $data['judul']=explode("",$judul);
                    $data['jnsperkara']=$template->jnsperkara;
                }
            }
        }
        $data['judul']='Pemberitahuan Isi Putusan Delegasi';
        $this->load->view('generate_template/peradilan_agama/popup_pbt_delegasi', $data, FALSE);
    }

	function cetak_pemberitahuan_putusan_tergugat($post){

    	$post = urldecode($post);
        $post = (array) json_decode($post);
        $post = (array) $post;

        $data_id=array(
            'source_file'   => "peradilan_agama/relaas/pbt/".$post['dokumen'].".rtf",
            'perkara_id'    => dec($post['idPerkara']),
            'pihak_id'      => dec($post['idPihak']),
            'jurusita_id'   => $post['idJurusita'],
        );  

        $this->load->model('generate_template/var_template_agama','var_template');
        $this->var_template->kirim_variabel($data_id);  
		
    }

    function cetak_pemberitahuan_putusan_tergugat_delegasi(){

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

        $segment = $this->uri->segment_array();
        $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['idpihak'] = $segment['4'];
        $idpihak=$this->encrypt->decode(base64_decode($data['idpihak']));
        if(!is_numeric($idpihak) OR !intval($idpihak)>0){
            show_404();
            exit();
        }   
        $data['jenisTemplate'] = $segment['5'];
        
        
       

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template');
        $data['datapenggugat'] = $this->template->identitas_pihak($idperkara,'1');

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template');
        $data['datatergugat'] = $this->template->identitas_pihak($idperkara,'2');

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template');
       // $data['dataTemplate'] = $this->template->cetak_pemberitahuan_putusan_pdt($idperkara,$idpihak);


        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $temp = explode('_', $segment['8']);
       // $data['template']=$this->template2->getDataDocumentTemplate($temp[1],$temp[2],$temp[3],$temp[4],'');

        $this->load->model('generate_template/m_template_penetapan_agama','template3');
        $data['dataPihak2']=$this->template3->get_data_pihak_loop($idperkara,2);

        $this->load->model('generate_template/m_template_penetapan_agama','template3');
        $data['dataPihak1']=$this->template3->get_data_pihak_loop($idperkara,1);



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

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

        $segment = $this->uri->segment_array();
        $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_perdata_pemberitahuan_putusan_tergugat','template');
        $data['getListTergugat']=$this->template->getListTergugat($idperkara);
        $data['getListJurusita']=$this->template->getListJurusita($idperkara);
        $data['getBiayaPerkara']=$this->template->getBiayaPerkara($idperkara);

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

        $data['judul']=$judul['0'];
        //$data['judul']="RELAAS PANGGILAN KEPADA PENGGUGAT"; //override
        $data['jnsperkara']=$jnsperkara;
        $this->load->view('generate_template/popup_pemberitahuan_putusan_perdata_tergugat', $data, FALSE);
    }

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

        $segment = $this->uri->segment_array();

        $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['idpihak'] = $segment['4'];
        $idpihak=$this->encrypt->decode(base64_decode($data['idpihak']));
        if(!is_numeric($idpihak) OR !intval($idpihak)>0){
            show_404();
            exit();
        }   
        $data['jenisTemplate'] = $segment['5'];
        $data['jursit'] = $segment['6'];
        $jursit=$this->encrypt->decode(base64_decode($data['jursit']));
        if(!is_numeric($jursit) OR !intval($jursit)>0){
            show_404();
            exit();
        }   
        $data['jursit_id_label'] = $segment['7'];
        $data['biaya'] = $segment['8'];
        $data['bertemu'] = $segment['9'];

        $this->load->model('generate_template/m_template_perdata_pemberitahuan_putusan_tergugat','template');
        $data['dataTemplate'] = $this->template->cetak_pemberitahuan_putusan_pdt($idperkara,$idpihak,$jursit);

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        if($data['jenisTemplate']==1){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','220','');
        }  else if ($data['jenisTemplate']==2){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','221','');
        } else if ($data['jenisTemplate']==3){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','225','');
        } else if ($data['jenisTemplate']==4){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','223','');
        } else if ($data['jenisTemplate']==5){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','230','');
        } else if ($data['jenisTemplate']==6){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','231','');
        } else if ($data['jenisTemplate']==7){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','232','');
        } else if ($data['jenisTemplate']==8){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','233','');
        } else if ($data['jenisTemplate']==9){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','234','');
        }else{
            show_404();
            exit();
        }

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

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

        $segment = $this->uri->segment_array();
        $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_perdata_pemberitahuan_putusan_kuasa_p','template');
        $data['getListKuasa_P']=$this->template->getListKuasa_P($idperkara);
        $data['getListJurusita']=$this->template->getListJurusita($idperkara);
        $data['getBiayaPerkara']=$this->template->getBiayaPerkara($idperkara);

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

        $data['judul']=$judul['0'];
        //$data['judul']="RELAAS PANGGILAN KEPADA PENGGUGAT"; //override
        $data['jnsperkara']=$jnsperkara;
        $this->load->view('generate_template/popup_pemberitahuan_putusan_perdata_kuasa_penggugat', $data, FALSE);
    }

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

        $segment = $this->uri->segment_array();
        $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['idkuasaPenggugat'] = $segment['4'];
        $idkuasaPenggugat=$this->encrypt->decode(base64_decode($data['idkuasaPenggugat']));
        if(!is_numeric($idkuasaPenggugat) OR !intval($idkuasaPenggugat)>0){
            show_404();
            exit();
        }           
        $data['jenisTemplate'] = $segment['5'];
        $data['jursit'] = $segment['6'];
        $jursit=$this->encrypt->decode(base64_decode($data['jursit']));
        if(!is_numeric($jursit) OR !intval($jursit)>0){
            show_404();
            exit();
        }   
        $data['jursit_id_label'] = $segment['7'];
        $data['biaya'] = $segment['8'];
        $data['bertemu'] = $segment['9'];

        $this->load->model('generate_template/m_template_perdata_pemberitahuan_putusan_kuasa_p','template');
        $data['dataTemplate'] = $this->template->cetak_pemberitahuan_putusan_pdt_kuasa_p($idperkara,$idkuasaPenggugat,$jursit);

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        if($data['jenisTemplate']==1){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','203','');
        }  
        else if ($data['jenisTemplate']==2){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','204','');
        }else{
            show_404();
            exit();
        }
        $this->load->view('generate_template/cetak_pemberitahuan_putusan_perdata_kuasa_penggugat', $data, FALSE);
    }

    function pemberitahuan_putusan_pdt_kuasa_tergugat(){
        if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        }  
        $segment = $this->uri->segment_array();
        $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_perdata_pemberitahuan_putusan_kuasa_t','template');
        $data['getListKuasa_T']=$this->template->getListKuasa_T($idperkara);
        $data['getListJurusita']=$this->template->getListJurusita($idperkara);
        $data['getBiayaPerkara']=$this->template->getBiayaPerkara($idperkara);

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

        $data['judul']=$judul['0'];
        //$data['judul']="RELAAS PANGGILAN KEPADA PENGGUGAT"; //override
        $data['jnsperkara']=$jnsperkara;
        $this->load->view('generate_template/popup_pemberitahuan_putusan_perdata_kuasa_tergugat', $data, FALSE);
    }

     function cetak_pemberitahuan_putusan_pdt_kuasa_t(){
        if($this->nativesession->get_flash_session('security')==FALSE){
            redirect('main');
        }

        if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        }  
        
        $segment = $this->uri->segment_array();
        $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['idKuasaTergugat'] = $segment['4'];
        $idKuasaTergugat=$this->encrypt->decode(base64_decode($data['idKuasaTergugat']));
        if(!is_numeric($idKuasaTergugat) OR !intval($idKuasaTergugat)>0){
            show_404();
            exit();
        }   
        $data['jenisTemplate'] = $segment['5'];
        $data['jursit'] = $segment['6'];
        $jursit=$this->encrypt->decode(base64_decode($data['jursit']));
        if(!is_numeric($jursit) OR !intval($jursit)>0){
            show_404();
            exit();
        }
        $data['jursit_id_label'] = $segment['7'];
        $data['biaya'] = $segment['8'];
        $data['bertemu'] = $segment['9'];

        $this->load->model('generate_template/m_template_perdata_pemberitahuan_putusan_kuasa_t','template');
        $data['dataTemplate'] = $this->template->cetak_pemberitahuan_putusan_pdt_kuasa_t($idperkara,$idKuasaTergugat,$jursit);

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        if($data['jenisTemplate']==1){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','222','');
        }else if ($data['jenisTemplate']==2){
            $data['template']=$this->template2->getDataDocumentTemplate('1','15','230','224','');
        }else{
            show_404();
            exit();
        }

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

    #pemberitahuan putusan tun
    function cetak_pemberitahuan_putusan_tun($enc,$idpihak,$jenisTemplate){
        if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        }       

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

        $this->load->model('generate_template/m_template_pemberitahuan_putusan_tun','template');
        $data['datapn'] = $this->template->getDataPN();
        $data['dataumum'] = $this->template->getDataUmum($idperkara);
        $data['datapenggugat'] = $this->template->getDataPenggugat($idperkara,$idpihak);
        $data['datatergugat'] = $this->template->getDataTergugat($idperkara,$idpihak);
        $data['datapihakpenggugat'] = $this->template->getPihakPenggugat($idperkara);
        $data['datapihaktergugat'] = $this->template->getPihakTergugat($idperkara);               

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        if($data['jenisTemplate']==1){
            $data['template']=$this->template2->getDataDocumentTemplate('9','15','218','1','');
        }
        else if($data['jenisTemplate']==2){
            $data['template']=$this->template2->getDataDocumentTemplate('9','15','218','2','');
        }
        else{
            show_404();
            exit();
        }  
              
        $this->load->view('generate_template/cetak_pemberitahuan_putusan_tun', $data, FALSE);
    }

    #penetapan_persiapan
    function popup_pilihan_pihak($enc,$encPersiapanProses,$pihakke){
        $segment = $this->uri->segment_array();
        $data['enc'] = $enc;       
        $idperkara=$this->encrypt->decode(base64_decode($enc));
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){
            show_404();
            exit();
        }
        $data['idjadwal'] = $encPersiapanProses;            
        $data['judul'] = 'Cetak Dokumen Pemberitahuan/Panggilan';
        $data['nama_kolom'] = 'Kepada';               
        $data['nama_kolom_ttd'] = 'Tanda Tangan Oleh';
        $data['pilihan'] = array();
        $this->load->model('generate_template/m_template_pemberitahuan_putusan_tun','model_template');
        if($pihakke==1 OR $pihakke==2){
            $list_pihak = $this->model_template->getListPihak($idperkara,$pihakke);
            $data['pihakke'] = base64_encode($this->encrypt->encode($pihakke));
        }        
        if($pihakke==3 OR $pihakke==4){
            $data['penandaTangan'] = $this->model_template->penandaTangan();
            if($pihakke==3){
                $idpihak=1;
            }elseif($pihakke==4){
                $idpihak=2;
            }
            $list_pihak = $this->model_template->getListPihak($idperkara,$idpihak);
            $data['pihakke'] = base64_encode($this->encrypt->encode($idpihak));            
        }
        $data['idpihak'] = base64_encode($this->encrypt->encode($pihakke));            
        $data['isclickable'] = TRUE;
        if($list_pihak->num_rows>0){
            $i=1;
            $data['pilihan'] = array(array('id' => 0,
                'nama' => 'Pilih Pihak'));
            foreach ($list_pihak->result() as $row) {
                $data['pilihan'][$i] = array(
                    'id' => base64_encode($this->encrypt->encode($row->id)),
                    'nama' => $row->nama
                );
                $i++;
            }
        }else{
            $data['pilihan'] = array(
            array('id' => base64_encode($this->encrypt->encode(0)),
                'nama' => 'Pihak Tidak Ditemukan')
            );
            /* Jika Pihak Tidak Ditemukan, Maka Tombol Cetak Tidak Ditampilkan */
            $data['isclickable'] = FALSE;
        }
        $this->load->view('generate_template/popup_tun_pemeriksaan',$data,FALSE);

    }

    function cetak_panggil_persiapan_tun(){
        if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        }                   
        $idperkara=$this->encrypt->decode(base64_decode($this->input->post('enc',TRUE)));       
        $data['idperkara'] = $idperkara;
        if(!is_numeric($idperkara) OR !intval($idperkara)>0){            
            show_404();
            exit();
        } 
        $idjadwal=$this->encrypt->decode(base64_decode($this->input->post('idjadwal',TRUE)));       
        if(!is_numeric($idjadwal) OR !intval($idjadwal)>0){            
            show_404();
            exit();
        }    
        
        $idpihak=$this->encrypt->decode(base64_decode($this->input->post('pilihan',TRUE)));
        if(!is_numeric($idpihak) OR !intval($idpihak)>0){            
            show_404();
            exit();
        } 
        $jenisTemplate=$this->encrypt->decode(base64_decode($this->input->post('pihakke',TRUE)));        
        if(!is_numeric($jenisTemplate) OR !intval($jenisTemplate)>0){            
            show_404();
            exit();
        }
        $idpenandatangan = $this->encrypt->decode(base64_decode($this->input->post('penandaT',TRUE)));
        if(!empty($idpenandatangan)){
            if(!is_numeric($idpenandatangan) OR !intval($idpenandatangan)>0){            
                show_404();
                exit();
            }
            
        } 
        $data['penandatangan'] = $idpenandatangan;
        $pihak=$this->encrypt->decode(base64_decode($this->input->post('idtemplate',TRUE)));
        $jenisTemplate = $pihak;       
        $data['jenisTemplate'] = $jenisTemplate; 
              
        $this->load->model('generate_template/m_template_pemberitahuan_putusan_tun','template');
        $data['datapn'] = $this->template->getDataPN();
        $data['dataumum'] = $this->template->getDataPersiapan($idperkara,$idjadwal);
        $data['datadismissal'] = $this->template->getPanggilDismissal($idperkara,$idjadwal);
        $data['datapenggugat'] = $this->template->getDataPenggugat($idperkara,$idpihak);
        $data['datapihaktergugat'] = $this->template->getPihakTergugat($idperkara);
        $data['datapihakpenggugat'] = $this->template->getPihakPenggugat($idperkara);
        $data['datatergugat'] = $this->template->getDataTergugat($idperkara,$idpihak);                           

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        if($data['jenisTemplate']==1){
            $data['template']=$this->template2->getDataDocumentTemplate('9','12','42','2','');
        }else if($data['jenisTemplate']==2){
            $data['template']=$this->template2->getDataDocumentTemplate('9','12','42','3','');
        }else if($data['jenisTemplate']==3){
            $data['template']=$this->template2->getDataDocumentTemplate('9','12','15','1','');
        }else if($data['jenisTemplate']==4){
            $data['template']=$this->template2->getDataDocumentTemplate('9','12','15','2','');
        }
        else{
            show_404();
            exit();
        }  
              
        $this->load->view('generate_template/cetak_panggilan_persiapan_tun', $data, FALSE);
    }

    #penetapan persiapan
    function cetak_penetapan_persiapan_tun($enc,$jenisTemplate){
        if($this->session->userdata('is_logged_in')==FALSE){
            redirect('login');
        }       

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

        $this->load->model('generate_template/m_template_pemberitahuan_putusan_tun','template');
        $data['datapn'] = $this->template->getDataPN();
        $data['datapenetapan'] = $this->template->getDataPenetapanPersiapan($idperkara);        
        $data['datapihakpenggugat'] = $this->template->getPihakPenggugat($idperkara);
        $data['datapihaktergugat'] = $this->template->getPihakTergugat($idperkara);             

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        if($data['jenisTemplate']==3){
            $data['template']=$this->template2->getDataDocumentTemplate('9','12','42','1','');
        }        
        else{
            show_404();
            exit();
        }  
              
        $this->load->view('generate_template/cetak_persiapan_tun', $data, FALSE);
    }
	
	function popup_bukti_bayar(){
        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_agama','template');
        $data['penandatangan']=$this->template->getDataPA();

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template3');
        $data['getListJurusita']=$this->template3->identitas_pihak($idperkara,'1');      

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $template_result=$this->template2->getDataDocumentTemplate('15','14','200','902','');
        
        foreach ($template_result->result() as $template)
        {
            if (count($template)=='1')
            {
                $data['judul']=$template->namatemplate;
                $data['jnsperkara']=$template->jnsperkara;
            }
            else
            {
                if ($i=='0')
                {
                    $judul=$template->namatemplate;
                    $data['judul']=explode("",$judul);
                    $data['jnsperkara']=$template->jnsperkara;
                }
            }
        }
        $data['judul']='Bukti Bayar Panjar Perkara - SKUM';
        $this->load->view('generate_template/peradilan_agama/popup_bukti_bayar', $data, FALSE);
    }

	 function cetak_bukti_panjar(){

        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']));

        $data['ditetapkanoleh'] = $this->input->post('ditetapkanoleh',TRUE);

        $data['jumlah'] = $this->input->post('b_panjar',TRUE);
        $data['nama_pihak'] = $this->input->post('nama_p',TRUE);

        $this->load->model('generate_template/m_template_penetapan_agama','template');
        $data['datapengadilan'] = $this->template->getDataPA();
        
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $data['template']=$this->template2->getDataDocumentTemplate('15','14','200','902','');

        $this->load->model('generate_template/peradilan_agama/m_template_agama_pbt','template3');
        $data['datapenggugat'] = $this->template3->identitas_pihak($idperkara,'1');

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