<?php
class settingUtil {
  private $logger = "";

  private $baseIniFile = "../settings/common_";
  private $baseIniData = null;

  private $printIniFile = "../settings/print";
  private $printIniData = null;

  private $dbIniFile = "../settings/db_";
  private $dbIniData = null;

  private $assistIniFile = "../settings/assist.json";
  private $assistIniData = null;

  private $pgdbIniFile = "../settings/pgdb";
  private $pgdbIniData = null;


  function __construct() {
    $this->logger = new logger(basename(__FILE__));
  }

  public function getBaseParam($key, $sysno="") {
    if( $this->baseIniData == null ) {
      $ini = file_get_contents( dirname(__FILE__) . "/" . $this->baseIniFile . $sysno . ".json" );
      $this->baseIniData = json_decode($ini, true);
    }
    return $this->baseIniData[$key];
  }

  public function getPrintParam($key, $seq="00") {    //未使用！！！！
    $ini = file_get_contents( dirname(__FILE__) . "/" . $this->printIniFile . $seq . ".json" );
    $this->printIniData = json_decode($ini, true);
    return $this->printIniData[$key];
  }

  public function getDbParam($key, $seq="00") {
    $ini = file_get_contents( dirname(__FILE__) . "/" . $this->dbIniFile . $seq . ".json" );
    $this->dbIniData = json_decode($ini, true);
    return $this->dbIniData[$key];
  }

  public function getPgDbParam($key, $seq="00") { //未使用?

    $ini = file_get_contents( dirname(__FILE__) . "/" . $this->pgdbIniFile . $seq . ".json" );
    $this->pgdbIniData = json_decode($ini, true);
    return $this->pgdbIniData[$key];
  }


}

?>
