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

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

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

      for ($i=0; $i < count($dataList); $i++) {
         $p = array(
            $dataList[$i]['id_jenj_didik'],
            $dataList[$i]['nm_jenj_didik'],
            $dataList[$i]['u_jenj_lemb'],
            $dataList[$i]['u_jenj_org'],
            $dataList[$i]['nm_jenj_didik'],
            $dataList[$i]['u_jenj_lemb'],
            $dataList[$i]['u_jenj_org']
         );
         $proses = $this->ExecuteUpdateQuery($this->mSqlQueries['syncDataJenjang'], $p);
         if($proses == FALSE) $prosesInsertUpdate = FALSE;
      }

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

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

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

?>