73 lines
2.7 KiB
PHP
73 lines
2.7 KiB
PHP
<?php
|
|
if (!defined('_GNUBOARD_')) exit;
|
|
|
|
class FormManager
|
|
{
|
|
private $ui_manager_table;
|
|
private $form_category_table;
|
|
private $common_lang_table;
|
|
|
|
public function __construct()
|
|
{
|
|
global $g5;
|
|
$this->ui_manager_table = $g5['ui_manager_table'];
|
|
$this->form_category_table = $g5['form_category_table'];
|
|
$this->common_lang_table = $g5['common_lang_table'];
|
|
}
|
|
|
|
/**
|
|
* 특정 화면의 모든 UI 리소스를 가져와 구조화된 배열로 반환합니다.
|
|
* @param string $screen_code 가져올 화면 코드 (e.g., 'order_form')
|
|
* @param string $lang_code 언어 코드 (기본값 'ko')
|
|
* @return array 구조화된 리소스 배열
|
|
*/
|
|
public function getResources($screen_code, $lang_code = 'ko')
|
|
{
|
|
$sql = "SELECT
|
|
A.group_code,
|
|
A.resource_code,
|
|
A.resource_type,
|
|
A.resource_desc,
|
|
B.cl_name AS label,
|
|
B.cl_description AS tooltip,
|
|
C.fc_key,
|
|
C.fc_order,
|
|
D.cl_name AS option_name
|
|
FROM {$this->ui_manager_table} AS A
|
|
LEFT JOIN {$this->common_lang_table} AS B
|
|
ON (A.um_id = B.target_id AND B.target_table = '{$this->ui_manager_table}' AND B.lang_code = '{$lang_code}')
|
|
LEFT JOIN {$this->form_category_table} AS C
|
|
ON (A.um_id = C.um_id AND C.is_deleted = 0 AND C.is_used = 1)
|
|
LEFT JOIN {$this->common_lang_table} AS D
|
|
ON (C.fc_id = D.target_id AND D.target_table = '{$this->form_category_table}' AND D.lang_code = '{$lang_code}')
|
|
WHERE A.screen_code = '" . sql_real_escape_string($screen_code) . "' AND A.is_used = 1
|
|
ORDER BY A.group_code, A.resource_code, C.fc_order, C.fc_id";
|
|
|
|
$result = sql_query($sql);
|
|
$resources = [];
|
|
|
|
while ($row = sql_fetch_array($result)) {
|
|
$group = $row['group_code'];
|
|
$code = $row['resource_code'];
|
|
|
|
if (!isset($resources[$group][$code])) {
|
|
$resources[$group][$code] = [
|
|
'type' => $row['resource_type'],
|
|
'desc' => $row['resource_desc'],
|
|
'label' => $row['label'],
|
|
'tooltip' => $row['tooltip'],
|
|
'options' => [],
|
|
];
|
|
}
|
|
|
|
if ($row['resource_type'] === 'DATA' && $row['fc_key']) {
|
|
$resources[$group][$code]['options'][] = [
|
|
'key' => $row['fc_key'],
|
|
'name' => $row['option_name'],
|
|
];
|
|
}
|
|
}
|
|
|
|
return $resources;
|
|
}
|
|
} |