<?php
require_once GTFWConfiguration::GetValue( 'application', 'docroot') . 'module/propinsi/business/AppPropinsi.class.php';
require_once GTFWConfiguration::GetValue( 'application', 'docroot') . 'module/propinsi/business/AppPropinsiToSia.class.php';
class ViewImportPropinsi extends HtmlResponse{

	function TemplateModule() {
		$this->SetTemplateBasedir(GTFWConfiguration::GetValue( 'application', 'docroot') . 'module/propinsi/template');
		$this->SetTemplateFile('import_propinsi.html');
	}

   function ProcessRequest() {
		$propObj = new AppPropinsi();
		$propObjToSia = new AppPropinsiToSia();
      
      if(!$propObjToSia->addConn)
         $return['siaConn']=false;
      else
         $return['siaConn']=true;
         
      $msg = Messenger::Instance()->Receive(__FILE__);
      		
      $return['Pesan']=$msg[0][1];
      $return['Data']=$msg[0][0];
      
		return $return;
	}

   function ParseTemplate($data = NULL) {
      $siaConn=$data['siaConn'];
      
      if($siaConn==false){
      	$this->mrTemplate->AddVar('status_koneksi', 'BERHASIL', 'NO');
			$this->mrTemplate->AddVar('warning', 'ISI_PESAN_SIA', 'Gagal Menghubungi SI Akademik');
         $url_kembali=Dispatcher::Instance()->GetUrl('propinsi', 'propinsi', 'view', 'html');
         $this->mrTemplate->AddVar('warning', 'URL_KEMBALI_SIA',$url_kembali );
      }elseif($siaConn==true){
         $this->mrTemplate->AddVar('status_koneksi', 'BERHASIL', 'YES');
      }
      
		if ($data['Pesan']) {
         $this->mrTemplate->SetAttribute('warning_box', 'visibility', 'visible');
         $this->mrTemplate->AddVar('warning_box', 'ISI_PESAN', $data['Pesan']);
      }
        
      $this->mrTemplate->AddVar('status_koneksi', 'URL_ACTION', Dispatcher::Instance()->GetUrl('propinsi', 'importFileDbfPropinsi', 'do', 'html') );
	}
}
?>
