<?php
//共通
require_once '../../base/common.php';
require_once '../../util/combo.php';

$logger = new logger(basename(__FILE__));
$logger->info("=== ai999x_index_start ===");
//$logger->info('post', $_POST)

$assign_var["noeventClassHeader"] = "";
$assign_var["noeventClassBody"]   = "";

// 初期表示
if ($stringUtil->isEmpty($_SESSION[$GLOBALS['SYSTEM_NAME_EN']]["LGKTKTCD"])) {
  $header['ktktcd'] = '00';
} else {
  $header['ktktcd'] = $_SESSION[$GLOBALS['SYSTEM_NAME_EN']]["LGKTKTCD"];
}

try {
  // sqlの条件を設定する
  $whereParams["ktktcd"] = $header["ktktcd"];
  $sql = file_get_contents("./sql/search.sql");
  $result = $dbutil->select($sql, $whereParams);
  if ($result == null) {
    $dataList['rcflg'] = '0';
    $dataList['pkiflg'] = '0';
    $dataList['pkeflg'] = '0';
    $dataList['preflg'] = '0';
    $dataList['dlogflg'] = '0';
  } else {
    $dataList = $result[0];
  }
  $assign_var["header"] = $header;
  $assign_var["data"] = $dataList;

} catch(userException $ue) {
  $dbutil->rollback();
  $assign_var["hasError"] = true;
  $assign_var["errorMsg"] = $ue->getMessage();
} catch(Exception $e) {
  $dbutil->rollback();

  $assign_var["hasError"] = true;
  $assign_var["errorMsg"] = $e->getMessage();

}

$assign_var["header"] = $header;
$assign_var["data"] = $dataList;

$logger->info('assign_var',$assign_var);

//Smartyへアサイン
$smarty->assign($assign_var);
$smarty->display("index");

$logger->info("=== ai999x_index_end ===");
?>
