<?php
/*
Author : Nikolius
Email : n1colius.lau@gmail.com
Date : 11-Jul-2015 03:14 PM
*/
require_once $cfg->mValue['docroot'] . "module/sia_setting/business/sia_setting.class.php";
class Semester extends SiaSetting {

   function Semester(&$configObject, $dataProceed) {
      SiaSetting::SiaSetting($configObject, $dataProceed);
      $this->AppendSqlQueries("module/semester/business/semester.sql.php");
   }

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_smt'],
            $dataList[$i]['id_thn_ajaran'],
            $dataList[$i]['nm_smt'],
            $dataList[$i]['smt'],
            $dataList[$i]['a_periode_aktif'],
            $dataList[$i]['tgl_mulai'],
            $dataList[$i]['tgl_selesai'],
            $dataList[$i]['id_thn_ajaran'],
            $dataList[$i]['nm_smt'],
            $dataList[$i]['smt'],
            $dataList[$i]['a_periode_aktif'],
            $dataList[$i]['tgl_mulai'],
            $dataList[$i]['tgl_selesai']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncDataSemester'], $p);
         if($proses == FALSE) $prosesInsertUpdate = FALSE;
      }

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

}
?>