diff --git a/webapp/controller/UnitTestController.class.php b/webapp/controller/UnitTestController.class.php index 0f28385..5f14315 100644 --- a/webapp/controller/UnitTestController.class.php +++ b/webapp/controller/UnitTestController.class.php @@ -22,4 +22,16 @@ class UnitTestController echo json_encode(metatable\getEquipById($_REQUEST['equip_id'])); } + public function getParameterConf() + { + require_once 'metatable/parameter.php'; + echo json_encode(metatable\getParameterConf()); + } + + public function getParameterByName() + { + require_once 'metatable/parameter.php'; + echo json_encode(metatable\getParameterByName($_REQUEST['param_name'])); + } + } diff --git a/webapp/metatable/equip.php b/webapp/metatable/equip.php index 84c5555..a6822a8 100644 --- a/webapp/metatable/equip.php +++ b/webapp/metatable/equip.php @@ -23,13 +23,9 @@ function getEquipConf() function getEquipById($equip_id) { - return getEquipByIdEx(getEquipConf(), $equip_id); -} - -function getEquipByIdEx($equip_table, $equip_id) -{ + $conf = getEquipConf(); $equip_id = (int)$equip_id; - return array_key_exists($equip_id, $equip_table) ? $equip_table[$equip_id] : null; + return array_key_exists($equip_id, $conf) ? $conf[$equip_id] : null; } function _internalGetEquipConf() diff --git a/webapp/metatable/parameter.php b/webapp/metatable/parameter.php new file mode 100644 index 0000000..f730816 --- /dev/null +++ b/webapp/metatable/parameter.php @@ -0,0 +1,37 @@ + $val) { + if ($val['param_name'] == $param_name) { + return $val; + } + } + return null; +} + +function _internalGetParameterConf() +{ + global $g_parameter_table; + if (!$g_parameter_table) { + $g_parameter_table = require(getConfigBaseDir() . 'parameter@parameter.php'); + } + return $g_parameter_table; +}