dbms_init...1
This commit is contained in:
parent
ed10383388
commit
0dc77fd21b
@ -90,30 +90,12 @@ class ServiceItemController extends CustomerController
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
//item_type에 따른 item_uid 값 가져오기
|
||||
private function setItemUID(ServiceEntity $serviceEntity, array $formDatas): array
|
||||
{
|
||||
switch ($formDatas['item_type']) {
|
||||
case 'DOMAIN':
|
||||
//DomainService에 먼저 create후 결과 uid를 item_uid로 전달함
|
||||
$equipmentEntity = $this->getService()->getServiceItemLinkService($formDatas['item_type'])->create([
|
||||
'clientinfo_uid' => $serviceEntity->getClientUID(),
|
||||
'domain' => $formDatas['item_uid']
|
||||
]);
|
||||
//도메인용 항목의 item_uid로 전달함
|
||||
$formDatas['item_uid'] = $equipmentEntity->getPK();
|
||||
break;
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
protected function create_process(array $formDatas): ServiceItemEntity
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($formDatas['serviceinfo_uid']);
|
||||
if (!$serviceEntity) {
|
||||
throw new \Exception("{$formDatas['serviceinfo_uid']}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
//item_type에 따른 item_uid 값 가져오기 반드시 Validation 전에 정의해야함
|
||||
$formDatas = $this->setItemUID($serviceEntity, $formDatas);
|
||||
return parent::create_process($formDatas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,4 +11,8 @@ class DomainEntity extends PartEntity
|
||||
const STATUS_AVAILABLE = "default";
|
||||
const STATUS_OCCUPIED = "occupied";
|
||||
const STATUS_FORBIDDEN = "forbidden";
|
||||
public function getDomain(): string
|
||||
{
|
||||
return $this->attributes['domain'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,4 +11,8 @@ class IpEntity extends PartEntity
|
||||
const STATUS_AVAILABLE = "default";
|
||||
const STATUS_OCCUPIED = "occupied";
|
||||
const STATUS_FORBIDDEN = "forbidden";
|
||||
public function getIP(): string
|
||||
{
|
||||
return $this->attributes['ip'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,10 @@ class ServiceHelper extends CustomerHelper
|
||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $field) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
|
||||
$disabled = $filterEntity->getStatus() === SwitchEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
||||
if (array_key_exists('index_content_top_filter', $extras) || $viewDatas['control']['action'] == "modify_form") {
|
||||
if (array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = "";
|
||||
}
|
||||
if ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK()) {
|
||||
$disabled = "";
|
||||
}
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
@ -79,7 +82,10 @@ class ServiceHelper extends CustomerHelper
|
||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $field) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
|
||||
$disabled = $filterEntity->getStatus() === CodeEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
||||
if (array_key_exists('index_content_top_filter', $extras) || $viewDatas['control']['action'] == "modify_form") {
|
||||
if (array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = "";
|
||||
}
|
||||
if ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK()) {
|
||||
$disabled = "";
|
||||
}
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
|
||||
@ -24,27 +24,47 @@ class ServiceItemHelper extends CustomerHelper
|
||||
$item_type = $viewDatas['item_type'];
|
||||
//Field는 item_uid이지만 , item_tpe에 따라 filter_options가 달라진다.
|
||||
switch ($item_type) {
|
||||
case 'DOMAIN':
|
||||
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
|
||||
$form = form_input($field, $value ?? "", ["placeholder" => "예)example.com", ...$extras]);
|
||||
} else {
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$item_type])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$item_type}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
||||
$disabled = $filterEntity->getStatus() === DomainEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
||||
if (array_key_exists('index_content_top_filter', $extras) || $viewDatas['control']['action'] == "modify_form") {
|
||||
$disabled = "";
|
||||
}
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
$form = implode("", $form_temps);
|
||||
case "IP":
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$item_type])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$item_type}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
||||
$disabled = $filterEntity->getStatus() === IpEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
||||
if (array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = "";
|
||||
}
|
||||
if ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK()) {
|
||||
$disabled = "";
|
||||
}
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
$form = implode("", $form_temps);
|
||||
break;
|
||||
case 'DOMAIN':
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$item_type])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$item_type}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
||||
$disabled = $filterEntity->getStatus() === DomainEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
||||
if (array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = "";
|
||||
}
|
||||
if ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK()) {
|
||||
$disabled = "";
|
||||
}
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
$form = implode("", $form_temps);
|
||||
break;
|
||||
case "LINE":
|
||||
case "SERVER":
|
||||
@ -68,24 +88,6 @@ class ServiceItemHelper extends CustomerHelper
|
||||
$form_temps[] = '</select>';
|
||||
$form = implode("", $form_temps);
|
||||
break;
|
||||
case "IP":
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$item_type])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$item_type}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
||||
$disabled = "";
|
||||
if (!array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = in_array($filterEntity->getStatus(), [IpEntity::STATUS_OCCUPIED, IpEntity::STATUS_FORBIDDEN]) ? 'disabled="disabled"' : '';
|
||||
}
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
$form = implode("", $form_temps);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user