<?php
/*
 @ClassName : View Input Mutasi Barang
 @Copyright : PT Gamatechno Indonesia
 @Analyzed By : Nanang Ruswianto <nanang@gamatechno.com>
 @Designed By : Rosyid <rosyid@gamatechno.com>
 @Author By : Dyan Galih <galih@gamatechno.com>
 @Version : 1.0
 @StartDate : Des 18, 2008
 @LastUpdate : Des 18, 2008
 @Description :
*/
require_once GTFWConfiguration::GetValue( 'application', 'docroot').
   'module/mutasi_barang/business/AppMutasi.class.php';

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

class ViewDetailMutasiBarang extends HtmlResponse
{
	
	function TemplateLabeling(){
      $ObjLabel = new GetModuleLabel();
      $arrLabel = $ObjLabel->GetLabel();
      
      //patTemplate name yang memiliki label2 dinamic
      $arrContent=array("content");
      
      for($i=0;$i<count($arrContent);$i++){
         for($j=0;$j<count($arrLabel);$j++){
            $this->mrTemplate->AddVar($arrContent[$i],$arrLabel[$j]['labelCode'],$arrLabel[$j]['labelName']);
         }
      }
   }
	
   function TemplateModule()
   {
      $this->SetTemplateBasedir(GTFWConfiguration::GetValue('application','docroot').
         'module/mutasi_barang/template');
      $this->SetTemplateFile('detail_mutasi_barang.html');
   }
   
   function ProcessRequest()
   {
   	
   	$msg = Messenger::Instance()->Receive(__FILE__);
		$return['pesan'] = $msg[0][0];
		$return['css_pesan'] = $msg[0][1];
		
   	$obj = new AppMutasiBarang();
   	
   	$arrGet = $_GET->AsArray();
   	
   	$return['detailMutasi'] = $obj->GetMutasiDetail($arrGet['mutasiId']);
      return $return;
   }
   
   
	function ParseTemplate($data = NULL)
   {
   	
   	$this->TemplateLabeling();
   	$gridList = $data['detailMutasi'];
   	
   	if(empty($gridList)){
      	$this->mrTemplate->AddVar('data','DATA_EMPTY','YES');      	
      	return;
		}else
			$this->mrTemplate->AddVar('data','DATA_EMPTY','NO');
			
		for($i=0;$i<count($gridList);$i++){
			$this->mrTemplate->AddVars('data_item',$gridList[$i],'MUTASI_');
			$this->mrTemplate->parseTemplate('data_item','a');
		}
   	$gridList[0]['file'] = "images/mutasi/".$gridList[0]['file'];
   	$urlKembali = Dispatcher::Instance()->GetUrl('mutasi_barang', 'mutasiBarang', 'view', 'html');
   	$this->mrTemplate->addVar('content','URL_KEMBALI',$urlKembali);
   	$this->mrTemplate->addVars('content',$gridList[0],'');
   }
}
?>
