<?php
class AppProgramStudiToAdmisi extends Database {
	protected $mSqlFile= 'module/program_studi/business/appprogramstuditoadmisi.sql.php';
	
   function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}  
   function GetCountDataProgramStudi($kodeProdi,$kodeProdiUniv,$namaProdi,$jenjangAkademik,$ekstakta,$model,$jurusan)
   {
      $result=$this->Open($this->mSqlQueries['get_count_data_program_studi'],array('%'.$kodeProdi.'%','%'.$kodeProdiUniv.'%','%'.$namaProdi.'%','%'.$jenjangAkademik.'%','%'.$ekstakta.'%','%'.$model.'%','%'.$jurusan.'%'));
      if(!$result){
         return 0;
      }else{
         return $result[0]['total'];
      }   
   }
   function GetDataProgramStudi($kodeProdi,$kodeProdiUniv,$namaProdi,$jenjangAkademik,$ekstakta,$model,$jurusan,$offset,$limit){
      $result=$this->Open($this->mSqlQueries['get_data_program_studi'],array('%'.$kodeProdi.'%','%'.$kodeProdiUniv.'%','%'.$namaProdi.'%','%'.$jenjangAkademik.'%','%'.$ekstakta.'%','%'.$model.'%','%'.$jurusan.'%',$offset,$limit));      
      return $result;
   }

   function GetDataProgramStudiById($kodeProdi){
      $result=$this->Open($this->mSqlQueries['get_data_program_studi_by_id'],array($kodeProdi));
      return $result;
   }
   
   function GetUserId($username){
      $result=$this->Open($this->mSqlQueries['get_user_id'],array($username));
      return $result;
   }
   
   function GetDataJenjangAkademik(){
      $result=$this->Open($this->mSqlQueries['get_data_jenjang_akademik'],array());
      //print($this->GetLastError());
      return $result;
   }
   function GetDataModel(){
      $result=$this->Open($this->mSqlQueries['get_data_model'],array());
      return $result;
   }
   
   function GetKelompok(){
      $data[0]['id']="1";
      $data[0]['name']="Ekstakta";
      $data[1]['id']="0";
      $data[1]['name']="Non Ekstakta";
      return $data;
   }
   function GetJurusan(){
      $result=$this->Open($this->mSqlQueries['get_data_jurusan'],array());
      return $result;
   }
   
   function GetKodeFakultas($idProgramStudi){
      $result=$this->Open($this->mSqlQueries['get_kode_fakultas'],array($idProgramStudi));
      //print($this->GetLastError());
      return $result;
   }
//==================================================do===============
   function DoAddProgramStudi($kodeProdi,$kodeUniv,$labelNim,$namaProdi,$jenjangAkademik,$username,$ekstakta,$model,$fakultas){
      $result=$this->Execute($this->mSqlQueries['do_add_program_studi'],array($kodeProdi,$kodeUniv,$labelNim,$namaProdi,$jenjangAkademik,$username,$ekstakta,$model,$fakultas));
    // print($this->GetLastError());
      return $result;
   }
   function DoUpdateProgramStudi($kodeProdi,$kodeUniv,$labelNim,$namaProdi,$jenjangAkademik,$username,$ekstakta,$model,$fakultas,$oldId){
      $result=$this->Execute($this->mSqlQueries['do_update_program_studi'],array($kodeProdi,$kodeUniv,$labelNim,$namaProdi,$jenjangAkademik,$username,$ekstakta,$model,$fakultas,$oldId));
    // print($this->GetLastError());
     return $result;
   }
   function DoDeleteProgramStudiById($kodeProdi){
      $result=$this->Execute($this->mSqlQueries['do_delete_program_studi_by_id'],array($kodeProdi));
      return $result;
   }
   function DoDeleteProgramStudiByArrayId($arrKodeProdi){
      $kodeProdi = implode("', '", $arrKodeProdi);
      $result=$this->Execute($this->mSqlQueries['do_delete_program_studi_by_array_id'],array($kodeProdi));
      return $result;
   }

}
?>
