<?php

class AppSettingKtm extends Database {

	protected $mSqlFile= 'module/setting_ktm/business/appsettingktm.sql.php';
	
	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		//
	}
		
	function GetDataSettingKtm($offset, $limit) {
		$result=$this->Open($this->mSqlQueries['get_data_setting_ktm'], array($offset, $limit));
      return $result;
	}

	function GetCountDataSettingKtm() {
		$result = $this->Open($this->mSqlQueries['get_count_data_setting_ktm'], array());
		if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
	}

	function GetDataSettingKtmById($settingKtmId) {
		$result = $this->Open($this->mSqlQueries['get_data_setting_ktm_by_id'], array($settingKtmId));
		return $result;
	}

	function GetDataSettingKtmByArrayId($arrsettingKtmId) {
		$settingKtmId = implode("', '", $arrsettingKtmId);
		$result = $this->Open($this->mSqlQueries['get_data_setting_ktm_by_array_id'], array($settingKtmId));
		return $result;
	}
	
	
	function GetSettingKtmAktif(){
      $result=$this->Open($this->mSqlQueries['get_setting_ktm_aktif'],array());
      return $result;
   }
   
	
//===DO==
	
	function DoAddSettingKtm($settingKtmPejabat,$settingKtmNamaPejabat,$settingKtmNipPejabat,$settingKtmIsAktif) {
		$result = $this->Execute($this->mSqlQueries['do_add_setting_ktm'], array($settingKtmPejabat,
                                                                               $settingKtmNamaPejabat,
                                                                               $settingKtmNipPejabat,
                                                                               $settingKtmIsAktif));
		//print_r($this->GetLastError());exit;
      return $result;
	}
	
	function DoUpdateSettingKtm($settingKtmPejabat,$settingKtmNamaPejabat,$settingKtmNipPejabat, $Id) {
		$result = $this->Execute($this->mSqlQueries['do_update_setting_ktm'], array($settingKtmPejabat,
                                                                                  $settingKtmNamaPejabat,
                                                                                  $settingKtmNipPejabat, 
                                                                                  $Id));
		return $result;
	}
	
	function DoUpdateTandaTangan($nama_file,$idk){
      for ($i=0;$i<sizeof($arrData);$i++){
         if($arrData[$i]==''){
            $arrData[$i]=NULL;
         }
      }
      $result = $this->Execute($this->mSqlQueries['update_tanda_tangan'],array($nama_file,$idk));
      //print_r($this->getLastError());exit;  
      return $result; 
   }
	
	function DoNonAktifSettingKtm($prdIsAktif){
		$result = $this->Execute($this->mSqlQueries['do_non_aktif_setting_ktm'], array($prdIsAktif));
      return $result;
   }
	
	function DoAktifSettingKtm($id){
      $result = $this->Execute($this->mSqlQueries['do_aktif_setting_ktm'], array($id));
      return $result;
   }
   
	function DoDeleteSettingKtmById($prdId) {
		$result=$this->Execute($this->mSqlQueries['do_delete_setting_ktm_by_id'], array($prdId));
		return $result;
	}

	function DoDeleteSettingKtmByArrayId($arrPrdId) {
		$prdId = implode("', '", $arrPrdId);
		$result=$this->Execute($this->mSqlQueries['do_delete_setting_ktm_by_array_id'], array($prdId));
		return $result;
	}
}
?>
