<?php
class AppValidasi extends Database {

	protected $mSqlFile= 'module/validasi/business/appvalidasi.sql.php';

	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
	function GetCountDataMahasiswa($prodi,$notes_nim,$notes_nim,$nama,$status_reg,$status_mhs,$status_byr){
      $result =$this->Open($this->mSqlQueries['get_count_data_mahasiswa'],array('%'.$prodi.'%','%'.$nama.'%','%'.$status_reg.'%','%'.$status_mhs.'%','%'.$status_byr.'%','%'.$notes_nim.'%','%'.$notes_nim.'%'));
		#print($this->GetLastError());
	   if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
   }
   
   function GetDataMahasiswa($prodi,$notes_nim,$notes_nim,$nama,$status_reg,$status_mhs,$status_byr,$offset,$limit){
      $result = $this->Open($this->mSqlQueries['get_data_mahasiswa'],array('%'.$prodi.'%','%'.$nama.'%','%'.$status_reg.'%','%'.$status_mhs.'%','%'.$status_byr.'%','%'.$notes_nim.'%','%'.$notes_nim.'%',$offset,$limit));
      #print($this->GetLastError());
      return $result;
   }
   function GetMahasiswa(){
      $result=$this->Open($this->mSqlQueries['get_mahasiswa'],array());
      return $result;
   }
   function GetPeriodeAktif(){
      $result=$this->Open($this->mSqlQueries['get_periode_aktif'],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 GetDataPeriode(){
      $result=$this->Open($this->mSqlQueries['get_data_periode'], array());
      return $result;
   }
   function GetNamaPeriode($id){
      $result=$this->Open($this->mSqlQueries['get_nama_periode'], array($id));
      return $result;
   }
   function GetDataPeriodeById($idPrd){
      $result=$this->Open($this->mSqlQueries['get_data_periode_by_id'], array($idPrd));
      return $result;
   }
   function GetDataProgramStudi(){
      $result=$this->Open($this->mSqlQueries['get_data_program_studi'], array());
      return $result;
   }
   
   function GetStatusRegistrasi(){
      $dataStatusReg[0]['id']="S";
      $dataStatusReg[0]['name']="Sudah";
      $dataStatusReg[1]['id']="B";
      $dataStatusReg[1]['name']="Belum";      
      return $dataStatusReg;
   }
   
   function GetStatusMahasiswa(){
      $dataStatusMhs[0]['id']="0";
      $dataStatusMhs[0]['name']="Mahasiswa";
      $dataStatusMhs[1]['id']="1";
      $dataStatusMhs[1]['name']="Calon Mahasiswa";      
      return $dataStatusMhs;
   }
   
   //combo status bayar
   function GetStatusBayar(){
      $statusBayar[0]['id']="BB";
      $statusBayar[0]['name']="Belum Bayar";
      $statusBayar[1]['id']="BL";
      $statusBayar[1]['name']="Belum Lunas";
      $statusBayar[2]['id']="LN";
      $statusBayar[2]['name']="Lunas";
      return $statusBayar;
   }
   
//===DO===
   function DoAddPassword($new_password,$id){
      $result=$this->Execute($this->mSqlQueries['do_add_password'],array($new_password,$id));
     # print($this->getLastError());
      return $result;
   }
}
?>
