<?php
/******************* class AppWaktuKuliah ***********************
created by moe_zhank@20100212
mempunyai method2 untuk manipulasi data waktu kuliah
semua data berada di SIA
***********************************************************/

class AppWaktuKuliahToSia extends Database {

   protected $mSqlFile= 'module/waktu_kuliah/business/appwaktukuliahtosia.sql.php';
   
   function __construct($connectionNumber=1) {
      parent::__construct($connectionNumber);
            
   }
 
/******************* fungsi GetDataWaktuKuliah ***********************
mengambil seluruh data waktu kuliah tanpa paging karena data terbatas
***************************************************************/
   function GetDataWaktuKuliah() {
      return $this->Open($this->mSqlQueries['get_data_waktu_kuliah'], array());
   }


/******************* fungsi GetDataWaktuKuliahGetDataWaktuKuliahById ***********************
mengambil data waktu kuliah sesuai id
**********************************************************************************/
   function GetDataWaktuKuliahById($id) {
      if(empty($id) or !isset($id)) return false;
      return $this->Open($this->mSqlQueries['get_data_waktu_kuliah_by_id'], array($id));
   }

/******************* fungsi DoAddWaktuKuliah ***********************
menambah data waktu kuliah
***************************************************************/
   function DoAddWaktuKuliah($wktNama,$wktKeterangan) {
      $maxId = $this->Open($this->mSqlQueries['get_max_id_waktu_kuliah'], array());
      $result = $this->Execute($this->mSqlQueries['do_add_waktu_kuliah'], array(($maxId[0]['ID']+1), $wktNama,$wktKeterangan));
      //print($this->GetLastError());
      return $result;
   }
   
/******************* fungsi DoUpdateWaktuKuliah ***********************
update data waktu kuliah
***************************************************************/
   function DoUpdateWaktuKuliah($wktId,$wktNama, $wktKeterangan) {
      $result = $this->Execute($this->mSqlQueries['do_update_waktu_kuliah'], array($wktNama, $wktKeterangan, $wktId));
      //print($this->GetLastError());
      return $result;
   }
   
/******************* fungsi DoDeleteWaktuKuliahById ***********************
menghapus data waktu kuliah 1 per 1
***************************************************************/
   function DoDeleteWaktuKuliahById($wktId) {
      $result=$this->Execute($this->mSqlQueries['do_delete_waktu_kuliah_by_id'], array($wktId));
      return $result;
   }

/******************* fungsi DoDeleteWaktuKuliahByArrayId ***********************
menghapus sekumpulan data waktu kuliah
***************************************************************/
   function DoDeleteWaktuKuliahByArrayId($arrWktId) {
      $wktId = implode("', '", $arrWktId);
      $result=$this->Execute($this->mSqlQueries['do_delete_waktu_kuliah_by_array_id'], array($wktId));
      return $result;
   }

/******************* fungsi GetIsExist ***********************
cek data di db
**********************************************************************************/
   function GetIsExist($wktNama) {
      $result = $this->Open($this->mSqlQueries['get_data_waktu_kuliah_by_nama'], array($wktNama));
      if(empty($result) or empty($wktNama) or !isset($wktNama)) return 0;
	  else return true;
   }   
}
?>
