<?php
class AppRegistrasi extends Database {
   
	protected $mSqlFile= 'module/registrasi/business/appregistrasi.sql.php';

	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}

	function GetCountRegistrasiMahasiswa($tahun,$periode,$prodi,$nama,$notes_nim,$notes_nim,$status){       
      $result =$this->Open($this->mSqlQueries['get_count_registrasi_mahasiswa'], array('%'.$tahun.'%','%'.$periode.'%','%'.$prodi.'%','%'.$nama.'%','%'.$status.'%','%'.$notes_nim.'%','%'.$notes_nim.'%'));
      #print($this->GetLastError());
	   if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
   }
   
   function GetDataRegistrasiMahasiswa($tahun,$periode,$prodi,$nama,$notes_nim,$notes_nim,$status,$offset,$limit){      
      $result =$this->Open($this->mSqlQueries['get_registrasi_mahasiswa'], array('%'.$tahun.'%','%'.$periode.'%','%'.$prodi.'%','%'.$nama.'%','%'.$status.'%','%'.$notes_nim.'%','%'.$notes_nim.'%',$offset,$limit));
      #print($this->GetLastError());
      return $result;
   }
   
   function GetDataMahasiswa($mhsId){
      $result=$this->Open($this->mSqlQueries['get_data_mahasiswa'],array($mhsId));
      return $result;
   }
   
   function GetDetailRegistrasi($mhsId,$mhsId,$mhsId){
      $result=$this->Open($this->mSqlQueries['get_detail_registrasi'],array($mhsId,$mhsId,$mhsId));
      #print($this->GetLastError());
      return $result;
   }
   
   function GetDataTahun(){
      $result=$this->Open($this->mSqlQueries['get_data_tahun'],array());
      return $result;
   }
   
   function GetPeriodeAktif(){
      $result=$this->Open($this->mSqlQueries['get_periode_aktif'],array());
      return $result;
   }
   
   function GetNamaPeriode(){
      $result=$this->Open($this->mSqlQueries['get_nama_periode'],array());
      return $result;
   }
   
   function GetDataPeriode(){
      $result=$this->Open($this->mSqlQueries['get_data_periode'], array());
      return $result;
   }
   
   function GetDataProdi(){
      $result=$this->Open($this->mSqlQueries['get_data_prodi'], array());
      return $result;
   }
   
   function GetDataProdiById($idProdi){
      $result=$this->Open($this->mSqlQueries['get_data_prodi_by_id'], array($idProdi));
      return $result;
   }
   
   function GetStatusRegistrasi(){
      $dataStatus[0]['id']="S";
      $dataStatus[0]['name']="Sudah";
      $dataStatus[1]['id']="B";
      $dataStatus[1]['name']="Belum";      
      return $dataStatus;
   }
   
//===DO===
   function DoDeleteMahasiswaRegistrasi($mhsId){
      $result=$this->Execute($this->mSqlQueries['do_delete_mahasiswa_registrasi'], array($mhsId));
      return $result;
   }
}
?>
