<?php
class PopUpLokasiAset extends Database
{

	protected $mSqlFile= 'module/inventarisasi_detail/business/PopUpLokasiAset.sql.php';
	
	function __construct($connectionNumber=0)
   {
		parent::__construct($connectionNumber);
	}
	
	function GetDataUserByUsername ($name)
   {
      if (isset($this->mUserByUserName[$name])) return $this->mUserByUserName[$name];
      $result = $this->Open($this->mSqlQueries['get_data_user_by_user_name'], array($name));  
      $this->mUserByUserName[$name] = $result[0];
      
		return $result[0];
   }
	
	function GetCountData ($gedungKode, $ruangKode, $nama)
   {
		$User = $this->GetDataUserByUsername($_SESSION['username']);
		$user1 = $User['unitkerjaId']; 
		$user2 = $User['unitkerjaId']; 
		$user3 = $User['role_id'];
		$result = $this->Open($this->mSqlQueries['get_count_data'], array("%$gedungKode%", "%$ruangKode%", "%$nama%", "%$nama%", $user1, $user2, $user3));
      return $result[0]['total'];
	}
   
   function GetData ($gedungKode, $ruangKode, $nama, $offset, $limit)
   {
		$User = $this->GetDataUserByUsername($_SESSION['username']);
		$user1 = $User['unitkerjaId']; 
		$user2 = $User['unitkerjaId']; 
		$user3 = $User['role_id'];
		$result = $this->Open($this->mSqlQueries['get_data'], array("%$gedungKode%", "%$ruangKode%", "%$nama%", "%$nama%", $user1, $user2, $user3, $offset, $limit));
		
		return $result;
	}
}
?>
