<?php

class UserUnitKerja extends Database {

   protected $mSqlFile= 'module/user_unit_kerja/business/userunitkerja.sql.php';
   
   function __construct($connectionNumber=0) {
      parent::__construct($connectionNumber);       
   }
   
   function InsertUserUnitKerja($params){
      return $this->Execute($this->mSqlQueries['insert_user_unit_kerja'], $params);
   }


   function GetRoleUser($userId) {
      $ret = $this->Open($this->mSqlQueries['get_role_user'], array($userId));
	  return $ret[0];
   }

   function GetUnitKerjaUser($userId) {
      $ret = $this->Open($this->mSqlQueries['get_unit_kerja_user'], array($userId));
	  if($ret[0]['is_unit_kerja'] == '0')
	     $ret[0]['is_unit_kerja'] = true;
	  else
	     $ret[0]['is_unit_kerja'] = false;
		
	  return $ret[0];
   }

   function GetSatkerUnitKerjaUser($userId) {
      $ret = $this->Open($this->mSqlQueries['get_satker_unit_kerja_user'], array($userId));
	  if($ret[0]['is_unit_kerja'] == '0')
	     $ret[0]['is_unit_kerja'] = true;
	  else
	     $ret[0]['is_unit_kerja'] = false;
		
	  return $ret[0];
   }
   function GetSatkerUnitKerjaUserDua($userId) {
      $ret = $this->Open($this->mSqlQueries['get_satker_unit_kerja_user_dua'], array($userId));
	  if($ret[0]['is_unit_kerja'] == '0')
	     $ret[0]['is_unit_kerja'] = true;
	  else
	     $ret[0]['is_unit_kerja'] = false;
		
	  return $ret[0];
   }

   function GetSatkerUnitKerja($unitkerjaId) {
      $ret = $this->Open($this->mSqlQueries['get_satker_unit_kerja'], array($unitkerjaId));
	  
	  if($ret[0]['is_unit_kerja'] == '0')
	     $ret[0]['is_unit_kerja'] = true;
	  else
	     $ret[0]['is_unit_kerja'] = false;
	  	
	  return $ret[0];
   }

   function UpdateUserUnitKerjaByUserId($params){
      return $this->Execute($this->mSqlQueries['update_user_unit_kerja_by_user_id'], $params);
   }
}
?>
