diff --git a/app/Controllers/Admin/Cloudflare/RecordController.php b/app/Controllers/Admin/Cloudflare/RecordController.php index d7bf947..484ae54 100644 --- a/app/Controllers/Admin/Cloudflare/RecordController.php +++ b/app/Controllers/Admin/Cloudflare/RecordController.php @@ -107,17 +107,29 @@ class RecordController extends CloudflareController $cnt++; } //Socket처리 + $entitys = []; foreach ($this->formDatas['hosts'] as $host) { - $this->entity = $this->getMyLibrary()->create( + $entity = $this->getMyLibrary()->create( $host, $this->formDatas['type'], $this->formDatas['content'], $this->formDatas['proxied'] ); - log_message("debug", message: "Record:{$this->entity->getTitle()} 생성 작업을 완료하였습니다."); + log_message("debug", message: "Record:{$entity->getTitle()} 생성 작업을 완료하였습니다."); + $entitys[] = $entity; } + $this->entitys = $entitys; } - public function create(mixed $zone_uid = false): RedirectResponse|string + protected function create_result(): string + { + $this->fields = [$this->getModel()::PARENT, 'type', 'content', 'proxied', 'host']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + return view( + $this->view_path . strtolower($this->class_path) . "/view", + data: ['viewDatas' => $this->getViewDatas()] + ); + } + public function create(): RedirectResponse|string { $this->init(__FUNCTION__); return $this->create_procedure(); @@ -146,6 +158,13 @@ class RecordController extends CloudflareController $this->entity = $this->getMyLibrary()->modify($this->entity, $this->formDatas); } } + protected function modify_result(): string + { + return view( + $this->view_path . strtolower($this->class_path) . "/view", + data: ['viewDatas' => $this->getViewDatas()] + ); + } //일괄처리작업 public function batcjob(): RedirectResponse { diff --git a/app/Controllers/Admin/Cloudflare/ZoneController.php b/app/Controllers/Admin/Cloudflare/ZoneController.php index d8274e6..841510f 100644 --- a/app/Controllers/Admin/Cloudflare/ZoneController.php +++ b/app/Controllers/Admin/Cloudflare/ZoneController.php @@ -138,17 +138,18 @@ class ZoneController extends CloudflareController //Socket처리 //Zone생성 $cnt = 1; - $this->zone_entitys = []; + $zone_entitys = []; foreach ($this->formDatas['domains'] as $domain) { $entity = $this->getMyLibrary()->create($domain); log_message("debug", "Zone:{$entity->getTitle()} 작업을 완료하였습니다."); - $this->zone_entitys[] = $entity; + $zone_entitys[] = $entity; $cnt++; } //Record생성 - $this->record_entitys = []; - foreach ($this->zone_entitys as $zone_entity) { + $this->entitys = []; + foreach ($zone_entitys as $zone_entity) { $record = new Record($zone_entity); + $record_entitys = []; foreach ($this->formDatas['hosts'] as $host) { $entity = $record->create( $host, @@ -157,10 +158,19 @@ class ZoneController extends CloudflareController $this->formDatas['proxied'] ); log_message("debug", "Record:{$entity->getTitle()} 작업을 완료하였습니다."); - $this->record_entitys[] = $entity; + $record_entitys[] = $entity; } + $zone_entity->records = $record_entitys; + $this->entitys[] = $zone_entity; } } + protected function create_result(): string + { + return view( + $this->view_path . strtolower($this->class_path) . DIRECTORY_SEPARATOR . "view", + data: ['viewDatas' => $this->getViewDatas()] + ); + } public function create(): RedirectResponse|string { $this->init(__FUNCTION__); @@ -182,6 +192,13 @@ class ZoneController extends CloudflareController //Socket처리 $this->entity = $this->getMyLibrary()->modify($this->entity, $this->formDatas); } + protected function modify_result(): string + { + return view( + $this->view_path . strtolower($this->class_path) . DIRECTORY_SEPARATOR . "view", + data: ['viewDatas' => $this->getViewDatas()] + ); + } //일괄처리작업 public function batcjob(): RedirectResponse { diff --git a/app/Controllers/MVController.php b/app/Controllers/MVController.php index e18a42a..6a8e85b 100644 --- a/app/Controllers/MVController.php +++ b/app/Controllers/MVController.php @@ -77,18 +77,9 @@ abstract class MVController extends CommonController return $formDatas; } // 생성 - protected function create_validate(string $action, array $fields): void + protected function create_form_process(): void { - //변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요 - $this->validation = $this->setFormFieldRules($fields, service('validation'), $action); - if (!$this->validation->withRequest($this->request)->run()) { - throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode( - "\n", - $this->validation->getErrors() - )); - } } - protected function create_form_process(): void {} final protected function create_form_procedure(): RedirectResponse|string { try { @@ -104,6 +95,17 @@ abstract class MVController extends CommonController return redirect()->back()->with('error', $e->getMessage()); } } + protected function create_validate(string $action, array $fields): void + { + //변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요 + $this->validation = $this->setFormFieldRules($fields, service('validation'), $action); + if (!$this->validation->withRequest($this->request)->run()) { + throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode( + "\n", + $this->validation->getErrors() + )); + } + } protected function create_process(): void { $this->create_validate($this->action, $this->fields); @@ -135,17 +137,6 @@ abstract class MVController extends CommonController } } // 수정 - protected function modify_validate(string $action, array $fields): void - { - //변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요 - $this->validation = $this->setFormFieldRules($fields, service('validation'), $action); - if (!$this->validation->withRequest($this->request)->run()) { - throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode( - "\n", - $this->validation->getErrors() - )); - } - } protected function modify_form_process(string $uid): void { $this->entity = $this->getModel()->getEntityByPK(intval($uid)); @@ -168,6 +159,17 @@ abstract class MVController extends CommonController return redirect()->back()->with('error', $e->getMessage()); } } + protected function modify_validate(string $action, array $fields): void + { + //변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요 + $this->validation = $this->setFormFieldRules($fields, service('validation'), $action); + if (!$this->validation->withRequest($this->request)->run()) { + throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode( + "\n", + $this->validation->getErrors() + )); + } + } protected function modify_process(string $uid): void { $this->modify_validate($this->action, $this->fields); diff --git a/app/Helpers/Cloudflare/RecordHelper.php b/app/Helpers/Cloudflare/RecordHelper.php index 13e2ff4..f37fbf1 100644 --- a/app/Helpers/Cloudflare/RecordHelper.php +++ b/app/Helpers/Cloudflare/RecordHelper.php @@ -74,7 +74,7 @@ class RecordHelper extends CommonHelper case RecordModel::TITLE: $url = sprintf("%s/toggle/%s/fixed?fixed=%s", current_url(), $viewDatas['entity']->getPK(), $viewDatas['entity']->fixed == 'on' ? "off" : "on"); $fixed = $viewDatas['entity']->fixed == 'on' ? "" . ICONS['LOCK'] . "" : ""; - $value = sprintf("%s%s", $fixed, $value); + $value = sprintf("%s%s", $fixed, $value); $value = anchor($url, $value, ["target" => "_self"]); break; case 'content': diff --git a/app/Views/admin/cloudflare/record/view.php b/app/Views/admin/cloudflare/record/view.php new file mode 100644 index 0000000..fa66ae6 --- /dev/null +++ b/app/Views/admin/cloudflare/record/view.php @@ -0,0 +1,32 @@ +extend(LAYOUTS[$viewDatas['layout']]['path']) ?> +section('content') ?> +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
번호getFieldLabel($field, $viewDatas) ?>
getFieldView($field, $viewDatas) ?>
+
+
+
+
+endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/cloudflare/zone/view.php b/app/Views/admin/cloudflare/zone/view.php new file mode 100644 index 0000000..eaf86ae --- /dev/null +++ b/app/Views/admin/cloudflare/zone/view.php @@ -0,0 +1,39 @@ +extend(LAYOUTS[$viewDatas['layout']]['path']) ?> +section('content') ?> +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
번호getFieldLabel($field, $viewDatas) ?>
getFieldView($field, $viewDatas, $viewDatas) ?>
+ records as $record): ?> + getTitle() ?> + +
+
+
+
+
+endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/create.php b/app/Views/admin/create.php index 9ae9eff..d3a019b 100644 --- a/app/Views/admin/create.php +++ b/app/Views/admin/create.php @@ -16,7 +16,7 @@ $extras = ["required" => "", ...$extras]; } ?> - getFieldForm($field, old($field), $viewDatas, $extras) ?> + getFieldForm($field, old($field), $viewDatas, $extras) ?>
diff --git a/app/Views/admin/view.php b/app/Views/admin/view.php deleted file mode 100644 index ecb2f51..0000000 --- a/app/Views/admin/view.php +++ /dev/null @@ -1,25 +0,0 @@ -extend(LAYOUTS[$viewDatas['layout']]['path']) ?> -section('content') ?> -
- -
- - - - - - - - - - - - -
getFieldLabel($field, $viewDatas) ?> - getFieldView($field, $viewDatas, $viewDatas) ?> -
-
-
-
-
-endSection() ?> \ No newline at end of file