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

class c_template_mil_pk extends CI_Controller {

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


    function cetak_pelimpahan_pk_mil(){

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

        $data['enc']=$this->uri->segment('3');
        $pemohon_id=$this->uri->segment('4');
        $pihakAsal=$this->uri->segment('5');
        $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_mil','template');
        if($pihakAsal==1){
            $tbl_pihak = 'perkara_pihak1';
            $data['infoPihak'] = $this->template->infoPihak1($idperkara,$pemohon_id);
        }elseif($pihakAsal==2){
            $tbl_pihak = 'perkara_pihak2';
             $data['infoPihak'] = $this->template->infoPihak2($idperkara,$pemohon_id);
        }

        $this->load->model('perkara/pk','pk');
        $data['infopk'] = $this->pk->fetchpk($idperkara);
        $data['infopkdetil'] = $this->pk->fetchpkDetil($idperkara);  

        $data['alur_perkara_id']=$this->tanggalhelper->getIDAlurPerkara($idperkara);
        
        
        $data['dataTemplate'] = $this->template->getDataPenetapanHakimMil($idperkara,'64');
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');        
        $data['template']=$this->template2->getDataDocumentTemplate('120','40','510','2','');
        $this->load->view('generate_template/cetak_pelimpahan_pk_mil',$data,FALSE);
    }

}
?>