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

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_ajar'],
            $dataList[$i]['id_reg_ptk'],
            $dataList[$i]['id_subst'],
            $dataList[$i]['id_kls'],
            $dataList[$i]['sks_subst_tot'],
            $dataList[$i]['sks_tm_subst'],
            $dataList[$i]['sks_prak_subst'],
            $dataList[$i]['sks_prak_lap_subst'],
            $dataList[$i]['sks_sim_subst'],
            $dataList[$i]['jml_tm_renc'],
            $dataList[$i]['jml_tm_real'],
            $dataList[$i]['id_jns_eval'],
            $dataList[$i]['id_reg_ptk'], //update
            $dataList[$i]['id_subst'],
            $dataList[$i]['id_kls'],
            $dataList[$i]['sks_subst_tot'],
            $dataList[$i]['sks_tm_subst'],
            $dataList[$i]['sks_prak_subst'],
            $dataList[$i]['sks_prak_lap_subst'],
            $dataList[$i]['sks_sim_subst'],
            $dataList[$i]['jml_tm_renc'],
            $dataList[$i]['jml_tm_real'],
            $dataList[$i]['id_jns_eval']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncData'], $p);
         if($proses == FALSE) $prosesInsertUpdate = FALSE;
      }

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