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

class ViewInputSettingKtm extends HtmlResponse {
	
	function TemplateModule() {
		$this->SetTemplateBasedir(GTFWConfiguration::GetValue( 'application', 'docroot') . 'module/setting_ktm/template');
		$this->SetTemplateFile('input_setting_ktm.html');
	}
	
	function ProcessRequest() {
		$idDec = Dispatcher::Instance()->Decrypt($_REQUEST['dataId']);
		$sktmObj = new AppSettingKtm();
		
		$msg = Messenger::Instance()->Receive(__FILE__);
		$return['Pesan'] = $msg[0][1];
		$return['Data'] = $msg[0][0];

		$dataSettingKtm = $sktmObj->GetDataSettingKtmById($idDec);
      
		$return['decDataId'] = $idDec;
		$return['dataSettingKtm'] = $dataSettingKtm;
		return $return;
	}

	function ParseTemplate($data = NULL) {
      
      
		if ($data['Pesan']) {
			$this->mrTemplate->SetAttribute('warning_box', 'visibility', 'visible');
			$this->mrTemplate->AddVar('warning_box', 'ISI_PESAN', $data['Pesan']);
		}
		$dataSettingKtm = $data['dataSettingKtm'];
      //print_r ($dataSettingKtm);
		if ($_REQUEST['dataId']=='') {
			$url="addSettingKtm";
			$tambah="Tambah";
		} else {
			$url="updateSettingKtm";
			$tambah="Ubah";
		}
		
		$this->mrTemplate->AddVar('content', 'JUDUL', $tambah);
      $this->mrTemplate->AddVar('content', 'JUDUL_PEJABAT', $data['dataSettingKtm'][0]['judul']);
      $this->mrTemplate->AddVar('content', 'JABATAN', $data['dataSettingKtm'][0]['jabatan']);
      $this->mrTemplate->AddVar('content', 'NAMA_PEJABAT', $data['dataSettingKtm'][0]['nama_pejabat']);
      $this->mrTemplate->AddVar('content', 'NIP_PEJABAT', $data['dataSettingKtm'][0]['nip_pejabat']);
      $this->mrTemplate->AddVar('content', 'URL_ACTION', Dispatcher::Instance()->GetUrl('setting_ktm', $url, 'do', 'html') . "&dataId=" . Dispatcher::Instance()->Encrypt($data['decDataId']));
		$this->mrTemplate->AddVar('content', 'URL_RETURN',Dispatcher::Instance()->GetUrl('setting_ktm', 'setting_ktm', 'view', 'html'));
      $this->mrTemplate->AddVar('content', 'DATAID', Dispatcher::Instance()->Decrypt($_GET['dataId']));
		$this->mrTemplate->AddVar('content', 'PAGE', Dispatcher::Instance()->Decrypt($_GET['page']));
	}
}
?>
