From dabab59d21638e0686bc9791810c57aa2b861d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Fri, 4 Aug 2023 09:48:56 +0900 Subject: [PATCH] shoppingmallv2 init... --- app/Controllers/Admin/BoardController.php | 1 - app/Controllers/Front/BoardController.php | 8 ++++---- app/Database/base.sql | 2 +- app/Database/shoppingmall.sql | 2 +- app/Entities/BoardEntity.php | 12 ++++++++---- app/Helpers/Board_helper.php | 11 ++++++++++- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index 42e0d98..e4c6257 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -2,7 +2,6 @@ namespace App\Controllers\Admin; -use App\Models\BoardConfigModel; use App\Models\BoardModel; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; diff --git a/app/Controllers/Front/BoardController.php b/app/Controllers/Front/BoardController.php index dccdd02..8898442 100644 --- a/app/Controllers/Front/BoardController.php +++ b/app/Controllers/Front/BoardController.php @@ -20,14 +20,14 @@ class BoardController extends FrontController public function getFields(string $action = ""): array { - $fields = ["category_uid", 'title', "board_file", "passwd", "content"]; + $fields = ['title', "board_file", "passwd", "content"]; switch ($action) { case "index": case "excel": - return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at"]; + return ['title', "board_file", "view_cnt", "created_at"]; break; case "view": - return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at", "content"]; + return ['title', "board_file", "view_cnt", "created_at", "content"]; break; default: return $fields; @@ -36,7 +36,7 @@ class BoardController extends FrontController } public function getFieldFilters(): array { - return ["category_uid", "user_uid"]; + return []; } public function getFieldBatchFilters(): array { diff --git a/app/Database/base.sql b/app/Database/base.sql index 0a27822..972ccb3 100644 --- a/app/Database/base.sql +++ b/app/Database/base.sql @@ -79,7 +79,7 @@ CREATE TABLE servermgr.tw_board ( grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함', grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작', grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요', - cartory_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID', + category_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID', user_uid varchar(36) NULL COMMENT '작성자 정보', title varchar(255) NOT NULL COMMENT '제목', content text NOT NULL COMMENT '내용', diff --git a/app/Database/shoppingmall.sql b/app/Database/shoppingmall.sql index 602acd1..eeac1f6 100644 --- a/app/Database/shoppingmall.sql +++ b/app/Database/shoppingmall.sql @@ -47,7 +47,7 @@ CREATE TABLE shoppingmall.tw_board ( grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함', grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작', grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요', - cartory_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID', + category_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID', user_uid varchar(36) NULL COMMENT '작성자 정보', title varchar(255) NOT NULL COMMENT '제목', content text NOT NULL COMMENT '내용', diff --git a/app/Entities/BoardEntity.php b/app/Entities/BoardEntity.php index 3580fb3..4dd4f26 100644 --- a/app/Entities/BoardEntity.php +++ b/app/Entities/BoardEntity.php @@ -23,6 +23,14 @@ class BoardEntity extends BaseHierarchyEntity } //추가기능 + public function getCategory_Uid() + { + return $this->attributes['category_uid']; + } + public function getUser_Uid() + { + return $this->attributes['user_uid']; + } public function getPassword() { return $this->attributes['passwd']; @@ -31,8 +39,4 @@ class BoardEntity extends BaseHierarchyEntity { return $this->attributes['view_cnt']; } - public function getUser_Uid() - { - return $this->attributes['user_uid']; - } } diff --git a/app/Helpers/Board_helper.php b/app/Helpers/Board_helper.php index aa8e1ae..a740168 100644 --- a/app/Helpers/Board_helper.php +++ b/app/Helpers/Board_helper.php @@ -15,7 +15,7 @@ function getFieldLabel_BoardHelper($field, array $fieldRules, array $attributes function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array $attributes = array()) { switch ($field) { - case "board_config_uid": + case "category_uid": case "user_uid": $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); @@ -59,6 +59,15 @@ function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $f { $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { + case 'category_uid': + $categorys = array(); + foreach (array_values($fieldFormOptions[$field]) as $category_2depth) { + foreach ($category_2depth as $key => $label) { + $categorys[$key] = $label; + } + } + return $categorys[$value]; + break; case 'title': return sprintf( "
%s %s
",