cfmgrv4 init...1

This commit is contained in:
최준흠 2024-10-02 07:21:12 +09:00
parent f6fd1a5f16
commit cb08006d57
15 changed files with 54 additions and 49 deletions

View File

@ -41,11 +41,8 @@ class AccountController extends CloudflareController
{ {
switch ($field) { switch ($field) {
case $this->getModel()::PARENT: case $this->getModel()::PARENT:
$temps = [
DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택',
];
// $this->getAuthModel()->where('status', DEFAULTS['STATUS']); // $this->getAuthModel()->where('status', DEFAULTS['STATUS']);
$options[$field] = $this->getAuthModel()->getFormFieldOption($field, $temps); $options[$field] = $this->getAuthModel()->getFormFieldOption($field);
// echo $this->getAuthModel()->getLastQuery(); // echo $this->getAuthModel()->getLastQuery();
// dd($options); // dd($options);
break; break;

View File

@ -38,11 +38,8 @@ class RecordController extends CloudflareController
{ {
switch ($field) { switch ($field) {
case $this->getModel()::PARENT: case $this->getModel()::PARENT:
$temps = [
DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택',
];
// $this->getZoneModel()->where('status', 'active'); // $this->getZoneModel()->where('status', 'active');
$options[$field] = $this->getZoneModel()->getFormFieldOption($field, $temps); $options[$field] = $this->getZoneModel()->getFormFieldOption($field);
// echo $this->getAccountModel()->getLastQuery(); // echo $this->getAccountModel()->getLastQuery();
// dd($options); // dd($options);
break; break;

View File

@ -42,20 +42,14 @@ class ZoneController extends CloudflareController
{ {
switch ($field) { switch ($field) {
case $this->getModel()::PARENT: case $this->getModel()::PARENT:
$temps = [
DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택',
];
// $this->getAccountModel()->where('status', DEFAULTS['STATUS']); // $this->getAccountModel()->where('status', DEFAULTS['STATUS']);
$options[$field] = $this->getAccountModel()->getFormFieldOption($field, $temps); $options[$field] = $this->getAccountModel()->getFormFieldOption($field);
// echo $this->getAccountModel()->getLastQuery(); // echo $this->getAccountModel()->getLastQuery();
// dd($options); // dd($options);
break; break;
case 'type': case 'type':
case 'proxied': case 'proxied':
$options[$field] = [ $options[$field] = lang($this->root . 'Record.' . strtoupper($field));
"" => lang($this->root . 'Record.label.' . $field) . ' 선택',
...lang($this->root . 'Record.' . strtoupper($field)),
];
break; break;
default: default:
$options = parent::getFormFieldOption($field, $options); $options = parent::getFormFieldOption($field, $options);

View File

@ -22,10 +22,7 @@ abstract class MVController extends CommonController
switch ($field) { switch ($field) {
default: default:
// dd(lang($this->class_path . '.' . strtoupper($field))); // dd(lang($this->class_path . '.' . strtoupper($field)));
$options[$field] = [ $options[$field] = lang($this->class_path . '.' . strtoupper($field));
"" => lang($this->class_path . '.label.' . $field) . ' 선택',
...lang($this->class_path . '.' . strtoupper($field)),
];
break; break;
} }
return $options; return $options;

View File

@ -23,7 +23,10 @@ function getFieldForm_AccountHelper(string $field, mixed $value, array $viewData
$value = $value ?: DEFAULTS['EMPTY']; $value = $value ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
case AccountModel::PARENT: case AccountModel::PARENT:
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, [...$extras, 'class' => "select-field"]); $form = form_dropdown($field, [
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, [...$extras, 'class' => "select-field"]);
// // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [$extras]); // // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [$extras]);
// foreach ($viewDatas['field_options'][$field] as $key => $label) { // foreach ($viewDatas['field_options'][$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label;
@ -35,7 +38,10 @@ function getFieldForm_AccountHelper(string $field, mixed $value, array $viewData
break; break;
case 'type': case 'type':
case 'status': case 'status':
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras); $form = form_dropdown($field, [
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, $extras);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':

View File

@ -23,7 +23,10 @@ function getFieldForm_AuthHelper(string $field, mixed $value, array $viewDatas,
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); $form = form_input($field, $value, ["placeholder" => "예)test@example.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]);
break; break;
case 'status': case 'status':
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras); $form = form_dropdown($field, [
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, $extras);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':

View File

@ -23,7 +23,10 @@ function getFieldForm_RecordHelper(string $field, mixed $value, array $viewDatas
$value = $value ?: DEFAULTS['EMPTY']; $value = $value ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
case RecordModel::PARENT: case RecordModel::PARENT:
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, [...$extras, 'class' => "select-field"]); $form = form_dropdown($field, [
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, [...$extras, 'class' => "select-field"]);
// // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [$extras]); // // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [$extras]);
// foreach ($viewDatas['field_options'][$field] as $key => $label) { // foreach ($viewDatas['field_options'][$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label;
@ -44,7 +47,10 @@ function getFieldForm_RecordHelper(string $field, mixed $value, array $viewDatas
case "locked": case "locked":
case "proxied": case "proxied":
case "proxiable": case "proxiable":
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras); $form = form_dropdown($field, [
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, $extras);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':

View File

@ -23,7 +23,10 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas,
$value = $value ?: DEFAULTS['EMPTY']; $value = $value ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
case ZoneModel::PARENT: case ZoneModel::PARENT:
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, [...$extras, 'class' => "select-field"]); $form = form_dropdown($field, [
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, [...$extras, 'class' => "select-field"]);
// // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [$extras]); // // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [$extras]);
// foreach ($viewDatas['field_options'][$field] as $key => $label) { // foreach ($viewDatas['field_options'][$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label;
@ -46,9 +49,17 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas,
case "ipv6": case "ipv6":
case "security_level": case "security_level":
case 'status': case 'status':
case 'type': $form = form_dropdown($field, [
case 'proxied': "" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras); ...$viewDatas['field_options'][$field]
], $value, $extras);
break;
case 'type': //A,AAA...
case 'proxied': //CDN사용여부
$form = form_dropdown($field, [
"" => lang('Admin/Cloudflare/Record.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, $extras);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':

View File

@ -26,7 +26,10 @@ function getFieldForm_MapurlHelper(string $field, mixed $value, array $viewDatas
$form = form_input($field, $value, ["placeholder" => "예)https://new.example.com", "style" => "width:100%; ::placeholder{color:silver; opacity: 1;}"]); $form = form_input($field, $value, ["placeholder" => "예)https://new.example.com", "style" => "width:100%; ::placeholder{color:silver; opacity: 1;}"]);
break; break;
case 'status': case 'status':
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras); $form = form_dropdown($field, [
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, $extras);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':

View File

@ -22,15 +22,12 @@ function getFieldForm_UserHelper(string $field, mixed $value, array $viewDatas,
case UserModel::TITLE: case UserModel::TITLE:
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); $form = form_input($field, $value, ["placeholder" => "예)test@example.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]);
break; break;
// case 'role':
// foreach ($viewDatas['field_options'][$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label;
// }
// $form = implode(" ", $checkboxs);
// break;
case 'role': case 'role':
case 'status': case 'status':
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras); $form = form_dropdown($field, [
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
...$viewDatas['field_options'][$field]
], $value, $extras);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':
@ -55,14 +52,11 @@ function getFieldView_UserHelper(string $field, UserEntity $entity, array $viewD
] ]
); );
break; break;
case 'category_uid': case 'role':
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) { foreach ($viewDatas['field_options'][$field] as $key => $label) {
foreach ($category_2depths as $key => $depth) { $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label;
if ($key == $depth) {
$value = $depth;
}
}
} }
$value = implode(" ", $checkboxs);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':

View File

@ -2,7 +2,6 @@
<?= $this->section('content') ?> <?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script> <script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script>
<?= form_open(current_url(), array("method" => "get")) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?> <?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> <?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped"> <table class="index_table table table-bordered table-hover table-striped">

View File

@ -2,8 +2,8 @@
<?= $this->section('content') ?> <?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script> <script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?> <?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped"> <table class="index_table table table-bordered table-hover table-striped">
<thead> <thead>
<tr> <tr>

View File

@ -2,7 +2,6 @@
<?= $this->section('content') ?> <?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script> <script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script>
<?= form_open(current_url(), array("method" => "get")) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?> <?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> <?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped"> <table class="index_table table table-bordered table-hover table-striped">

View File

@ -2,7 +2,6 @@
<?= $this->section('content') ?> <?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script> <script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script>
<?= form_open(current_url(), array("method" => "get")) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?> <?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> <?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped"> <table class="index_table table table-bordered table-hover table-striped">

View File

@ -2,8 +2,8 @@
<?= $this->section('content') ?> <?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script> <script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?> <?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped"> <table class="index_table table table-bordered table-hover table-striped">
<thead> <thead>
<tr> <tr>