<?php
/*
Author : Nikolius
Email : n1colius.lau@gmail.com
Date : 11-Jul-2015 06:15 PM
*/
require_once $cfg->mValue['docroot'] . "module/sia_setting/business/sia_setting.class.php";
class Status_mahasiswa extends SiaSetting {
   function Status_mahasiswa(&$configObject, $dataProceed) {
      SiaSetting::SiaSetting($configObject, $dataProceed);
      $this->AppendSqlQueries("module/status_mahasiswa/business/status_mahasiswa.sql.php");
   }

   function GetDataForSync(){
      $dataList = $this->GetProperty("DataProceed");

      $this->StartTransaction();
      $prosesInsertUpdate = TRUE;

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_stat_mhs'],
            $dataList[$i]['nm_stat_mhs'],
            $dataList[$i]['ket_stat_mhs'],
            $dataList[$i]['nm_stat_mhs'],
            $dataList[$i]['ket_stat_mhs']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncData'], $p);
         if($proses == FALSE) $prosesInsertUpdate = FALSE;
      }

      //cari datanya di tabel negara_ref dan update gt_id nya
      for ($i=0; $i < count($dataList); $i++) {
         $dataId = $this->GetAllDataAsArray($this->mSqlQueries['getDataId'], array($dataList[$i]['nm_stat_mhs']));
         $gt_id = $dataId[0]['stakmhsrKode'];

         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['updateFeederGtId'], array($gt_id,$dataList[$i]['id_stat_mhs']));
         if($proses == FALSE) $prosesInsertUpdate = FALSE;
      }

      $this->CompleteTransaction($prosesInsertUpdate);
      return $prosesInsertUpdate;
   }
}
?>