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

class ProcPenempatanAset
{
	var $_POST;
	var $Obj;
	var $pageView;
	var $pageInput;
	
	//css hanya dipake di view
	var $cssDone = "notebox-done";
	var $cssFail = "notebox-warning";

	var $return;

	function __construct() {
		$this->Obj = new AppInventarisasi();
		$this->_POST = $_POST->AsArray();
		$this->pageView = Dispatcher::Instance()->GetUrl('gedung', 'listRuang', 'view', 'html').'&lantaiId=' .$_GET['lantaiId'];
		$this->pageInput = Dispatcher::Instance()->GetUrl('gedung', 'listRuang', 'view', 'html').'&lantaiId=' .$_GET['lantaiId'];
   }
   
   function Check()
   {
   	if(count($this->_POST) == 0){
   		return false;
   	}
		return true;
   }
	
	function Add()
   {
      $check = $this->Check();
      if ($check !== true)
      {
         Messenger::Instance()->Send('gedung', 'listRuang', 'view', 'html', $this->msg, Messenger::NextRequest);
         return $check;
      }
      $get = $_GET->AsArray();
      $result = $this->Obj->UpdatePenempatanAset($this->_POST, $get['gedungId'], $get['ruangId'], $get['kampusId']);
      
      if ($result === 0)$msg = array(1=>'Penempatan Aset Berhasil Dilakukan.', $this->cssDone);
      else $msg = array(1=>'Proses Penempatan Aset Gagal!', $this->cssFail);
      Messenger::Instance()->Send('gedung', 'listRuang', 'view', 'html', $msg, Messenger::NextRequest);
      
      return $this->pageView;
   }
}
?>
