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

class c_template_akta_kasasi_tun extends CI_Controller {

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

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

   #cetak akta permohonan kasasi TUN
    function cetak_akta_kasasi_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->getDataPengadilan();
        $data['dataumum'] = $this->template->getDataUmum($idperkara);
        $data['datakasasi'] = $this->template->getDataKasasi($idperkara);
        $data['datapihakkasasi'] = $this->template->getDataPihakKasasi($idperkara,$jenispihak);
        $data['datapihakpemohonkasasi'] = $this->template->getDataPihakPemohonKasasi($idperkara,$IDPemohonKasasi);
        $data['databanding'] = $this->template->getDataBanding($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);
        

       /* print_r($data['dataumum']->result());
        exit();*/
        //$data['data_pengacara_penggugat'] = $this->template->getKuasaHukumP($idperkara);

        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        if($data['jenisTemplate']==1){
            $data['template']=$this->template2->getDataDocumentTemplate('9','30','410','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_akta_permohonan_kasasi_tun', $data, FALSE);
    }

    

}
        