<?php

class AppJurusanSmta extends Database {

	protected $mSqlFile= 'module/jurusan_smta/business/appjurusansmta.sql.php';
	
	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
		
	function GetDataJurusanSmta($offset, $limit, $jurusanNama) {
	
  $result =$this->Open($this->mSqlQueries['get_data_jurusan_smta'], array('%'.$jurusanNama.'%', $offset, $limit));
	return $result;
  //print_r ($result);
  }
  
  function GetLastKodeJurusanSmta( ){
    $result=$this->Open($this->mSqlQueries['get_last_kode_jurusan_smta'], array());
    return $result;
  }

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

	function GetDataJurusanSmtaById($jurusanKode) {
		$result = $this->Open($this->mSqlQueries['get_data_jurusan_smta_by_id'], array($jurusanKode));
		return $result;
	}

	function GetDataSmtaByArrayId($arrJurusanKode) {
		$jurusanKode= implode("', '", $arrJurusanKode);
		$result = $this->Open($this->mSqlQueries['get_data_jurusan_smta_by_array_id'], array($jurusanKode));
		return $result;
	}

//===DO==
	
	function DoAddJurusanSmta($kodeJurusanSmta,$namaJurusanSmta) {
		$result = $this->Execute($this->mSqlQueries['do_add_jurusan_smta'], array($kodeJurusanSmta,$namaJurusanSmta));
      return $result;
	}
	
	function DoUpdateJurusanSmta($kodeJurusanSmta, $namaJurusanSmta,$idJurusan) {
		$result = $this->Execute($this->mSqlQueries['do_update_jurusan_smta'], array($kodeJurusanSmta, $namaJurusanSmta,$idJurusan));
		return $result;
	}
	
	function DoDeleteJurusanSmtaById($kodeJurusan) {
		$result=$this->Execute($this->mSqlQueries['do_delete_jurusan_smta_by_id'], array($kodeJurusan));
		return $result;
	}

	function DoDeleteJurusanSmtaByArrayId($arrJurusanKode) {
		$kodeJurusan = implode("', '", $arrJurusanKode);
		$result=$this->Execute($this->mSqlQueries['do_delete_smta_jurusan_by_array_id'], array($kodeJurusan));
		//print $this->GetLastError();
    return $result;
	}
}
?>
