<?php
require_once GTFWConfiguration::GetValue( 'application', 'docroot') . 'module/status_keluarga/business/AppStatusKeluarga.class.php';

class ViewInputStatusKeluarga extends HtmlResponse {
   function TemplateModule() {
		$this->SetTemplateBasedir(GTFWConfiguration::GetValue( 'application', 'docroot').'module/status_keluarga/template');
		$this->SetTemplateFile('view_input_status_keluarga.html');
	}
   
   function ProcessRequest(){
      $staKlrgaObj = new AppStatusKeluarga();
      
      $idDec = Dispatcher::Instance()->Decrypt($_REQUEST['dataId']);
      $dataStsKlrga = $staKlrgaObj->GetDataStatusKeluargaById($idDec);      
      
      $msg = Messenger::Instance()->Receive(__FILE__);      
      $return['classWarning'] = $msg[0][1];
		$return['Pesan'] = $msg[0][0];
      
      $return['decDataId'] = $idDec;
		$return['dataStsKlrga'] = $dataStsKlrga;
      return $return;         
   }
   
   function ParseTemplate($data=NULL){
      $dataStsKlrga = $data['dataStsKlrga'];
      
      //filter tambah atau edit
      if ($_REQUEST['dataId']=='') {
			$url="addStatusKeluarga";
			$tambah="Tambah";
		} else {
			$url="updateStatusKeluarga";
			$tambah="Ubah";
		}
      
      if ($data['Pesan']) {
			$this->mrTemplate->SetAttribute('warning_box', 'visibility', 'visible');
         $this->mrTemplate->AddVar('warning_box', 'CLASS_WARNING', $data['classWarning']);
			$this->mrTemplate->AddVar('warning_box', 'ISI_PESAN', $data['Pesan']);
		}
      
      $this->mrTemplate->AddVar('content', 'JUDUL', $tambah);
      $this->mrTemplate->AddVar('content', 'STS_KLRGA_NAMA',empty($dataStsKlrga[0]['stsklrga_nama'])?$data['data']['stsklrga_nama']:$dataStsKlrga[0]['stsklrga_nama']);
		$this->mrTemplate->AddVar('content', 'URL_ACTION', Dispatcher::Instance()->GetUrl('status_keluarga', $url, 'do', 'html') . "&dataId=" . Dispatcher::Instance()->Encrypt($data['decDataId']));
		$this->mrTemplate->AddVar('content', 'DATAID', Dispatcher::Instance()->Decrypt($_GET['dataId']));
		$this->mrTemplate->AddVar('content', 'PAGE', Dispatcher::Instance()->Decrypt($_GET['page']));
   }
}
?>
