cfmgrv4 init...1

This commit is contained in:
최준흠 2024-09-24 21:45:58 +09:00
parent 99f88a6a92
commit 9c69e478fe
3 changed files with 29 additions and 9 deletions

View File

@ -28,10 +28,27 @@ class AccountController extends CloudflareController
}
return $this->_myLibrary;
}
//Field별 Form Input용
protected function getFormFieldInput(string $field, string $value, array $inputs = []): array
{
switch ($field) {
case 'type':
$inputs[$field] = form_dropdown(
$field,
$this->getFormFieldInputOption($field),
$value
);
break;
default:
$inputs[$field] = parent::getFormFieldInput($field, $value, $inputs);
break;
}
return $inputs;
}
protected function create_init(): void
{
$this->fields = [$this->getMyLibrary()->getMyStorage()::TITLE, 'authkey', 'status'];
$this->filter_fields = ['status'];
$this->filter_fields = ['type', 'status'];
$this->action = DB_ACTION['CREATE'];
$this->getMyLibrary()->getMyStorage()->setAction($this->action);
}

View File

@ -24,7 +24,7 @@ abstract class MVController extends CommonController
default:
$options = [
"" => lang($this->class_name . '.label.' . $field) . ' 선택',
...lang($this->class_name . '.' . strtoupper($field)),
lang($this->class_name . '.' . strtoupper($field)),
];
break;
}
@ -57,7 +57,7 @@ abstract class MVController extends CommonController
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "에서 field array 입니다.\n" . var_export($field, true));
}
$inputs = $this->getFormFieldInput($field, old($field) ?? DEFAULTS['EMPTY'], $inputs);
$inputs = $this->getFormFieldInput($field, old($field) ?: DEFAULTS['EMPTY'], $inputs);
}
return $inputs;
}
@ -283,6 +283,8 @@ abstract class MVController extends CommonController
public function list_process(): string
{
try {
//입력폼처리
$this->forminputs = $this->getFormFieldInputs();
//URL처리
$this->uri = $this->request->getUri();
//total 처리

View File

@ -4,7 +4,8 @@
<div class="top container-fluid">
<?= form_open(current_url(), array("method" => "get")) ?>
<nav class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field): ?><?= getFieldFilter_UserHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
<?= dd($viewDatas['forminputs']) ?>
조건검색:<?php foreach ($viewDatas['filter_fields'] as $field): ?><?= $viewDatas['forminputs'][$field] ?><?php endforeach ?>
</nav>
<?= $this->include('templates/admin/index_head') ?>
<?= form_close() ?>
@ -16,7 +17,7 @@
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?= getFieldIndex_Column_UserHelper($field, $viewDatas) ?><?php endforeach ?>
<th>@</th>
<th>@</th>
</tr>
</thead>
<tbody>
@ -43,10 +44,10 @@
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
<?php foreach ($viewDatas['batchjobFilters'] as $field): ?>
<?= getFieldFilter_UserHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?><?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item">
<?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
</li>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item">
<?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
</li>
</ul>
<?= $viewDatas['pagination'] ?>
</div>