<?php

class AppKuotaWaktuKuliahToAdmisi extends Database {

   protected $mSqlFile= 'module/kuota_waktu_kuliah/business/appkuotawaktukuliahtoadmisi.sql.php';
   
   function __construct($connectionNumber=0) {
      parent::__construct($connectionNumber);
      
   }
       
/******************* fungsi GetDataKuotaWaktuKuliah ***********************
mengambil data kuota waktu kuliah sesuai page
***************************************************************/
   function GetDataKuotaWaktuKuliah($thnAjaran,$semester,$prodi,$offset,$limit) {
      $return = $this->Open($this->mSqlQueries['get_data_kuota_waktu_kuliah'], array($thnAjaran,$semester,$prodi,$offset,$limit));
	  //print($this->GetLastError());
	  return $return;
   }

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

/******************* fungsi GetCountDataKuotaWaktuKuliah ***********************
jumlah data kuota waktu kuliah
**********************************************************************************/
   function GetCountDataKuotaWaktuKuliah($thnAjaran,$semester,$prodi) {
      $result = $this->Open($this->mSqlQueries['get_count_data_kuota_waktu_kuliah'], array($thnAjaran,$semester,$prodi));
	  //print($this->GetLastError());
      if (!$result) {
         return 0;
      } else {
         return $result[0]['total'];
      }
   }
   
/******************* fungsi GetIsExist ***********************
mengecek data keberadaan data di db
**********************************************************************************/
   function GetIsExist($thnAjaran,$semester,$prodi,$wktKul){
      $result=$this->Open($this->mSqlQueries['get_is_exist'],array($thnAjaran,$semester,$prodi,$wktKul));
      if (!$result) {
         return 0;
      } else {
         return $result;
      }
   }
   
/******************* fungsi DoAddKuotaWaktuKuliah ***********************
menambah data kuota waktu kuliah
***************************************************************/
   function DoAddKuotaWaktuKuliah($thnAjaran,$semester,$prodi,$sesiKul,$kuotaMax) {
      $result = $this->Execute($this->mSqlQueries['do_add_kuota_waktu_kuliah'], array($thnAjaran,$semester,$prodi,$sesiKul,$kuotaMax));
      //print($this->GetLastError());
      return $result;
   }
   
/******************* fungsi DoUpdateKuotaWaktuKuliah ***********************
update data kuota waktu kuliah
***************************************************************/
   function DoUpdateKuotaWaktuKuliah($thnAjaran,$semester,$prodi,$sesiKul,$kuotaMax,$id) {
      $result = $this->Execute($this->mSqlQueries['do_update_kuota_waktu_kuliah'], array($thnAjaran,$semester,$prodi,$sesiKul,$kuotaMax,$id));
      //print($this->GetLastError());
      return $result;
   }
   
/******************* fungsi DoDeleteWaktuKuliahById ***********************
menghapus data waktu kuliah 1 per 1
***************************************************************/
   function DoDeleteKuotaWaktuKuliahById($wktId) {
      $result=$this->Execute($this->mSqlQueries['do_delete_kuota_waktu_kuliah_by_id'], array($wktId));
      return $result;
   }

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