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

   function getDataSettingSemester(){
      $data = $this->GetAllDataAsArray($this->mSqlQueries['getDataSettingSemester'], array());
      return $data[0];
   }

   function checkSiaLogin(){
   	$dataProceed = $this->GetProperty("DataProceed");
   	$username = $dataProceed[0];
   	$password = $dataProceed[1];
   	$data = $this->GetAllDataAsArray($this->mSqlQueries['checkSiaLogin'], array($username, $password));
   	$_data = empty($data) ? array() : $data[0];
   	return $_data;
   }

   // set session and get token services
   function setSession(){
      $dataProceed = $this->GetProperty('DataProceed');
      $_SESSION['SiaIsLoggedIn'] = $dataProceed['SiaIsLoggedIn'];
      $_SESSION['susrNama'] = $dataProceed['susrNama'];
      $_SESSION['susrSgroupNama'] = $dataProceed['susrSgroupNama'];
      $_SESSION['susrProfil'] = $dataProceed['susrProfil'];
      return $_SESSION;
   }

   function unsetSession(){
      session_destroy();
      return true;
   }

}
?>