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

foreach ($template->result() as $template){
    $filename=$template->kdtemplate;
    $namafile=str_replace(" ","",$template->namatemplate);
}

$url = base_url("resources/template/akta/pidana_umum/".$filename.".rtf");
$Template = file_get_contents($url);
//=============================================roby======================================================
foreach ($dataTemplate->result() as $perkara) {
			$nomorPerkara = $perkara->nomor_perkara;
			$no = explode("/",$perkara->nomor_perkara);
			$nomor = $no[0];
			$kodePerkara = $no[1];
			$tahunPerkara = $no[2];
			$kodePN = $no[3];
			$nomorPermohonan = $nomor."/Akta ".$kodePerkara."/".$tahunPerkara."/".$kodePN;
			$namaPN = $this->templatehelper->standradnaming($perkara->namaPengadilan);
			$namaPanitera = $this->templatehelper->standradnaming($perkara->pw);
			$tahapan = $this->templatehelper->standradnaming($perkara->tahapan);
			$noPerkaraTahapan = $this->templatehelper->standradnaming($perkara->nomorPerkaraTahapan);
			$tglPutusTahapan = $this->templatehelper->convertKeTglIndo($perkara->putusan);
			$statusPanitera = $this->templatehelper->standradnaming($perkara->pejabat);
			$tglpermohonan_kasasi = $this->templatehelper->convertKeTglIndo($perkara->permohonan_kasasi);
			$hariPermohonanKasasi = $this->templatehelper->getHari($perkara->permohonan_kasasi);
			$namajaksa = $this->templatehelper->standradnaming($perkara->namaPihak);
			
 }
$jaksa = $DataJaksaKasasi;

$namaJaksa = "";
$nipJaksa = "";
$pekerjaan = "";
$kejaksaan = "";
foreach ($jaksa->result() as $rows) {
	$namaJaksa = $this->templatehelper->standradnaming($rows->nama);
	$nipJaksa = $rows->NIP;
	$pekerjaan = $this->templatehelper->standradnaming($rows->pekerjaan);
	$kejaksaan = $this->templatehelper->standradnaming($rows->kejaksaan);
}
//==============================================================================//
$Template = str_replace('#nomorpermohonan#',''.$nomorPermohonan.'',$Template);
$Template = str_replace('#namapanitera#',''.$namaPanitera.'',$Template);
$Template = str_replace('#namapn#',''.$namaPN.'',$Template);
$Template = str_replace('#jenisputusan#',''.$tahapan.'',$Template);
$Template = str_replace('#nomorputusan#',''.$noPerkaraTahapan.'',$Template);
$Template = str_replace('#tanggalputusan#',''.$tglPutusTahapan.'',$Template);
$Template = str_replace('#statuspanitera#',''.$statusPanitera.'',$Template);
$Template = str_replace('#tanggalkasasi#',''.$tglpermohonan_kasasi.'',$Template);
$Template = str_replace('#harikasasi#',''.$hariPermohonanKasasi.'',$Template);
$Template = str_replace('#namajaksa#',''.$namaJaksa.'',$Template);
$Template = str_replace('#nipjaksa#',''.$nipJaksa.'',$Template);
$Template = str_replace('#jabatan#',''.$pekerjaan.'',$Template);
$Template = str_replace('#kejaksaan#',''.$kejaksaan.'',$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=\"".$namafile."-".$nomorPerkara.".rtf\"");
echo $Template;
?>