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

   function GetDataListForInsertSync(){
      return $this->GetAllDataAsArray($this->mSqlQueries['GetDataListForInsertSync'], array());
   }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_smt'],
            $dataList[$i]['id_reg_pd'],
            $dataList[$i]['ips'],
            $dataList[$i]['sks_smt'],
            $dataList[$i]['ipk'],
            $dataList[$i]['sks_total'],
            $dataList[$i]['id_stat_mhs'],
            $dataList[$i]['ips'], //update
            $dataList[$i]['sks_smt'],
            $dataList[$i]['ipk'],
            $dataList[$i]['sks_total'],
            $dataList[$i]['id_stat_mhs']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncData'], $p);
         if($proses == FALSE) $prosesInsertUpdate = FALSE;
         $totalAfektedRow += $this->getAffectedRow();
      }

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