<?php
if($this->session->userdata('is_logged_in')===FALSE){
			redirect('login');
}
$namafile ='instrumen_amar';

$url = base_url("resources/template/new_template/peradilan_agama/template_pendukung/".$namafile.".rtf");
$Template = file_get_contents($url);

	foreach ($dataPerkara->result() as $row) {
           	
             $nomorperkara   =$row->nomor_perkara;
             $tanggaldaftar   =$row->tanggal_pendaftaran;
             $namaPihakP   =$row->pihak1_text;
			  $namaPihakT   =$row->pihak2_text;
			  $jenis_perkara   =$row->jenis_perkara_text;
			  
		}
	foreach ($dataPutusan->result() as $row) {
           	$tglPutusan     =$this->templatehelper->convertKeTglIndo($row->tanggal_putusan);
             $amarPutusan    =$this->templatehelper->cleanHtmlTag($row->amar_putusan);
            
	}
	foreach ($datajurusita->result() as $row) {
			$jurusita = $this->templatehelper->standradnaming($row->nama_gelar);
        }
	foreach ($dataHakim->result() as $row) {
			$namahakim = $this->templatehelper->standradnaming($row->nama_gelar);
        }
$satker = $this->templatehelper->standradnaming($getsatker->result()[0]->nama_satker);
$Template = str_replace('#kota_satker#',$this->templatehelper->namaKota($satker),$Template);
$Template = str_replace("#nomor_perkara#",''.$nomorperkara.'',$Template);
$Template = str_replace("#tgl_daftar#",$this->templatehelper->convertKeTglIndo($tanggaldaftar),$Template);
$Template = str_replace("#namaPihakP#",''.$namaPihakP.'',$Template);
$Template = str_replace("#namaPihakT#",''.$namaPihakT.'',$Template);
$Template = str_replace("#nama_hakim#",''.$namahakim.'',$Template);
$Template = str_replace("#tgl_putus#",''.$tglPutusan.'',$Template);
$Template = str_replace("#amar#",''.$amarPutusan.'',$Template);
$Template = str_replace("#nama_jurusita#",''.$jurusita.'',$Template);
$Template = str_replace("#jenis_perkara#",''.$jenis_perkara.'',$Template);
$Template = str_replace("#TGL_SEKARANG#",$this->templatehelper->convertKeTglIndo(date('Y-m-d')),$Template);
$Template = str_replace("#HARI_INI#",$this->templatehelper->gethari(date('Y-m-d')),$Template);
	header("Content-Type: application/vnd.ms-word");
	header("Expires: 0");
	header("Cache-Control:  must-revalidate, post-check=0, pre-check=0");
	header("Content-disposition: attachment; filename=\"Instrumen Amar -".$nomor_perkara.".rtf\"");
	echo $Template;
?>
