<?php
require_once GTFWConfiguration::GetValue( 'application', 'docroot').'module/gedung/business/AppGedung.class.php';
require_once GTFWConfiguration::GetValue( 'application', 'docroot').'module/gedung/business/Ruang.class.php';

//set Label for module
require_once GTFWConfiguration::GetValue( 'application', 'docroot') .'module/label/response/Label.proc.class.php';

class PopUpFotoGedung extends HtmlResponse
{
	function TemplateBase()
   {
      if (isset($_GET['popup']))
      {
         $this->SetTemplateBasedir(GTFWConfiguration::GetValue('application', 'docroot') . 'main/template/');
         $this->SetTemplateFile('document-common-popup.html');
         $this->SetTemplateFile('layout-common-popup.html');
         return;
      }
      parent::TemplateBase();
   }
   
   function TemplateModule()
   {
      $this->SetTemplateBasedir(GTFWConfiguration::GetValue('application','docroot').'module/gedung/template');
      $this->SetTemplateFile('view_popup_foto_gedung.html');
   }
   
	function ProcessRequest(){
      	if(isset($_GET['gId'])){
			$Obj = new AppGedung;
			$id = $_GET['gId'];
      		$detail = $Obj->GetGedungById($id);
      		$detail['pid'] = '1';
      	}elseif(isset($_GET['id'])){
      		$Obj = new Ruang();
      		$detail = $Obj->GetDataRuangById($_GET['id']);
      		$detail['gd_nama'] = $detail['nama'];
      		$detail['gd_foto'] = $detail['oldFoto'];
      		$detail['pid'] = '2';
      	}
		return $detail;
	}
	
	function ParseTemplate($data = NULL)
   {
		//$this->mrTemplate->AddVar('content', 'URL_IMG', 'images/gedung/'.$data['gd_foto']);
		$this->mrTemplate->AddVar('content', 'URL_IMG', Dispatcher::Instance()->GetUrl('download', 'ReadFile', 'view', 'html').'&pid='.$data['pid'].'&file='.$data['gd_foto']);
		$this->mrTemplate->AddVar('content', 'ASET_NAMA', $data['gd_nama']);
		$this->mrTemplate->parseTemplate('content', '');
	}
}
?>
