<?php
require_once GTFWConfiguration::GetValue( 'application', 'docroot').'module/'.Dispatcher::Instance()->mModule.'/business/AppInventarisasi.class.php';

class ViewPopupFoto extends HtmlResponse {
   
   function TemplateModule()
   {
      $this->SetTemplateBasedir(GTFWConfiguration::GetValue('application','docroot').
         'module/'.Dispatcher::Instance()->mModule.'/template');
      $this->SetTemplateFile('popup_foto.html');
   }
	
	function ProcessRequest() {
		$obj = new AppInventarisasi();
		$get = $_GET->AsArray();
		if ($get['id'] <> ''){
			$inv = $obj->GetInventarisasiById($get['id']);
			$return['link_foto'] = (!empty($inv['invDetNamaFile'])) ? Dispatcher::Instance()->GetUrl('download', 'ReadFile', 'view', 'html').'&pid=3&file='.$inv['invDetNamaFile'] : '';
			$return['nama_aset'] = $inv['invKodeAset'].' - '.$inv['invMstLabel'];
		}
		return $return;
	}
   
	function ParseTemplate($data = NULL)
   {
		if($data['link_foto'] <> ''){
			$this->mrTemplate->AddVar('content', 'LINK_FOTO', $data['link_foto']);
			$this->mrTemplate->AddVar('content', 'NAMA_ASET', $data['nama_aset']);
		}else{
			$this->mrTemplate->AddVar('content', 'WARNING', 'Foto tidak ditemukan');
		}
	}
}
?>
