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

class c_template_mil_akta_bht extends CI_Controller {
    
    function popup_akta_bht(){
        $segment=$this->uri->segment_array();
        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_ambil_identitas_template','template2');
         $data['template']=$this->template2->getDataDocumentTemplate('120','16','240','8','');

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

    function cetak_akta_bht(){
        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['jenistemplate'] = $this->input->post('jenistemplate',TRUE);
        $data['tanggapan'] = $this->input->post('tanggapan',TRUE);
        $this->load->model('generate_template/m_template_mil','template');
        $this->load->model('generate_template/m_template_ambil_identitas_template','template2');
        
        $data['dataputusan']=$this->template->getDataPutusan($idperkara);
        $data['datapengadilan']=$this->template->getDataPN();
        $data['dataterdakwa']=$this->template->getDataTerdakwaMil($idperkara);
        
        if ($data['jenistemplate']==1){
            //$data['template']=$this->template2->getDataDocumentTemplate('120','16','240','8','');
            $filenya="peradilan_militer/AKTA/56 AKTA  PUTUSAN  TELAH MEMPEROLEH  KEKUATAN HUKUM TETAP(7HARI).rtf";
            // $prosesid=       
        }elseif ($data['jenistemplate']==2){
            //$data['template']=$this->template2->getDataDocumentTemplate('120','16','240','9','');

            $filenya="peradilan_militer/AKTA/18 AKTA PUTUSAN MEMPEROLEH KEKUATAN HUKUM TETAP(14 HARI).rtf";     
        }

        $this->template->get_bht($idperkara);

        $data_id= array(
                    'source_file'=>$filenya,
                    'perkara_id'=>$idperkara,
                    'ditetapkan_oleh'=>$pembuat,
                    'redaksi_bht_mil'=>$data['tanggapan'],
                    'proses_id'=>$prosesid); 

        $this->load->model('generate_template/var_template_mil','var_template');
        $this->var_template->kirim_variabel($data_id);
      //  $this->load->view('generate_template/cetak_mil_akta_bht',$data,FALSE);
    }   
}
/* End of file c_template_mil_akta_bht.php */
/* Location: ./application/controllers/c_template_mil_akta_bht.php */