<?php

class AppJenisSmta extends Database {

   protected $mSqlFile= 'module/jenis_smta/business/appjenissmta.sql.php';
   
   function __construct($connectionNumber=0) {
      parent::__construct($connectionNumber);
      
   }
      
   function GetDataJenisSmta($offset, $limit, $jenis_smta='') {
      return $this->Open($this->mSqlQueries['get_data_jenis_smta'], array('%'.$jenis_smta.'%', $offset, $limit));
   }
   
   function GetIdJenisSmta() {
      return $this->Open($this->mSqlQueries['get_id_jenis_smta'], array());
   }
   
   function GetCountDataJenisSmta($jenis_smta) {
      $result = $this->Open($this->mSqlQueries['get_count_data_jenis_smta'], array('%'.$jenis_smta.'%'));
      if (!$result) {
         return 0;
      } else {
         return $result[0]['total'];
      }
   }

   function GetDataJenisSmtaById($idJenisSmta) {
      $result = $this->Open($this->mSqlQueries['get_data_jenis_smta_by_id'], array($idJenisSmta));
      return $result;
   }

   function GetDataJenisSmtaByArrayId($arrIdJenisSmta) {
      $IdJenisSmta = implode("', '", $arrIdJenisSmta);
      $result = $this->Open($this->mSqlQueries['get_data_jenis_smta_by_array_id'], array($idJenisSmta));
      return $result;
   }

//===DO==
   
   function DoAddJenisSmta($jenisSmta,$status) {
      $result = $this->Execute($this->mSqlQueries['do_add_jenis_smta'], array($jenisSmta,$status));
     // print ('from admisi <br>'.$this->GetLastError());exit;
      return $result;
   }
   
   function DoUpdateJenisSmta($jenisSmta,$status, $idJenisSmta) {
      $result = $this->Execute($this->mSqlQueries['do_update_jenis_smta'], array($jenisSmta,$status,$idJenisSmta));
      return $result;
   }
   
   function DoDeleteJenisSmtaById($idJenisSmta) {
      $result=$this->Execute($this->mSqlQueries['do_delete_jenis_smta_by_id'], array($idJenisSmta));
      return $result;
   }

   function DoDeleteJenisSmtaByArrayId($arrIdJenisSmta) {
      $idJenisSmta = implode("', '", $arrIdJenisSmta);
      $result=$this->Execute($this->mSqlQueries['do_delete_jenis_smta_by_array_id'], array($idJenisSmta));
      return $result;
   }
}
?>
