dbmsv2 init...1
This commit is contained in:
parent
99e15544c4
commit
df7ce1443b
@ -208,19 +208,9 @@ class CommonHelper
|
|||||||
}
|
}
|
||||||
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
||||||
$html = sprintf("<select name=\"%s\" %s>", $field, $extra);
|
$html = sprintf("<select name=\"%s\" %s>", $field, $extra);
|
||||||
|
$html .= $this->form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes);
|
||||||
$html .= "<option value=\"\">" . lang("{$viewDatas['class_path']}.label.{$field}") . " 선택" . "</option>";
|
$html .= "<option value=\"\">" . lang("{$viewDatas['class_path']}.label.{$field}") . " 선택" . "</option>";
|
||||||
foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) {
|
|
||||||
$isSelected = $key == $value ? ' selected' : '';
|
|
||||||
$isDisabled = "";
|
|
||||||
if (in_array($viewDatas['control']['action'], ['create_form', 'index'])) {
|
|
||||||
if ($entity->getStatus() != $entity::DEFAULT_STATUS)
|
|
||||||
$isDisabled = " disabled";
|
|
||||||
}
|
|
||||||
$attribute = $this->form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes, $entity);
|
|
||||||
$title = $entity->getStatus() != $entity::DEFAULT_STATUS ? "X." : "";
|
|
||||||
$title .= $entity->getCustomTitle();
|
|
||||||
$html .= sprintf("<option value=\"%s\"%s%s%s>%s</option>", $key, $isSelected, $isDisabled, $attribute, $title);
|
|
||||||
}
|
|
||||||
$html .= '</select>';
|
$html .= '</select>';
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
@ -237,17 +227,29 @@ class CommonHelper
|
|||||||
return $label;
|
return $label;
|
||||||
}
|
}
|
||||||
// header.php에서 getFieldForm_Helper사용
|
// header.php에서 getFieldForm_Helper사용
|
||||||
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], mixed $entity): string
|
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = []): string
|
||||||
{
|
{
|
||||||
$attribute = "";
|
$html = "";
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
default:
|
default:
|
||||||
|
foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) {
|
||||||
|
$isSelected = $key == $value ? ' selected' : '';
|
||||||
|
$isDisabled = "";
|
||||||
|
if (in_array($viewDatas['control']['action'], ['create_form', 'index'])) {
|
||||||
|
if ($entity->getStatus() != $entity::DEFAULT_STATUS)
|
||||||
|
$isDisabled = " disabled";
|
||||||
|
}
|
||||||
|
$attribute = "";
|
||||||
foreach ($attributes as $attribute_tag => $attribute_value) {
|
foreach ($attributes as $attribute_tag => $attribute_value) {
|
||||||
$attribute .= sprintf(" %s=\"%s\"", $attribute_tag, $attribute_value);
|
$attribute .= sprintf(" %s=\"%s\"", $attribute_tag, $attribute_value);
|
||||||
}
|
}
|
||||||
|
$title = $entity->getStatus() != $entity::DEFAULT_STATUS ? "X." : "";
|
||||||
|
$title .= $entity->getCustomTitle();
|
||||||
|
$html .= sprintf("<option value=\"%s\"%s%s%s>%s</option>", $key, $isSelected, $isDisabled, $attribute, $title);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $attribute;
|
return $html;
|
||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,21 +12,33 @@ class ServiceHelper extends CustomerHelper
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setTitleField(field: ServiceModel::TITLE);
|
$this->setTitleField(field: ServiceModel::TITLE);
|
||||||
}
|
}
|
||||||
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], mixed $entity): string
|
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = []): string
|
||||||
{
|
{
|
||||||
$attribute = "";
|
$html = "";
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'serverinfo_uid':
|
case 'serverinfo_uid':
|
||||||
|
$attribute = "";
|
||||||
|
foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) {
|
||||||
|
$isSelected = $key == $value ? ' selected' : '';
|
||||||
|
$isDisabled = "";
|
||||||
|
if (in_array($viewDatas['control']['action'], ['create_form', 'index'])) {
|
||||||
|
if ($entity->getStatus() != $entity::DEFAULT_STATUS)
|
||||||
|
$isDisabled = " disabled";
|
||||||
|
}
|
||||||
$attribute = "";
|
$attribute = "";
|
||||||
foreach ($attributes as $attribute_tag => $attribute_value) {
|
foreach ($attributes as $attribute_tag => $attribute_value) {
|
||||||
$attribute .= sprintf(" %s=\"%s\"", $attribute_tag, $entity instanceof ServerEntity ? $entity->$attribute_value() : $attribute_value);
|
$attribute .= sprintf(" %s=\"%s\"", $attribute_tag, $entity instanceof ServerEntity ? $entity->$attribute_value() : $attribute_value);
|
||||||
}
|
}
|
||||||
|
$title = $entity->getStatus() != $entity::DEFAULT_STATUS ? "X." : "";
|
||||||
|
$title .= $entity->getCustomTitle();
|
||||||
|
$html .= sprintf("<option value=\"%s\"%s%s%s>%s</option>", $key, $isSelected, $isDisabled, $attribute, $title);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$attribute = parent::form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes, $entity);
|
$html = parent::form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $attribute;
|
return $html;
|
||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,20 +12,33 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setTitleField(field: ServerPartModel::TITLE);
|
$this->setTitleField(field: ServerPartModel::TITLE);
|
||||||
}
|
}
|
||||||
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], mixed $entity): string
|
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = []): string
|
||||||
{
|
{
|
||||||
$attribute = "";
|
$html = "";
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'part_uid':
|
case 'part_uid':
|
||||||
|
$attribute = "";
|
||||||
|
foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) {
|
||||||
|
$isSelected = $key == $value ? ' selected' : '';
|
||||||
|
$isDisabled = "";
|
||||||
|
if (in_array($viewDatas['control']['action'], ['create_form', 'index'])) {
|
||||||
|
if ($entity->getStatus() != $entity::DEFAULT_STATUS)
|
||||||
|
$isDisabled = " disabled";
|
||||||
|
}
|
||||||
|
$attribute = "";
|
||||||
foreach ($attributes as $attribute_tag => $attribute_value) {
|
foreach ($attributes as $attribute_tag => $attribute_value) {
|
||||||
$attribute .= sprintf(" %s=\"%s\"", $attribute_tag, $entity instanceof PartEntity ? $entity->$attribute_value() : $attribute_value);
|
$attribute .= sprintf(" %s=\"%s\"", $attribute_tag, $entity instanceof PartEntity ? $entity->$attribute_value() : $attribute_value);
|
||||||
}
|
}
|
||||||
|
$title = $entity->getStatus() != $entity::DEFAULT_STATUS ? "X." : "";
|
||||||
|
$title .= $entity->getCustomTitle();
|
||||||
|
$html .= sprintf("<option value=\"%s\"%s%s%s>%s</option>", $key, $isSelected, $isDisabled, $attribute, $title);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$attribute = parent::form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes, $entity);
|
$html = parent::form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $attribute;
|
return $html;
|
||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user