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

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

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

$header = Array();
$assign_var["header"] = $header;
$logger->info("header", $header);

//コンボボックス
$listutil = null;
$listutil = new getListUtil();
$assign_var["listMhno"] = $listutil->getlistAfm90('T'); //区分

//POPUP
$assign_var["hasPopAf993m"] = "1";

try {
  //権限登録チェック
  $sql = file_get_contents("./sql/chklabelCnt.sql");
  $result = $dbutil->selectNoCount($sql);
$logger->info('chk>>',$result);
  if ($result[0]['cnt1'] > 10) {
    throw new UserException("E0002", "権限の登録が不正です。(権限は最大で10個までです。)" ,null);
  } else {
    if ($result[0]['cnt2'] > 0) {
      throw new UserException("E0002", "権限の登録が不正です。(権限は00～09で登録して下さい。)" ,null);
    }
  }
  //権限名
  $lblName = Array();
  $sql = file_get_contents("./sql/getLabel.sql");
  $result = $dbutil->select($sql);
$logger->info('lbl>>',$result);
  if ($result != null) {
    foreach ($result as $key => $detail) {
      $lblName['lbl'.$detail['cd']] = $detail['nm'];
    }
  }
  // 初期表示
  $dataList = Array(
  );
  $obj = [
  ];
  //array_push($dataList, $obj);

} 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["label"] = $lblName;
$assign_var["dataList"] = $dataList;

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

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