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

class c_template_cabut_akta_kasasi_pid extends CI_Controller {

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

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

	function popup_cabut_akta_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();
        }

        $this->load->model('generate_template/m_template_cabut_akta_kasasi_pid','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['info']=$this->template->getInfo($idperkara);
        $data['template']=$this->template->getDataDocumentTemplate('111','30','410','','pencabutan permohonan kasasi');
        $this->load->view('generate_template/popup_akta_cabut_kasasi', $data, FALSE);
    }

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

        $segment = $this->uri->segment_array();
        //print_r($segment);
    	//$data['idperkara'] =$segment[3];
        $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['idpembuatakta']=$segment[4];
        $data['idpembuatakta']=$segment[10];
        $idpembuatakta=$this->encrypt->decode(base64_decode($data['idpembuatakta']));
        if(!is_numeric($idpembuatakta) OR !intval($idpembuatakta)>0){
             show_404();
             exit();
         }
    	
        //$data['idput']=$segment[5];
        $data['idput']=$segment[9];
        $idput=$this->encrypt->decode(base64_decode($data['idput']));
        if(!is_numeric($idput) OR !intval($idput)>0){
             show_404();
             exit();
        }
    	
        //$data['jenisTemplate'] =$segment[6];
        $data['jenisTemplate'] =$segment[4];
        //$data['diwakilkan'] =$segment[7];
        $data['diwakilkan'] =$segment[6];
        //var_dump($data['jenisTemplate']);
    	$this->load->model('generate_template/m_template_cabut_akta_kasasi_pid','template');
    	if($data['jenisTemplate']==1){
    		$data['dataTemplate'] = $this->template->cetak_cabut_kasasi_terdakwa($idperkara,$idpembuatakta,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','410','996','');
    		$this->load->view('generate_template/cetak_cabut_kasasi_pidana_terdakwa',$data,FALSE);
    	}elseif ($data['jenisTemplate']==2) {
    		$data['dataTemplate'] = $this->template->cetak_cabut_kasasi_terdakwa($idperkara,$idpembuatakta,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','410','997','');
    		$this->load->view('generate_template/cetak_cabut_kasasi_pidana_terdakwa_diwakilkan',$data,FALSE);
    	}elseif ($data['jenisTemplate']==3) {
    		$data['dataTemplate'] = $this->template->cetak_cabut_kasasi_ph($idperkara,$idpembuatakta,$idput);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','410','998','');
    		$this->load->view('generate_template/cetak_cabut_kasasi_pidana_penasihat_hukum',$data,FALSE);
    	}elseif ($data['jenisTemplate']==4) {
    		$data['dataTemplate'] = $this->template->cetak_cabut_kasasi_terdakwa($idperkara,$idpembuatakta,$idput);
            $data['DataJaksaKasasi'] = $this->template->getDataJaksaKasasi($idperkara);
            $data['template']=$this->template->getDataDocumentTemplate('111','30','410','999','');
    		$this->load->view('generate_template/cetak_cabut_kasasi_pidana_penuntut_umum',$data,FALSE);
    	}
    }

}

/* End of file template_cabut_akta_kasasi_pid_c.php */
/* Location: ./application/controllers/template_cabut_akta_kasasi_pid_c.php */