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

class c_template_akta_penerimaan_kontra_memori_kasasi 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_kontra_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_kontra_memori_kasasi','template');
        $data['dataPutusan']=$this->template->getDataPutusan($idperkara);
        $data['info_penadatangan']=$this->template->getDataPejabat();
        $data['info_DataTerdakwa']=$this->template->infoDataTerdakwa($idperkara);
        $data['info_dataJaksaKasasi']=$this->template->getDataJaksaKasasi($idperkara);
        $data['info_dataPHkasasi']=$this->template->infoDataPHKasasi($idperkara);
        $data['template']=$this->template->getDataDocumentTemplate('111','30','450','','penerimaan kontra memori kasasi');
        $this->load->view('generate_template/popup_akta_pidana_penerimaan_kontra_memori_kasasi', $data, FALSE);
    }

     function cetak_akta_penerimaan_kontra_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['idterdakwa'] = $this->input->post('terdakwa',TRUE);
        $idterdakwa=$this->encrypt->decode(base64_decode($data['idterdakwa']));
        $data['ph'] = $this->input->post('ph',TRUE);
        $ph=$this->encrypt->decode(base64_decode($data['ph']));
        $data['jpu'] = $this->input->post('jpu',TRUE);
        $jpu=$this->encrypt->decode(base64_decode($data['jpu']));

    	$this->load->model('generate_template/m_template_pidana_akta_penerimaan_kontra_memori_kasasi','template');
    	if($data['jenisTemplate']==1){
    		$data['dataTemplate'] = $this->template->cetak_penerimaan_kontra_memori_kasasi($idperkara,$idpembuatakta,$idterdakwa,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','450','1','');
    		$this->load->view('generate_template/cetak_kontra_memori_pidana_kasasi_terdakwa',$data,FALSE);
    	}elseif ($data['jenisTemplate']==2) {
    		$data['dataTemplate'] = $this->template->cetak_penerimaan_kontra_memori_kasasi($idperkara,$idpembuatakta,$idterdakwa,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','450','2','');
    		$this->load->view('generate_template/cetak_kontra_memori_pidana_kasasi_terdakwa_tidak_menghadap',$data,FALSE);
    	}elseif ($data['jenisTemplate']==3) {
    		$data['dataTemplate'] = $this->template->cetak_penerimaan_kontra_memori_kasasi($idperkara,$idpembuatakta,$idterdakwa,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','450','3','');
    		$this->load->view('generate_template/cetak_kontra_memori_pidana_kasasi_penasihat_hukum',$data,FALSE);
    	}elseif ($data['jenisTemplate']==4) {
    		$data['dataTemplate'] = $this->template->cetak_penerimaan_kontra_memori_jpu($idperkara,$idpembuatakta,$jpu,$idput);
            $data['DataJaksaKasasi'] = $this->template->getDataJaksaKasasi($idperkara);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','450','4','');
    		$this->load->view('generate_template/cetak_kontra_memori_pidana_kasasi_penuntut_umum',$data,FALSE);
    	}else{
            show_404();
            exit();
        }
    }
}