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

class c_template_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_akta_tidak_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_akta_kasasi_pid','template');
        $data['dataPutusan']=$this->template->getDataPutusan($idperkara);
        $data['info_penadatangan']=$this->template->getDataPejabat();
        $data['template']=$this->template->getDataDocumentTemplate('111','30','410','641','');
        $this->load->view('generate_template/popup_akta_pidana_tidak_mengajukan_kasasi', $data, FALSE);
    }
    function cetak_akta_tidak_kasasi(){
        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['tglCabut'] =$segment[10]."/".$segment[9]."/".$segment[8];
        $jenisTemplate=$segment[4];
    	$data['pengaju'] =$segment[5];
    	$data['idpembuatakta']=$segment[6];
        $idpembuatakta=$this->encrypt->decode(base64_decode($data['idpembuatakta']));
        if(!is_numeric($idpembuatakta) OR !intval($idpembuatakta)>0){
             show_404();
             exit();
        }
    	$data['idput']=$segment[7];
        $idput=$this->encrypt->decode(base64_decode($data['idput']));
        if(!is_numeric($idput) OR !intval($idput)>0){
             show_404();
             exit();
        }
    	
        $this->load->model('generate_template/m_template_akta_kasasi_pid','template');
        $data['dataTemplate'] = $this->template->cetak_akta_tidak_kasasi($idperkara,$idpembuatakta,$idput);

        if($jenisTemplate==1){
        $data['template']=$this->template->getDataDocumentTemplate('111','30','410','641','');
        } else if ($jenisTemplate==2){
        $data['template']=$this->template->getDataDocumentTemplate('111','30','410','642','');
        }

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