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

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

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

	function popup_akta_penerimaan_memori_kasasi(){
        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();
        }
        
        $this->load->model('generate_template/m_template_pidana_akta_penerimaan_memori_kasasi','template');
        $data['dataPutusan']=$this->template->getDataPutusan($idperkara);
        $data['info_DataTerdakwa']=$this->template->infoDataTerdakwa($idperkara);
        $data['info_dataJaksaKasasi']=$this->template->getDataJaksaKasasi($idperkara);
        $data['info_DataPHKasasi']=$this->template->infoDataPHKasasi($idperkara);
        $data['info_penadatangan']=$this->template->getDataPejabat();
        $data['template']=$this->template->getDataDocumentTemplate('111','30','430','','penerimaan memori kasasi');
        $this->load->view('generate_template/popup_akta_pidana_penerimaan_memori_kasasi', $data, FALSE);
    }

     function cetak_akta_penerimaan_memori_kasasi(){
        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);
        $data['diwakilkan'] = $this->input->post('diwakilkan',TRUE);  
        $data['terdakwa_id'] = $this->input->post('terdakwa',TRUE);
        $terdakwa_id=$this->encrypt->decode(base64_decode($data['terdakwa_id']));
        $data['pengacara_id'] = $this->input->post('ph',TRUE);
        $pengacara_id=$this->encrypt->decode(base64_decode($data['pengacara_id']));
        $data['idpihak'] = $this->input->post('jpu',TRUE);
        $idpihak=$this->encrypt->decode(base64_decode($data['idpihak']));  	

    	$this->load->model('generate_template/m_template_pidana_akta_penerimaan_memori_kasasi','template');
    	if($data['jenisTemplate']==1){
    		$data['dataTemplate'] = $this->template->cetak_penerimaan_memori_kasasi($idperkara,$terdakwa_id,$idpembuatakta,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','430','3','');
    		$this->load->view('generate_template/cetak_memori_pidana_kasasi_terdakwa',$data,FALSE);
    	}elseif ($data['jenisTemplate']==2) {
    		$data['dataTemplate'] = $this->template->cetak_penerimaan_memori_kasasi($idperkara,$terdakwa_id,$idpembuatakta,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','430','4','');
    		$this->load->view('generate_template/cetak_memori_pidana_kasasi_terdakwa_tidak_menghadap',$data,FALSE);
    	}elseif ($data['jenisTemplate']==3) {
    		$data['dataTemplate'] = $this->template->cetak_penerimaan_memori_kasasi($idperkara,$terdakwa_id,$idpembuatakta,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','430','5','');
    		$this->load->view('generate_template/cetak_memori_pidana_kasasi_penasihat_hukum',$data,FALSE);
    	}elseif ($data['jenisTemplate']==4) {
    		$data['dataTemplate'] = $this->template->cetak_penerimaan_memori_kasasi_pu($idperkara,$idpihak,$idpembuatakta,$idput);
            $data['DataJaksaKasasi'] = $this->template->getDataJaksaKasasi($idperkara);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','430','6','');
    		$this->load->view('generate_template/cetak_memori_pidana_kasasi_penuntut_umum',$data,FALSE);
    	}else{
            show_404();
            exit();
        }
    }

}
