<?php

class AppStatusNikah extends Database {

	protected $mSqlFile= 'module/status_nikah/business/appstatusnikah.sql.php';
	
	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
		
	function GetDataStatusNikah($offset, $limit, $status_nikah='') {
		return $this->Open($this->mSqlQueries['get_data_status_nikah'], array('%'.$status_nikah.'%', $offset, $limit));
	}
	
	function GetIdStatusNikah() {
		return $this->Open($this->mSqlQueries['get_id_status_nikah'], array());
	}

	function GetCountDataStatusNikah($status_nikah) {
		$result = $this->Open($this->mSqlQueries['get_count_data_status_nikah'], array('%'.$status_nikah.'%'));
		if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
	}

	function GetDataStatusNikahById($stnkrId) {
		$result = $this->Open($this->mSqlQueries['get_data_status_nikah_by_id'], array($stnkrId));
		return $result;
	}

	function GetDataStatusNikahByArrayId($arrStnkrId) {
		$stnkrId = implode("', '", $arrStnkrId);
		$result = $this->Open($this->mSqlQueries['get_data_status_nikah_by_array_id'], array($stnkrId));
		return $result;
	}

//===DO==
	
	function DoAddStatusNikah($stnkrNama) {
		$result = $this->Execute($this->mSqlQueries['do_add_status_nikah'], array($stnkrNama));
		return $result;
	}
	
	function DoUpdateStatusNikah($stnkrNama, $stnkrId) {
		$result = $this->Execute($this->mSqlQueries['do_update_status_nikah'], array($stnkrNama, $stnkrId));
	  //$debug = sprintf($this->mSqlQueries['do_update_status_nikah'], $agamaKode, $agamaNama, $tipeunit, $satker, $agamaId);
	  //echo $debug;
		return $result;
	}
	
	function DoDeleteStatusNikahById($stnkrId) {
		$result=$this->Execute($this->mSqlQueries['do_delete_status_nikah_by_id'], array($stnkrId));
		return $result;
	}

	function DoDeleteStatusNikahByArrayId($arrStnkrId) {
		$stnkrId = implode("', '", $arrStnkrId);
		$result=$this->Execute($this->mSqlQueries['do_delete_status_nikah_by_array_id'], array($stnkrId));
		return $result;
	}
}
?>
