From 95b8a0a4e64a834dc303fa9d39c437009c499bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Thu, 26 Sep 2024 21:00:30 +0900 Subject: [PATCH] cfmgrv4 init...1 --- .../Admin/Cloudflare/AccountController.php | 6 +- .../Admin/Cloudflare/RecordController.php | 12 +- .../Admin/Cloudflare/ZoneController.php | 10 +- app/Controllers/MVController.php | 39 ++--- .../Admin/Cloudflare/Record_helper.php | 138 ++++++++++++++++++ app/Helpers/Admin/Cloudflare/Zone_helper.php | 133 +++++++++++++---- app/Libraries/MyCloudflare/Account.php | 3 +- app/Libraries/MyCloudflare/Record.php | 2 +- app/Libraries/MyCloudflare/Zone.php | 4 +- app/Models/Cloudflare/RecordModel.php | 4 +- app/Models/CommonModel.php | 11 +- app/Views/admin/cloudflare/account/index.php | 4 +- app/Views/admin/cloudflare/account/update.php | 24 --- app/Views/admin/cloudflare/account/view.php | 19 --- app/Views/admin/cloudflare/record/create.php | 19 +++ app/Views/admin/cloudflare/record/index.php | 83 +++++++++++ app/Views/admin/cloudflare/zone/create.php | 19 +++ app/Views/admin/cloudflare/zone/index.php | 83 +++++++++++ public/css/admin/content.css | 1 + 19 files changed, 486 insertions(+), 128 deletions(-) create mode 100644 app/Helpers/Admin/Cloudflare/Record_helper.php delete mode 100644 app/Views/admin/cloudflare/account/update.php delete mode 100644 app/Views/admin/cloudflare/account/view.php create mode 100644 app/Views/admin/cloudflare/record/create.php create mode 100644 app/Views/admin/cloudflare/record/index.php create mode 100644 app/Views/admin/cloudflare/zone/create.php create mode 100644 app/Views/admin/cloudflare/zone/index.php diff --git a/app/Controllers/Admin/Cloudflare/AccountController.php b/app/Controllers/Admin/Cloudflare/AccountController.php index 8edd235..80eb295 100644 --- a/app/Controllers/Admin/Cloudflare/AccountController.php +++ b/app/Controllers/Admin/Cloudflare/AccountController.php @@ -41,7 +41,7 @@ class AccountController extends CloudflareController $this->action = 'create'; $this->fields = ['id', 'authkey']; $this->filter_fields = []; - $this->field_rules = $this->getFormFieldRules(); + $this->field_rules = $this->getModel()->getFieldRules($this->fields); $this->field_options = $this->getFormFieldOptions(); $this->getModel()->setAction($this->action); } @@ -50,6 +50,8 @@ class AccountController extends CloudflareController parent::create_process(); $this->getMyLibrary()->create($this->formDatas); } + //수정 + protected function modify_init(): void {} // 리스트 public function list_init(): void { @@ -57,7 +59,7 @@ class AccountController extends CloudflareController $this->fields = [$this->getModel()::TITLE, 'oldkey', 'type', 'status', 'updated_at', 'created_at']; $this->filter_fields = ['type', 'status']; $this->batchjob_fields = ['status']; - $this->field_rules = $this->getFormFieldRules(); + $this->field_rules = $this->getModel()->getFieldRules($this->fields); $this->field_options = $this->getFormFieldOptions(); $this->getModel()->setAction($this->action); } diff --git a/app/Controllers/Admin/Cloudflare/RecordController.php b/app/Controllers/Admin/Cloudflare/RecordController.php index aa9c98d..88ea702 100644 --- a/app/Controllers/Admin/Cloudflare/RecordController.php +++ b/app/Controllers/Admin/Cloudflare/RecordController.php @@ -20,7 +20,7 @@ class RecordController extends CloudflareController $this->class_name = "Record"; $this->class_path .= $this->class_name; $this->title = lang("{$this->class_path}.title"); - helper($this->class_name); + helper($this->class_path); } final protected function getModel(): RecordModel { @@ -73,7 +73,7 @@ class RecordController extends CloudflareController $this->action = 'create'; $this->fields = [$this->getModel()::PARENT, 'type', 'content', 'proxied', 'hosts']; $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied']; - $this->field_rules = $this->getFormFieldRules(); + $this->field_rules = $this->getModel()->getFieldRules($this->fields); $this->field_options = $this->getFormFieldOptions(); $this->getModel()->setAction($this->action); } @@ -82,7 +82,7 @@ class RecordController extends CloudflareController //hosts를 제외한 fields Valid처리 $this->validateFormDatas(array_diff($this->fields, ['hosts'])); } - protected function create_process_submit(): void + protected function create_process(): void { $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]); $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->_zone_entity->getParent()); @@ -94,14 +94,16 @@ class RecordController extends CloudflareController $this->getMyLibrary()->create($host, $this->formDatas); } } + //수정 + protected function modify_init(): void {} // 리스트 public function list_init(): void { $this->action = 'index'; $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at']; - $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied', 'status']; + $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied']; $this->batchjob_fields = ['proxied']; - $this->field_rules = $this->getFormFieldRules(); + $this->field_rules = $this->getModel()->getFieldRules($this->fields); $this->field_options = $this->getFormFieldOptions(); $this->getModel()->setAction($this->action); } diff --git a/app/Controllers/Admin/Cloudflare/ZoneController.php b/app/Controllers/Admin/Cloudflare/ZoneController.php index a5d1ede..2a3c936 100644 --- a/app/Controllers/Admin/Cloudflare/ZoneController.php +++ b/app/Controllers/Admin/Cloudflare/ZoneController.php @@ -21,7 +21,7 @@ class ZoneController extends CloudflareController $this->class_name = "Zone"; $this->class_path .= $this->class_name; $this->title = lang("{$this->class_path}.title"); - helper($this->class_name); + helper($this->class_path); } final protected function getModel(): ZoneModel { @@ -79,7 +79,7 @@ class ZoneController extends CloudflareController $this->action = 'create'; $this->fields = [$this->$this->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied']; $this->filter_fields = [$this->$this->getModel()::PARENT, 'type', 'proxied']; - $this->field_rules = $this->getFormFieldRules(); + $this->field_rules = $this->getModel()->getFieldRules($this->fields); $this->field_options = $this->getFormFieldOptions(); $this->getModel()->setAction($this->action); } @@ -96,7 +96,7 @@ class ZoneController extends CloudflareController } foreach ($this->formDatas['domains'] as $domain) { //Zone생성 - $zone_entity = $this->getMyLibrary()->create($domain); + $zone_entity = $this->getMyLibrary()->create($domain, $this->formDatas); //Record생성 $record = new Record($this->_account_entity, $zone_entity); foreach ($this->formDatas['hosts'] as $host) { @@ -108,6 +108,8 @@ class ZoneController extends CloudflareController } } } + //수정 + protected function modify_init(): void {} // 리스트 public function list_init(): void { @@ -115,7 +117,7 @@ class ZoneController extends CloudflareController $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at']; $this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level', 'status']; $this->batchjob_fields = ['development_mode', 'ipv6', 'security_level']; - $this->field_rules = $this->getFormFieldRules(); + $this->field_rules = $this->getModel()->getFieldRules($this->fields); $this->field_options = $this->getFormFieldOptions(); $this->getModel()->setAction($this->action); } diff --git a/app/Controllers/MVController.php b/app/Controllers/MVController.php index c4aa34f..ff4419b 100644 --- a/app/Controllers/MVController.php +++ b/app/Controllers/MVController.php @@ -16,18 +16,21 @@ abstract class MVController extends CommonController } abstract protected function getModel(): mixed; abstract protected function getMyLibrary(): mixed; + abstract protected function create_init(): void; + abstract protected function modify_init(): void; + abstract protected function list_init(): void; //Field별 Form Option용 protected function getFormFieldOption(string $field, array $options): array { switch ($field) { default: + // log_message("debug", __FUNCTION__ . "에서 호출:" . $field); $options[$field] = [ "" => lang($this->class_path . '.label.' . $field) . ' 선택', ...lang($this->class_path . '.' . strtoupper($field)), ]; break; } - // dd($options); return $options; } final protected function getFormFieldOptions(array $options = []): array @@ -40,18 +43,6 @@ abstract class MVController extends CommonController } return $options; } - final protected function getFormFieldRules(array $rules = []): array - { - foreach ($this->fields as $field) { - if (is_array($field)) { - throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true)); - } - $rules = $this->getModel()->getFieldRule($field, $rules); - } - // var_dump($rules); - // exit; - return $rules; - } //전송된 데이터 protected function getFormData(string $field, array $formDatas): array { @@ -98,13 +89,11 @@ abstract class MVController extends CommonController } } // 생성 - protected function create_form_process(): void - { - } + protected function create_form_process(): void {} public function create_form(): RedirectResponse|string { - helper(['form']); try { + helper(['form']); $this->create_init(); $this->create_form_process(); $this->session->keepFlashdata(SESSION_NAMES['RETURN_URL']); @@ -122,9 +111,7 @@ abstract class MVController extends CommonController { $this->validateFormDatas($this->fields); } - protected function create_process(): void - { - } + protected function create_process(): void {} public function create(): RedirectResponse { try { @@ -150,13 +137,11 @@ abstract class MVController extends CommonController { $this->validateFormDatas($this->fields); } - protected function modify_form_process(): void - { - } + protected function modify_form_process(): void {} public function modify_form(): RedirectResponse|string { - helper(['form']); try { + helper(['form']); $this->modify_init(); $this->formDatas = $this->getFormDatas(); //기존 데이터 가져오기 @@ -176,9 +161,7 @@ abstract class MVController extends CommonController return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with(SESSION_NAMES['RETURN_MSG'], $e->getMessage()); } } - protected function modify_process(): void - { - } + protected function modify_process(): void {} public function modify(): mixed { try { @@ -282,7 +265,7 @@ abstract class MVController extends CommonController // echo $this->getModel()->getLastQuery(); return $entitys; } - public function list(): string + public function index(): string { try { helper(['form']); diff --git a/app/Helpers/Admin/Cloudflare/Record_helper.php b/app/Helpers/Admin/Cloudflare/Record_helper.php new file mode 100644 index 0000000..18e175b --- /dev/null +++ b/app/Helpers/Admin/Cloudflare/Record_helper.php @@ -0,0 +1,138 @@ +%s", + implode(" ", $attributes), + lang("{$viewDatas['class_path']}.label.{$field}") + ); + break; + } + return $label; +} +//header.php에서 getFieldForm_Helper사용 +function getFieldForm_RecordHelper(string $field, mixed $value, array $viewDatas, array $attributes = []): string +{ + $value = $value ?: DEFAULTS['EMPTY']; + switch ($field) { + case 'user_uid': + $form = form_dropdown($field, $viewDatas['field_options'][$field], $value, [...$attributes, 'class' => "select-field"]); + // // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + // foreach ($viewDatas['field_options'][$field] as $key => $label) { + // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; + // } + // return implode(" ", $checkboxs); + break; + case 'content': + case 'head': + case 'tail': + $form = form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); + break; + case "type": + case "status": + $form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $attributes); + break; + case 'id': + $form = form_input($field, $value, ["placeholder" => "예)sample@test.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); + break; + case 'name': + $form = form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); + break; + case 'updated_at': + case 'created_at': + $form = form_input($field, $value, ['class' => 'calender']); + break; + default: + $form = form_input($field, $value, ["style" => "width:60%;"]); + break; + } + return $form; +} // + +function getFieldView_RecordHelper(string $field, mixed $entity, array $viewDatas, array $attributes = []) +{ + $value = $entity->$field ?: DEFAULTS['EMPTY']; + switch ($field) { + case 'category_uid': + foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) { + foreach ($category_2depths as $key => $depth) { + if ($key == $depth) { + $value = $depth; + } + } + } + break; + case 'cost': + case 'price': + case 'sale': + $value = number_format(!$value ? 0 : $value) . "원"; + break; + case 'stock': + case 'view_cnt': + $value = number_format(!$value ? 0 : $value); + break; + case 'content': + $value = html_entity_decode($value); + break; + case 'updated_at': + case 'created_at': + $value = $value ? date("Y-m-d", strtotime($value)) : ""; + break; + default: + if (in_array($field, $viewDatas['filter_fields']) && $value) { + $value = $viewDatas['field_options'][$field][$value]; + } + break; + } + return $value; +} // + +function getListHeaders_RecordHelper(string $field, array $viewDatas, array $attributes = []): string +{ + $label = getFieldLabel_RecordHelper($field, $viewDatas, $attributes); + if ($field == $viewDatas['order_field']) { + $label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"]; + } + $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + $viewDatas['uri']->addQuery('order_field', $field); + $viewDatas['uri']->addQuery('order_value', $order_value); + $header = anchor((string)$viewDatas['uri'], $label); + switch ($field) { + case 'title': + $attributes = [...$attributes, "class=\"col-2\""]; + break; + } + return sprintf("%s", implode(" ", $attributes), $header); +} +function getListColumns_RecordHelper(string $field, mixed $entity, array $viewDatas, array $attributes = []): string +{ + switch ($field) { + case 'title': + case 'name': + $value = anchor( + current_url() . '/view/' . $entity->getPK(), + getFieldView_RecordHelper($field, $entity, $viewDatas), + ["target" => "_self"] + ); + break; + default: + if (in_array($field, $viewDatas['filter_fields'])) { + $attributes["onChange"] = sprintf( + 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + current_url(), + $entity->getPK(), + $field, + $field + ); + $value = getFieldForm_RecordHelper($field, $entity, $viewDatas, $attributes); + } + $value = getFieldView_RecordHelper($field, $entity, $viewDatas); + break; + } + return $value; +} diff --git a/app/Helpers/Admin/Cloudflare/Zone_helper.php b/app/Helpers/Admin/Cloudflare/Zone_helper.php index b5e495b..516a3da 100644 --- a/app/Helpers/Admin/Cloudflare/Zone_helper.php +++ b/app/Helpers/Admin/Cloudflare/Zone_helper.php @@ -1,67 +1,138 @@ %s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}")); + $label = sprintf( + "%s", + implode(" ", $attributes), + lang("{$viewDatas['class_path']}.label.{$field}") + ); break; } return $label; } //header.php에서 getFieldForm_Helper사용 -function getFieldForm_ZoneHelper($field, $value, array $viewDatas, array $attributes = []) +function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas, array $attributes = []): string { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { - case 'category_uid': case 'user_uid': - $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; - return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]); - // // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); - // foreach ($viewDatas['fieldFormOptions'][$field] as $key => $label) { + $form = form_dropdown($field, $viewDatas['field_options'][$field], $value, [...$attributes, 'class' => "select-field"]); + // // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + // foreach ($viewDatas['field_options'][$field] as $key => $label) { // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; // } // return implode(" ", $checkboxs); break; - case 'title': - case 'name': - return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); - break; case 'content': case 'head': case 'tail': - return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); + $form = form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); break; + case "type": case "status": - case "category": - $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; - return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes); + $form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $attributes); + break; + case 'id': + $form = form_input($field, $value, ["placeholder" => "예)sample@test.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); + break; + case 'name': + $form = form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); break; case 'updated_at': case 'created_at': - return form_input($field, $value, ['class' => 'calender']); + $form = form_input($field, $value, ['class' => 'calender']); break; default: - return form_input($field, $value); + $form = form_input($field, $value, ["style" => "width:60%;"]); break; } + return $form; } // -protected function list_field_columns(): array +function getFieldView_ZoneHelper(string $field, mixed $entity, array $viewDatas, array $attributes = []) { - $columns = []; - foreach ($this->fields as $field) { - $label = lang("{$this->class_path}.label.{$field}"); - if ($field == $this->order_field) { - $label .= $this->order_value == 'ASC' ? ICONS["UP"] : ICONS["DOWN"]; - $this->order_value = $this->order_value == 'DESC' ? "ASC" : "DESC"; - } else { - $this->order_value = "ASC"; - } - $columns[] = anchor(current_url() . "?order_field={$field}&order_value={$this->order_value}", $label); + $value = $entity->$field ?: DEFAULTS['EMPTY']; + switch ($field) { + case 'category_uid': + foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) { + foreach ($category_2depths as $key => $depth) { + if ($key == $depth) { + $value = $depth; + } + } + } + break; + case 'cost': + case 'price': + case 'sale': + $value = number_format(!$value ? 0 : $value) . "원"; + break; + case 'stock': + case 'view_cnt': + $value = number_format(!$value ? 0 : $value); + break; + case 'content': + $value = html_entity_decode($value); + break; + case 'updated_at': + case 'created_at': + $value = $value ? date("Y-m-d", strtotime($value)) : ""; + break; + default: + if (in_array($field, $viewDatas['filter_fields']) && $value) { + $value = $viewDatas['field_options'][$field][$value]; + } + break; } - return $columns; -} \ No newline at end of file + return $value; +} // + +function getListHeaders_ZoneHelper(string $field, array $viewDatas, array $attributes = []): string +{ + $label = getFieldLabel_ZoneHelper($field, $viewDatas, $attributes); + if ($field == $viewDatas['order_field']) { + $label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"]; + } + $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + $viewDatas['uri']->addQuery('order_field', $field); + $viewDatas['uri']->addQuery('order_value', $order_value); + $header = anchor((string)$viewDatas['uri'], $label); + switch ($field) { + case 'title': + $attributes = [...$attributes, "class=\"col-2\""]; + break; + } + return sprintf("%s", implode(" ", $attributes), $header); +} +function getListColumns_ZoneHelper(string $field, mixed $entity, array $viewDatas, array $attributes = []): string +{ + switch ($field) { + case 'title': + case 'name': + $value = anchor( + current_url() . '/view/' . $entity->getPK(), + getFieldView_ZoneHelper($field, $entity, $viewDatas), + ["target" => "_self"] + ); + break; + default: + if (in_array($field, $viewDatas['filter_fields'])) { + $attributes["onChange"] = sprintf( + 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + current_url(), + $entity->getPK(), + $field, + $field + ); + $value = getFieldForm_ZoneHelper($field, $entity, $viewDatas, $attributes); + } + $value = getFieldView_ZoneHelper($field, $entity, $viewDatas); + break; + } + return $value; +} diff --git a/app/Libraries/MyCloudflare/Account.php b/app/Libraries/MyCloudflare/Account.php index e13c999..0d0875b 100644 --- a/app/Libraries/MyCloudflare/Account.php +++ b/app/Libraries/MyCloudflare/Account.php @@ -68,9 +68,8 @@ class Account extends MyCloudflare // log_message("notice", "Account::" . __FUNCTION__ . "=> 작업을 완료하였습니다."); // return $entity; // } - public function create($formDatas): array + public function create(array $formDatas): array { - $this->_authkey = $formDatas['authkey']; //Account의 경우 인증키를 가지고있고 생성할수 없으므로 get으로 읽은후 첫번째것을 사용하기로 함 $entitys = []; foreach ($this->reload_cfs($this->getRequest(), 'accounts') as $cf) { diff --git a/app/Libraries/MyCloudflare/Record.php b/app/Libraries/MyCloudflare/Record.php index 776450a..a6e6d32 100644 --- a/app/Libraries/MyCloudflare/Record.php +++ b/app/Libraries/MyCloudflare/Record.php @@ -3,7 +3,7 @@ namespace App\Libraries\MyCloudflare; use Cloudflare\API\Adapter\Guzzle; -use App\Models\Cloudflare\API\RecordModel; +use App\Models\Cloudflare\RecordModel; use App\Libraries\MyCloudflare\MyCloudflare; use App\Entities\Cloudflare\ZoneEntity; use App\Entities\Cloudflare\RecordEntity; diff --git a/app/Libraries/MyCloudflare/Zone.php b/app/Libraries/MyCloudflare/Zone.php index 49a979e..8fcb3f1 100644 --- a/app/Libraries/MyCloudflare/Zone.php +++ b/app/Libraries/MyCloudflare/Zone.php @@ -91,14 +91,14 @@ class Zone extends MyCloudflare $entity->$field = $cf->result->value; return $entity; } - public function create(string $domain, $jump_start = false): ZoneEntity + public function create(string $domain, array $formDatas): ZoneEntity { //Socket용 //도메인생성을 위해 Cloudflare에 전송 $cf = $this->getRequest()->post('zones/', [ 'accountId' => $this->_account_entity->getPK(), 'name' => $domain, - 'jump_start' => $jump_start, + 'jump_start' => array_key_exists('jump_start', $formDatas) ? $formDatas['jumb_start'] : false, ]); $cf = json_decode($cf->getBody()); if (!$cf->success) { diff --git a/app/Models/Cloudflare/RecordModel.php b/app/Models/Cloudflare/RecordModel.php index 96e9ba6..156d9e9 100644 --- a/app/Models/Cloudflare/RecordModel.php +++ b/app/Models/Cloudflare/RecordModel.php @@ -2,11 +2,11 @@ namespace App\Models\Cloudflare; -use CodeIgniter\Model; use App\Entities\Cloudflare\ZoneEntity; use App\Entities\Cloudflare\RecordEntity; +use App\Models\CommonModel; -class RecordModel extends Model +class RecordModel extends CommonModel { const TABLE = "cloudflarerecord"; const PK = "uid"; diff --git a/app/Models/CommonModel.php b/app/Models/CommonModel.php index 4a3f1b9..09aedc3 100644 --- a/app/Models/CommonModel.php +++ b/app/Models/CommonModel.php @@ -63,10 +63,10 @@ abstract class CommonModel extends Model { return $this->_action = $action; } - final public function getFields(array $except_fields = []): array - { - return array_diff($this->allowedFields, $except_fields); //제외한 fields - } + // final public function getFields(array $except_fields = []): array + // { + // return array_diff($this->allowedFields, $except_fields); //제외한 fields + // } public function getFieldRule(string $field, array $rules): array { if (is_array($field)) { @@ -80,8 +80,7 @@ abstract class CommonModel extends Model $rules[$field] .= $this->getAction() == "create" ? "|is_unique[{$this->table}.{$field}]" : ""; } else { $rules[$field] = "required|numeric"; - } - ; + }; break; case $this->getTitleField(): $rules[$field] = "required|string"; diff --git a/app/Views/admin/cloudflare/account/index.php b/app/Views/admin/cloudflare/account/index.php index 5f5e870..e4c4918 100644 --- a/app/Views/admin/cloudflare/account/index.php +++ b/app/Views/admin/cloudflare/account/index.php @@ -73,9 +73,9 @@
+ "get")) ?> + + + + + + + + + + + + + + + + + status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> + + + + + + + + + +
번호작업
+ "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?> + getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> + + getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> +
+
+ +
+
+ +
+
+
+ +endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/cloudflare/zone/create.php b/app/Views/admin/cloudflare/zone/create.php new file mode 100644 index 0000000..387d088 --- /dev/null +++ b/app/Views/admin/cloudflare/zone/create.php @@ -0,0 +1,19 @@ + + + + + + + + + + + + + +
+ + +
+ "btn btn-outline btn-primary")); ?> +
\ No newline at end of file diff --git a/app/Views/admin/cloudflare/zone/index.php b/app/Views/admin/cloudflare/zone/index.php new file mode 100644 index 0000000..88e95e1 --- /dev/null +++ b/app/Views/admin/cloudflare/zone/index.php @@ -0,0 +1,83 @@ +extend("layouts/{$viewDatas['layout']}") ?> +section('content') ?> + + + "get")) ?> + + + + + + + + + + + + + + + + + status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> + + + + + + + + + +
번호작업
+ "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?> + getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> + + getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> +
+
+ +
+
+ +
+
+
+ +endSection() ?> \ No newline at end of file diff --git a/public/css/admin/content.css b/public/css/admin/content.css index 7d9db75..b20c549 100644 --- a/public/css/admin/content.css +++ b/public/css/admin/content.css @@ -100,6 +100,7 @@ div.index_pagination nav ul.pagination li a:hover { border: 1px solid black; } div.index_form { + margin-top:30px; text-align: center; /* border: 1px solid red; */ }