<?php

class AppGelombangToAdmisi extends Database {

   protected $mSqlFile= 'module/gelombang/business/appgelombangtoadmisi.sql.php';
   
   function __construct($connectionNumber=0) {
      parent::__construct($connectionNumber);
      
   }
      
   function GetDataGelombang($offset, $limit, $gelombang='') {
      return $this->Open($this->mSqlQueries['get_data_gelombang'], array('%'.$gelombang.'%', $offset, $limit));
   }

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

   function GetDataGelombangById($gelombangId) {
      $result = $this->Open($this->mSqlQueries['get_data_gelombang_by_id'], array($gelombangId));
      return $result;
   }

   function GetDataGelombangByArrayId($arrGelombangId) {
      $gelombangId = implode("', '", $arrGelombangId);
      $result = $this->Open($this->mSqlQueries['get_data_gelombang_by_array_id'], array($gelombangId));
      return $result;
   }
   
   function GetNamaGelombang () { //mengambil nama-nama gelombang
      $result = $this->Open($this->mSqlQueries['get_combo_gelombang'], array());                                                                                                              
      return $result;
   }
   /*
   function GetMaxIdGelombang(){
      $result=$this->Open($this->mSqlQueries['get_max_id_gelombang'],array());
      return $result;
   }*/
   
   function GetIsExist($kodeGelombang){
      $result=$this->Open($this->mSqlQueries['get_is_exist'],array($kodeGelombang));
      return $result[0]['total'];
   }
   
//===DO==
   
   function DoAddGelombang($gelombangId,$gelombangNama) {
      $result = $this->Execute($this->mSqlQueries['do_add_gelombang'], array($gelombangId,$gelombangNama));
      //print $this->GetLastError(); 
      return $result;
   }
   
   function DoUpdateGelombang($gelombangId,$gelombangNama, $oldId)  {
      $result = $this->Execute($this->mSqlQueries['do_update_gelombang'], array($gelombangId,$gelombangNama, $oldId));
            //print $this->GetLastError(); \
      //print_r($result);
      return $result;
      
   }
   
   function DoDeleteGelombangById($gelombangId) {
      $result=$this->Execute($this->mSqlQueries['do_delete_gelombang_by_id'], array($gelombangId));
      return $result;
   }

   function DoDeleteGelombangByArrayId($arrGelombangId) {
      $gelombangId = implode("', '", $arrGelombangId);
      $result=$this->Execute($this->mSqlQueries['do_delete_gelombang_by_array_id'], array($gelombangId));
      return $result;
   }
}
?>
