From de0b53f4f6c8ccc0cb798a507752cf64f66a646f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0git=20config=20git=20config=20-?= =?UTF-8?q?-helpgit=20config=20--global=20user=2Ename=20=EC=B5=9C=EC=A4=80?= =?UTF-8?q?=ED=9D=A0?= Date: Sat, 22 Jul 2023 06:12:35 +0900 Subject: [PATCH] servermgrv2 init... --- .../Admin/BoardConfigController.php | 4 +-- app/Controllers/Admin/BoardController.php | 28 +----------------- app/Controllers/Admin/LoggerController.php | 5 +--- app/Controllers/Admin/UserSNSController.php | 5 +--- app/Controllers/BaseController.php | 7 ++--- app/Helpers/Admin/BoardConfig_helper.php | 22 ++++++++++---- app/Helpers/Admin/Board_helper.php | 7 +++-- app/Helpers/Admin/Logger_helper.php | 8 ++--- app/Helpers/Admin/UserSNS_helper.php | 8 ++--- app/Helpers/Admin/User_helper.php | 7 +++-- app/Language/kr/Admin/Board.php | 29 +++++++++++++++++++ app/Language/kr/Admin/BoardConfig.php | 26 +++++++++++++++++ app/Language/kr/Admin/Logger.php | 18 ++++++++++++ app/Language/kr/Admin/User.php | 18 ++++++++++++ app/Language/kr/Admin/UserSNS.php | 18 ++++++++++++ app/Language/kr/Admin/Validation.php | 4 +++ app/Views/admin/boardconfig/insert.php | 8 +++++ app/Views/admin/boardconfig/update.php | 8 +++++ 18 files changed, 168 insertions(+), 62 deletions(-) create mode 100644 app/Language/kr/Admin/Board.php create mode 100644 app/Language/kr/Admin/BoardConfig.php create mode 100644 app/Language/kr/Admin/Logger.php create mode 100644 app/Language/kr/Admin/User.php create mode 100644 app/Language/kr/Admin/UserSNS.php create mode 100644 app/Language/kr/Admin/Validation.php diff --git a/app/Controllers/Admin/BoardConfigController.php b/app/Controllers/Admin/BoardConfigController.php index 33b6b4a..dac7686 100644 --- a/app/Controllers/Admin/BoardConfigController.php +++ b/app/Controllers/Admin/BoardConfigController.php @@ -65,12 +65,12 @@ class BoardConfigController extends \App\Controllers\Admin\AdminController ], 'index' => [ 'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'], - 'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'], + 'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'], 'batchjobFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'], ], 'excel' => [ 'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'], - 'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'], + 'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'], ], ]; helper($this->_className); diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index 63d48b7..dc827e4 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -66,29 +66,6 @@ class BoardController extends \App\Controllers\Admin\AdminController $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); $this->_viewDatas['className'] = $this->_className; - //게시판 초기화 - $this->initConfig(); - } - - private function initConfig() - { - foreach ((array)lang($this->_className . '.BOARD_CATEGORY') as $key => $label) { - $this->_viewDatas['board_configs'][$key] = [ - 'isHierarchy' => getenv("board.{$key}.hierarchy") ?: false, - 'isAccess' => getenv("board.{$key}.access") ?: true, - 'isAccessRoles' => getenv("board.{$key}.access.roles") ?: array_values(ROLES), - 'isRead' => getenv("board.{$key}.read") ?: true, - 'isReadRoles' => getenv("board.{$key}.read.roles") ?: array_values(ROLES), - 'isWrite' => getenv("board.{$key}.write") ?: false, - 'isWriteRoles' => getenv("board.{$key}.write.roles") ?: array_values(ROLES), - 'isReply' => getenv("board.{$key}.reply") ?: false, - 'isReplyRoles' => getenv("board.{$key}.reply.roles") ?: array_values(ROLES), - 'isUpload' => getenv("board.{$key}.upload") ?: false, - 'isUploadRoles' => getenv("board.{$key}.upload.roles") ?: array_values(ROLES), - ]; - } - // echo var_export($this->_viewDatas['board_configs'], true); - // exit; } private function getUserModel(): UserModel @@ -103,10 +80,7 @@ class BoardController extends \App\Controllers\Admin\AdminController case 'user_uid': if (is_null($this->_user_uids)) { //모든 필요한 FormOption등 조기화작업 필요 - $this->_user_uids = $this->getUserModel()->getFieldFormOptions( - ['status' => 'use'], - [DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택'] - ); + $this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']); } return $this->_user_uids; default: diff --git a/app/Controllers/Admin/LoggerController.php b/app/Controllers/Admin/LoggerController.php index ea5df47..40b5533 100644 --- a/app/Controllers/Admin/LoggerController.php +++ b/app/Controllers/Admin/LoggerController.php @@ -51,10 +51,7 @@ class LoggerController extends \App\Controllers\Admin\AdminController case 'user_uid': if (is_null($this->_user_uids)) { //모든 필요한 FormOption등 조기화작업 필요 - $this->_user_uids = $this->getUserModel()->getFieldFormOptions( - ['status' => 'use'], - [DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택'] - ); + $this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']); } return $this->_user_uids; break; diff --git a/app/Controllers/Admin/UserSNSController.php b/app/Controllers/Admin/UserSNSController.php index d94ab51..cef0d82 100644 --- a/app/Controllers/Admin/UserSNSController.php +++ b/app/Controllers/Admin/UserSNSController.php @@ -51,10 +51,7 @@ class UserSNSController extends \App\Controllers\Admin\AdminController case 'user_uid': if (is_null($this->_user_uids)) { //모든 필요한 FormOption등 조기화작업 필요 - $this->_user_uids = $this->getUserModel()->getFieldFormOptions( - ['status' => 'use'], - [DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택'] - ); + $this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']); } return $this->_user_uids; break; diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index dc05846..d66a3a8 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -79,14 +79,11 @@ abstract class BaseController extends Controller { switch ($field) { default: - $fieldFormOptionDatas = (array)lang($this->_className . '.' . strtoupper($field)); + $fieldFormOptionDatas = lang($this->_className . '.' . strtoupper($field)); if (!is_array($fieldFormOptionDatas)) { throw new \Exception(__FUNCTION__ . "에서 {$field}의 데이터가 array가 아닙니다.\n" . var_export($fieldFormOptionDatas, true)); } - return [ - DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택', - ...$fieldFormOptionDatas - ]; + return $fieldFormOptionDatas; break; } } diff --git a/app/Helpers/Admin/BoardConfig_helper.php b/app/Helpers/Admin/BoardConfig_helper.php index dcec12f..575a571 100644 --- a/app/Helpers/Admin/BoardConfig_helper.php +++ b/app/Helpers/Admin/BoardConfig_helper.php @@ -14,7 +14,7 @@ function getFieldLabel_BoardConfigHelper($field, array $fieldRules, array $attri //header.php에서 getFieldForm_Helper사용 function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'isaccess': case 'isread': @@ -22,8 +22,14 @@ function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, arra case 'isreply': case 'isupload': case 'isdownload': + foreach ($formOptions[$field] as $key => $label) { + $checkboxs[] = form_checkbox("{$field}[]", $key, $key != 'guest' || $key == $value, $attributes) . $label; + } + return implode(" ", $checkboxs); + break; case 'status': - return form_multiselect($field, $formOptions[$field], explode('|', $value), [...$attributes, 'row' => 10]); + $formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$formOptions[$field]]; + return form_dropdown($field, $formOptions[$field], $value, $attributes); break; case 'updated_at': case 'created_at': @@ -46,18 +52,22 @@ function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, arra function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) { switch ($field) { + case 'head': + case 'tail': + return html_entity_decode($entity->$field); + break; default: if (in_array($field, $fieldFilters)) { return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes); } - return $entity->$field; + return $entity->$field ?: DEFAULTS['EMPTY']; break; } } // function getFieldFilter_BoardConfigHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'isaccess': case 'isread': @@ -65,8 +75,8 @@ function getFieldFilter_BoardConfigHelper($field, $value, array $formOptions, ar case 'isreply': case 'isupload': case 'isdownload': - case 'status': - return form_dropdown($field, $formOptions[$field], explode('|', $value), [...$attributes, 'row' => 10]); + $formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$formOptions[$field]]; + return form_dropdown($field, $formOptions[$field], $value, $attributes); break; default: return getFieldForm_BoardConfigHelper($field, $value, $formOptions, $attributes); diff --git a/app/Helpers/Admin/Board_helper.php b/app/Helpers/Admin/Board_helper.php index ebb5ccb..5fcc491 100644 --- a/app/Helpers/Admin/Board_helper.php +++ b/app/Helpers/Admin/Board_helper.php @@ -14,11 +14,12 @@ function getFieldLabel_BoardHelper($field, array $fieldRules, array $attributes //header.php에서 getFieldForm_Helper사용 function getFieldForm_BoardHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'board_category': case 'user_uid': case 'status': + $formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$formOptions[$field]]; return form_dropdown($field, $formOptions[$field], $value, $attributes); break; case 'updated_at': @@ -51,14 +52,14 @@ function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $f if (in_array($field, $fieldFilters)) { return getFieldForm_BoardHelper($field, $entity->$field, $fieldFormOptions, $attributes); } - return $entity->$field; + return $entity->$field ?: DEFAULTS['EMPTY']; break; } } // function getFieldFilter_BoardHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { default: return getFieldForm_BoardHelper($field, $value, $formOptions, $attributes); diff --git a/app/Helpers/Admin/Logger_helper.php b/app/Helpers/Admin/Logger_helper.php index 77d5182..4b66080 100644 --- a/app/Helpers/Admin/Logger_helper.php +++ b/app/Helpers/Admin/Logger_helper.php @@ -14,10 +14,11 @@ function getFieldLabel_LoggerHelper($field, array $fieldRules, array $attributes //header.php에서 getFieldForm_Helper사용 function getFieldForm_LoggerHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'user_uid': case 'status': + $formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Logger.label.{$field}") . " 선택", ...$formOptions[$field]]; return form_dropdown($field, $formOptions[$field], $value, $attributes); break; case 'updated_at': @@ -40,15 +41,14 @@ function getFieldView_LoggerHelper($field, $entity, array $fieldFilters, array $ if (in_array($field, $fieldFilters)) { return getFieldForm_LoggerHelper($field, $entity->$field, $fieldFormOptions, $attributes); } - return !isset($entity->$field) ? "{$field}:{$entity->uid}" : $entity->$field; - return $entity->$field; + return $entity->$field ?: DEFAULTS['EMPTY']; break; } } // function getFieldFilter_LoggerHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { default: return getFieldForm_LoggerHelper($field, $value, $formOptions, $attributes); diff --git a/app/Helpers/Admin/UserSNS_helper.php b/app/Helpers/Admin/UserSNS_helper.php index aa50cd6..d615e6e 100644 --- a/app/Helpers/Admin/UserSNS_helper.php +++ b/app/Helpers/Admin/UserSNS_helper.php @@ -14,10 +14,11 @@ function getFieldLabel_UserSNSHelper($field, array $fieldRules, array $attribute //header.php에서 getFieldForm_Helper사용 function getFieldForm_UserSNSHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'user_uid': case 'status': + $formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/UserSNS.label.{$field}") . " 선택", ...$formOptions[$field]]; return form_dropdown($field, $formOptions[$field], $value, $attributes); break; case 'updated_at': @@ -37,15 +38,14 @@ function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array if (in_array($field, $fieldFilters)) { return getFieldForm_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes); } - return !isset($entity->$field) ? "{$field}:{$entity->uid}" : $entity->$field; - return $entity->$field; + return $entity->$field ?: DEFAULTS['EMPTY']; break; } } // function getFieldFilter_UserSNSHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { default: return getFieldForm_UserSNSHelper($field, $value, $formOptions, $attributes); diff --git a/app/Helpers/Admin/User_helper.php b/app/Helpers/Admin/User_helper.php index 7015b80..b04778e 100644 --- a/app/Helpers/Admin/User_helper.php +++ b/app/Helpers/Admin/User_helper.php @@ -14,10 +14,11 @@ function getFieldLabel_UserHelper($field, array $fieldRules, array $attributes = //header.php에서 getFieldForm_Helper사용 function getFieldForm_UserHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'role': case 'status': + $formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$formOptions[$field]]; return form_dropdown($field, $formOptions[$field], $value, $attributes); break; case 'updated_at': @@ -41,14 +42,14 @@ function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fi if (in_array($field, $fieldFilters)) { return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes); } - return $entity->$field; + return $entity->$field ?: DEFAULTS['EMPTY']; break; } } // function getFieldFilter_UserHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULTS['EMPTY'] : $value; + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { default: return getFieldForm_UserHelper($field, $value, $formOptions, $attributes); diff --git a/app/Language/kr/Admin/Board.php b/app/Language/kr/Admin/Board.php new file mode 100644 index 0000000..44c47f3 --- /dev/null +++ b/app/Language/kr/Admin/Board.php @@ -0,0 +1,29 @@ + "게시판 정보", + 'label' => [ + 'uid' => "번호", + 'grpno' => "그룹번호", + 'grpord' => "부모번호", + 'grpdpt' => "그룸Depth", + 'board_category' => "게시판구분", + 'user_uid' => "작성자", + 'title' => "제목", + 'content' => "내용", + 'passwd' => "암호", + 'confirmpassword' => "암호확인", + 'view_cnt' => "조회수", + 'upload_file' => "UploadFile", + 'status' => "상태", + 'updated_at' => "수정일", + 'created_at' => "작성일" + ], + "BOARD_CATEGORY" => [ + 'notice' => '공지사항', + 'faq' => 'FAQ', + 'qna' => '1:1문의', + 'data' => '자료실' + ], + "USER_UID" => [], + "STATUS" => [...STATUS], +]; diff --git a/app/Language/kr/Admin/BoardConfig.php b/app/Language/kr/Admin/BoardConfig.php new file mode 100644 index 0000000..03b8cdf --- /dev/null +++ b/app/Language/kr/Admin/BoardConfig.php @@ -0,0 +1,26 @@ + "게시판설정 정보", + 'label' => [ + 'uid' => "번호", + 'name' => "게시판제목", + 'isaccess' => "접속권한", + 'isread' => "읽기권한", + 'iswrite' => "쓰기권한", + 'isreply' => "답변권한", + 'isupload' => "Upload권한", + 'isdownload' => "Download권한", + 'head' => "머리글", + 'tail' => "아래글", + 'status' => "상태", + 'updated_at' => "수정일", + 'created_at' => "작성일" + ], + "ISACCESS" => [...ROLES], + "ISREAD" => [...ROLES], + "ISWRITE" => [...ROLES], + "ISREPLY" => [...ROLES], + "ISUPLOAD" => [...ROLES], + "ISDOWNLOAD" => [...ROLES], + "STATUS" => [...STATUS], +]; diff --git a/app/Language/kr/Admin/Logger.php b/app/Language/kr/Admin/Logger.php new file mode 100644 index 0000000..fa118a7 --- /dev/null +++ b/app/Language/kr/Admin/Logger.php @@ -0,0 +1,18 @@ + "Logger 정보", + 'label' => [ + 'uid' => "번호", + 'user_uid' => "사용자명", + 'title' => "제목", + 'content' => "내용", + 'status' => "상태", + 'updated_at' => "수정일", + 'created_at' => "작성일" + ], + "USER_UID" => [], + "STATUS" => [ + "use" => "정상", + "unuse" => "오류", + ] +]; diff --git a/app/Language/kr/Admin/User.php b/app/Language/kr/Admin/User.php new file mode 100644 index 0000000..5226b24 --- /dev/null +++ b/app/Language/kr/Admin/User.php @@ -0,0 +1,18 @@ + "회원 정보", + 'label' => [ + 'uid' => "번호", + 'id' => "계정", + 'passwd' => "암호", + 'confirmpassword' => "암호확인", + 'email' => "메일", + 'role' => "권한", + 'name' => "이름", + 'status' => "상태", + 'updated_at' => "수정일", + 'created_at' => "작성일" + ], + "ROLE" => [...ROLES], + "STATUS" => [...STATUS], +]; diff --git a/app/Language/kr/Admin/UserSNS.php b/app/Language/kr/Admin/UserSNS.php new file mode 100644 index 0000000..22db1cc --- /dev/null +++ b/app/Language/kr/Admin/UserSNS.php @@ -0,0 +1,18 @@ + "SNS 계정정보", + 'label' => [ + 'uid' => "인증번호", + 'user_uid' => "사용자", + 'site' => "SNS명", + 'id' => "SNS ID", + 'name' => "SNS 이름", + 'email' => "SNS 메일", + 'detail' => "SNS 정보", + 'status' => "상태", + 'updated_at' => "수정일", + 'created_at' => "작성일" + ], + "USER_UID" => [], + "STATUS" => [...STATUS, "standby" => "승인대기"], +]; diff --git a/app/Language/kr/Admin/Validation.php b/app/Language/kr/Admin/Validation.php new file mode 100644 index 0000000..54d1e7a --- /dev/null +++ b/app/Language/kr/Admin/Validation.php @@ -0,0 +1,4 @@ + getFlashdata('error')) : ?>getFlashdata('error') ?> + + include('templates/admin/footer'); ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/boardconfig/update.php b/app/Views/admin/boardconfig/update.php index 3134fb4..3fee288 100644 --- a/app/Views/admin/boardconfig/update.php +++ b/app/Views/admin/boardconfig/update.php @@ -20,5 +20,13 @@ getFlashdata('error')) : ?>getFlashdata('error') ?> + + include('templates/admin/footer'); ?> endSection() ?> \ No newline at end of file