<?php
require_once GTFWConfiguration::GetValue('application', 'docroot').'module/kdp_ref_jenis_kdp/response/ProcessJenisKdp.proc.class.php';

class ViewUpdateJenisKdp extends HtmlResponse {

   function TemplateModule() {
      $this->SetTemplateBasedir(GTFWConfiguration::GetValue('application', 'docroot') .
         'module/kdp_ref_jenis_kdp/template');
      $this->SetTemplateFile('view_input_jenis_kdp.html');
   }

   function ProcessRequest() {
   	  $proc = new ProcessJenisKdp();
	  $obj = $proc->Obj;
	  
      $msg = Messenger::Instance()->Receive(__FILE__);
	  //print_r($msg);
	  $data2['KODE_JENIS'] = $msg[0][0]['kode_jenis']; 
	  $data2['NAMA_JENIS'] = $msg[0][0]['nama_jenis'];
	  
	  $data['ACTION_NAME'] = "Edit Jenis KDP";
	  $data['pesan'] = $msg[0][1];
	  $data['css'] = $msg[0][2];
	  $data['jenis'][0] = $data2;
	  
	  if($msg == NULL){
	     $id = Dispatcher::Instance()->Decrypt($_GET['id']->Raw());	
		 $data['jenis'] = $obj->GetDataById($id);
	  }
			
	  return $data;
   }

   function ParseTemplate($data = NULL) {
      if($data['pesan']) {
         $this->mrTemplate->SetAttribute('warning-box', 'visibility', 'visible');
         $this->mrTemplate->AddVar('warning-box', 'ISI_PESAN', $data['pesan']);
         $this->mrTemplate->AddVar('warning-box', 'CLASS_PESAN', $data['css']);
		}
		
	  foreach($data['jenis'] as $key => $value){}
	  
	  $this->mrTemplate->AddVar('content','KODE_JENIS_ASLI',$value['KODE_JENIS']);//id untuk update
	  $this->mrTemplate->AddVar('content','ACTION_NAME',$data['ACTION_NAME']);
	  $this->mrTemplate->AddVars('content',$value);
      $this->mrTemplate->AddVar('content','URL_ACTION',Dispatcher::Instance()->GetUrl('kdp_ref_jenis_kdp','UpdateJenisKdp','do','json'));
	  
   }
}

?>
