From d2a11bc1eda1610d5ffc71453b5592b7a8f7bd3d 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: Thu, 3 Aug 2023 22:32:00 +0900 Subject: [PATCH] servermgrv2 init... --- app/Config/Constants.php | 2 + app/Config/Routes.php | 43 ++++------- app/Config/Routes_HPILO.php | 43 ++++------- app/Controllers/Admin/BoardController.php | 8 +- ...gController.php => CategoryController.php} | 10 +-- app/Controllers/Front/BoardController.php | 9 +-- app/Database/base.sql | 75 ++++++++----------- ...ardConfigEntity.php => CategoryEntity.php} | 6 +- ...dConfig_helper.php => Category_helper.php} | 55 +++++++++----- app/Language/ko/Board.php | 2 +- .../ko/{BoardConfig.php => Category.php} | 5 +- app/Models/BoardModel.php | 16 ++-- ...BoardConfigModel.php => CategoryModel.php} | 55 ++++++++------ .../admin/{boardconfig => category}/index.php | 10 +-- .../{boardconfig => category}/insert.php | 4 +- app/Views/admin/category/reply.php | 21 ++++++ .../{boardconfig => category}/update.php | 6 +- .../admin/{boardconfig => category}/view.php | 4 +- app/Views/layouts/admin/left_menu/board.php | 2 +- 19 files changed, 192 insertions(+), 184 deletions(-) rename app/Controllers/Admin/{BoardConfigController.php => CategoryController.php} (80%) rename app/Entities/{BoardConfigEntity.php => CategoryEntity.php} (82%) rename app/Helpers/{BoardConfig_helper.php => Category_helper.php} (59%) rename app/Language/ko/{BoardConfig.php => Category.php} (91%) rename app/Models/{BoardConfigModel.php => CategoryModel.php} (67%) rename app/Views/admin/{boardconfig => category}/index.php (79%) rename app/Views/admin/{boardconfig => category}/insert.php (76%) create mode 100644 app/Views/admin/category/reply.php rename app/Views/admin/{boardconfig => category}/update.php (61%) rename app/Views/admin/{boardconfig => category}/view.php (67%) diff --git a/app/Config/Constants.php b/app/Config/Constants.php index b10f32b..a45e15e 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -133,6 +133,8 @@ define('LAYOUTS', [ '', '', '', + '', + '', '', ], 'javascripts' => [ diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6783ee0..7dd29ec 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -39,10 +39,6 @@ $routes->get('/login', 'AuthController::login'); $routes->post('/signup', 'AuthController::signup/local'); $routes->get('/signup/(:alpha)', 'AuthController::signup/$1'); $routes->get('/logout', 'AuthController::logout'); -$routes->group('ecommerce', ['namespace' => 'App\Controllers'], static function ($routes) { - $routes->post('addCart', 'EcommerceController::addCart'); - $routes->get('cancelCart/(:uuid)', 'EcommerceController::cancelCart/$1'); -});; $routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) { }); // authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함 @@ -68,32 +64,19 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->get('toggle/(:num)/(:hash)', 'UserSNSController::toggle/$1/$2'); $routes->post('batchjob', 'UserSNSController::batchjob'); }); - $routes->group('boardconfig', static function ($routes) { - $routes->get('', 'BoardConfigController::index'); - $routes->get('excel', 'BoardConfigController::excel/$1'); - $routes->get('insert', 'BoardConfigController::insert_form'); - $routes->post('insert', 'BoardConfigController::insert'); - $routes->get('update/(:uuid)', 'BoardConfigController::update_form/$1'); - $routes->post('update/(:uuid)', 'BoardConfigController::update/$1'); - $routes->get('view/(:uuid)', 'BoardConfigController::view/$1'); - $routes->get('delete/(:uuid)', 'BoardConfigController::delete/$1', ['filter' => 'authFilter:master']); - $routes->get('toggle/(:uuid)/(:hash)', 'BoardConfigController::toggle/$1/$2'); - $routes->post('batchjob', 'BoardConfigController::batchjob'); - }); - $routes->group('board', static function ($routes) { - $routes->get('', 'BoardController::index'); - $routes->get('excel', 'BoardController::excel/$1'); - $routes->get('insert', 'BoardController::insert_form'); - $routes->post('insert', 'BoardController::insert'); - $routes->get('update/(:num)', 'BoardController::update_form/$1'); - $routes->post('update/(:num)', 'BoardController::update/$1'); - $routes->get('view/(:num)', 'BoardController::view/$1'); - $routes->get('reply/(:num)', 'BoardController::reply_form/$1'); - $routes->post('reply/(:num)', 'BoardController::reply/$1'); - $routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']); - $routes->get('toggle/(:num)/(:hash)', 'BoardController::toggle/$1/$2'); - $routes->post('batchjob', 'BoardController::batchjob'); - $routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2'); + $routes->group('category', static function ($routes) { + $routes->get('', 'CategoryController::index'); + $routes->get('excel', 'CategoryController::excel/$1'); + $routes->get('insert', 'CategoryController::insert_form'); + $routes->post('insert', 'CategoryController::insert'); + $routes->get('update/(:num)', 'CategoryController::update_form/$1'); + $routes->post('update/(:num)', 'CategoryController::update/$1'); + $routes->get('reply/(:num)', 'CategoryController::reply_form/$1'); + $routes->post('reply/(:num)', 'CategoryController::reply/$1'); + $routes->get('view/(:num)', 'CategoryController::view/$1'); + $routes->get('delete/(:num)', 'CategoryController::delete/$1', ['filter' => 'authFilter:master']); + $routes->get('toggle/(:num)/(:hash)', 'CategoryController::toggle/$1/$2'); + $routes->post('batchjob', 'CategoryController::batchjob'); }); $routes->group('hpilo', static function ($routes) { $routes->get('', 'HPILOController::index'); diff --git a/app/Config/Routes_HPILO.php b/app/Config/Routes_HPILO.php index 6783ee0..7dd29ec 100644 --- a/app/Config/Routes_HPILO.php +++ b/app/Config/Routes_HPILO.php @@ -39,10 +39,6 @@ $routes->get('/login', 'AuthController::login'); $routes->post('/signup', 'AuthController::signup/local'); $routes->get('/signup/(:alpha)', 'AuthController::signup/$1'); $routes->get('/logout', 'AuthController::logout'); -$routes->group('ecommerce', ['namespace' => 'App\Controllers'], static function ($routes) { - $routes->post('addCart', 'EcommerceController::addCart'); - $routes->get('cancelCart/(:uuid)', 'EcommerceController::cancelCart/$1'); -});; $routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) { }); // authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함 @@ -68,32 +64,19 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->get('toggle/(:num)/(:hash)', 'UserSNSController::toggle/$1/$2'); $routes->post('batchjob', 'UserSNSController::batchjob'); }); - $routes->group('boardconfig', static function ($routes) { - $routes->get('', 'BoardConfigController::index'); - $routes->get('excel', 'BoardConfigController::excel/$1'); - $routes->get('insert', 'BoardConfigController::insert_form'); - $routes->post('insert', 'BoardConfigController::insert'); - $routes->get('update/(:uuid)', 'BoardConfigController::update_form/$1'); - $routes->post('update/(:uuid)', 'BoardConfigController::update/$1'); - $routes->get('view/(:uuid)', 'BoardConfigController::view/$1'); - $routes->get('delete/(:uuid)', 'BoardConfigController::delete/$1', ['filter' => 'authFilter:master']); - $routes->get('toggle/(:uuid)/(:hash)', 'BoardConfigController::toggle/$1/$2'); - $routes->post('batchjob', 'BoardConfigController::batchjob'); - }); - $routes->group('board', static function ($routes) { - $routes->get('', 'BoardController::index'); - $routes->get('excel', 'BoardController::excel/$1'); - $routes->get('insert', 'BoardController::insert_form'); - $routes->post('insert', 'BoardController::insert'); - $routes->get('update/(:num)', 'BoardController::update_form/$1'); - $routes->post('update/(:num)', 'BoardController::update/$1'); - $routes->get('view/(:num)', 'BoardController::view/$1'); - $routes->get('reply/(:num)', 'BoardController::reply_form/$1'); - $routes->post('reply/(:num)', 'BoardController::reply/$1'); - $routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']); - $routes->get('toggle/(:num)/(:hash)', 'BoardController::toggle/$1/$2'); - $routes->post('batchjob', 'BoardController::batchjob'); - $routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2'); + $routes->group('category', static function ($routes) { + $routes->get('', 'CategoryController::index'); + $routes->get('excel', 'CategoryController::excel/$1'); + $routes->get('insert', 'CategoryController::insert_form'); + $routes->post('insert', 'CategoryController::insert'); + $routes->get('update/(:num)', 'CategoryController::update_form/$1'); + $routes->post('update/(:num)', 'CategoryController::update/$1'); + $routes->get('reply/(:num)', 'CategoryController::reply_form/$1'); + $routes->post('reply/(:num)', 'CategoryController::reply/$1'); + $routes->get('view/(:num)', 'CategoryController::view/$1'); + $routes->get('delete/(:num)', 'CategoryController::delete/$1', ['filter' => 'authFilter:master']); + $routes->get('toggle/(:num)/(:hash)', 'CategoryController::toggle/$1/$2'); + $routes->post('batchjob', 'CategoryController::batchjob'); }); $routes->group('hpilo', static function ($routes) { $routes->get('', 'HPILOController::index'); diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index adf8c30..42e0d98 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -21,14 +21,14 @@ class BoardController extends AdminController public function getFields(string $action = ""): array { - $fields = ["board_config_uid", 'title', "board_file", "passwd", "status", "content"]; + $fields = ["category_uid", 'title', "board_file", "passwd", "status", "content"]; switch ($action) { case "index": case "excel": - return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at"]; + return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at"]; break; case "view": - return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at", "content"]; + return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at", "content"]; break; default: return $fields; @@ -37,7 +37,7 @@ class BoardController extends AdminController } public function getFieldFilters(): array { - return ["board_config_uid", "user_uid", "status"]; + return ["category_uid", "user_uid", "status"]; } public function getFieldBatchFilters(): array { diff --git a/app/Controllers/Admin/BoardConfigController.php b/app/Controllers/Admin/CategoryController.php similarity index 80% rename from app/Controllers/Admin/BoardConfigController.php rename to app/Controllers/Admin/CategoryController.php index c675803..6fe941e 100644 --- a/app/Controllers/Admin/BoardConfigController.php +++ b/app/Controllers/Admin/CategoryController.php @@ -2,16 +2,16 @@ namespace App\Controllers\Admin; -use App\Models\BoardConfigModel; +use App\Models\CategoryModel; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -class BoardConfigController extends AdminController +class CategoryController extends AdminController { public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { - $this->_model = new BoardConfigModel(); + $this->_model = new CategoryModel(); parent::initController($request, $response, $logger); $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); @@ -21,14 +21,14 @@ class BoardConfigController extends AdminController public function getFields(string $action = ""): array { $fields = [ - 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", + 'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "status", "head", "tail", ]; switch ($action) { case "index": case "excel": return [ - 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", + 'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "status", "created_at" ]; break; diff --git a/app/Controllers/Front/BoardController.php b/app/Controllers/Front/BoardController.php index c39c341..dccdd02 100644 --- a/app/Controllers/Front/BoardController.php +++ b/app/Controllers/Front/BoardController.php @@ -6,7 +6,6 @@ use App\Models\BoardModel; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use App\Models\BoardConfigModel; class BoardController extends FrontController { @@ -21,14 +20,14 @@ class BoardController extends FrontController public function getFields(string $action = ""): array { - $fields = ["board_config_uid", 'title', "board_file", "passwd", "content"]; + $fields = ["category_uid", 'title', "board_file", "passwd", "content"]; switch ($action) { case "index": case "excel": - return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at"]; + return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at"]; break; case "view": - return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at", "content"]; + return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at", "content"]; break; default: return $fields; @@ -37,7 +36,7 @@ class BoardController extends FrontController } public function getFieldFilters(): array { - return ["board_config_uid", "user_uid"]; + return ["category_uid", "user_uid"]; } public function getFieldBatchFilters(): array { diff --git a/app/Database/base.sql b/app/Database/base.sql index 995d4a4..0a27822 100644 --- a/app/Database/base.sql +++ b/app/Database/base.sql @@ -19,19 +19,6 @@ CREATE TABLE servermgr.tw_user ( -- insert into tw_user (uid,id,passwd,name,email,role,status) select uuid(),id,passwd,name,email,role,status from cfmgr.user; DROP TABLE IF EXISTS servermgr.tw_user_profile; -CREATE TABLE servermgr.tw_user_profile ( - uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT, - user_uid varchar(36) NULL COMMENT '사용자 정보', - type varchar(10) NOT NULL COMMENT 'ICON|ADDRESS|PHONE|MOBILE|EMAIL 등등', - content varchar(255) NULL, - priority int(3) NOT NULL DEFAULT 1 COMMENT '표시 우선순서', - status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용,unuse: 사용않함', - updated_at timestamp NULL DEFAULT NULL, - created_at timestamp NOT NULL DEFAULT current_timestamp(), - PRIMARY KEY (uid), - CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='사용자 추가정보'; - DROP TABLE IF EXISTS servermgr.tw_user_sns; CREATE TABLE servermgr.tw_user_sns ( @@ -51,26 +38,37 @@ CREATE TABLE servermgr.tw_user_sns ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='SNS 로그인 후 정보'; -DROP TABLE IF EXISTS servermgr.tw_board_config; -CREATE TABLE servermgr.tw_board_config ( - uid varchar(36) NOT NULL, - name varchar(255) NOT NULL COMMENT '게시판명', - isaccess varchar(255) NOT NULL DEFAULT 'manager|cloudflare|director|master' COMMENT '접근권한', - isread varchar(255) NOT NULL DEFAULT 'manager|cloudflare|director|master' COMMENT '읽기권한', - iswrite varchar(255) NOT NULL DEFAULT 'manager|cloudflare|director|master' COMMENT '쓰기권한', - isreply varchar(255) NOT NULL DEFAULT 'manager|cloudflare|director|master' COMMENT '답글권한', - isupload varchar(255) NOT NULL DEFAULT 'manager|cloudflare|director|master' COMMENT 'Upload권한', - isdownload varchar(255) NOT NULL DEFAULT 'manager|cloudflare|director|master' COMMENT 'Download권한', - head text NOT NULL DEFAULT ' ' COMMENT '게시판 위 내용', - tail text NOT NULL DEFAULT ' ' COMMENT '게시판 아래 내용', - status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용, unuse: 사용않함 등등', +DROP TABLE IF EXISTS servermgr.tw_category; +-- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업 +-- update tw_category set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno +-- 2. 게시물 추가시 작업 +-- insert tw_category grpno=그룹번호,grporder=grporder+1,grpdepth=grpdepth+1 +-- 3. 게시물 조회시 작업 +-- select * from tw_category order by grpno desc,grporder asc +CREATE TABLE servermgr.tw_category ( + uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + 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씩 추가필요', + name varchar(255) NOT NULL COMMENT '범주명', + linkurl varchar(255) NULL COMMENT '연결URL', + isaccess varchar(30) NOT NULL DEFAULT 'guest' COMMENT '접근권한', + isread varchar(30) NOT NULL DEFAULT 'guest' COMMENT '읽기권한', + iswrite varchar(30) NOT NULL DEFAULT 'guest' COMMENT '쓰기권한', + isreply varchar(30) NOT NULL DEFAULT 'guest' COMMENT '답글권한', + isupload varchar(30) NOT NULL DEFAULT 'guest' COMMENT 'Upload권한', + isdownload varchar(30) NOT NULL DEFAULT 'guest' COMMENT 'Download권한', + head text NULL COMMENT '위 내용', + tail text NULL COMMENT '아래 내용', + status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 표시,unuse: 표시않함', updated_at timestamp NULL DEFAULT NULL, created_at timestamp NOT NULL DEFAULT current_timestamp(), + deleted_at timestamp NULL DEFAULT NULL, PRIMARY KEY (uid) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='게시판 설정정보'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='범주'; DROP TABLE IF EXISTS servermgr.tw_board; --- 1. 게시물 추가전 grpno에 해당하는 기존게시물의 grpord를 +1씩증가 작업 +-- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업 -- update tw_board set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno -- 2. 게시물 추가시 작업 -- insert tw_board grpno=그룹번호,grporder=grporder+1,grpdepth=grpdepth+1 @@ -81,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씩 추가필요', - board_config_uid varchar(36) NOT NULL COMMENT '게시판구분', + cartory_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 '내용', @@ -91,21 +89,8 @@ CREATE TABLE servermgr.tw_board ( status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용, unuse: 사용않함 등등', updated_at timestamp NULL DEFAULT NULL, created_at timestamp NOT NULL DEFAULT current_timestamp(), + deleted_at timestamp NULL DEFAULT NULL, PRIMARY KEY (uid), - CONSTRAINT FOREIGN KEY (board_config_uid) REFERENCES tw_board_config (uid), + CONSTRAINT FOREIGN KEY (cartory_uid) REFERENCES tw_category (uid), CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='게시물 정보'; - -DROP TABLE IF EXISTS servermgr.tw_board_file; -CREATE TABLE servermgr.tw_board_file ( - uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT, - board_uid int(10) UNSIGNED NOT NULL COMMENT '게시물 정보', - mime_type varchar(50) NOT NULL COMMENT 'Mime_Type', - name varchar(255) NOT NULL COMMENT '파일명', - real_name varchar(255) NOT NULL COMMENT '실제파일명', - status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용, unuse: 사용않함 등등', - updated_at timestamp NULL DEFAULT NULL, - created_at timestamp NOT NULL DEFAULT current_timestamp(), - PRIMARY KEY (uid), - CONSTRAINT FOREIGN KEY (board_uid) REFERENCES tw_board (uid) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='게시판 File정보'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='게시물 정보'; \ No newline at end of file diff --git a/app/Entities/BoardConfigEntity.php b/app/Entities/CategoryEntity.php similarity index 82% rename from app/Entities/BoardConfigEntity.php rename to app/Entities/CategoryEntity.php index 318a3ef..9dfcf16 100644 --- a/app/Entities/BoardConfigEntity.php +++ b/app/Entities/CategoryEntity.php @@ -2,7 +2,7 @@ namespace App\Entities; -class BoardConfigEntity extends BaseEntity +class CategoryEntity extends BaseHierarchyEntity { protected $datamap = []; protected $dates = ['created_at', 'updated_at', 'deleted_at']; @@ -23,6 +23,10 @@ class BoardConfigEntity extends BaseEntity } //추가기능 + public function getLinkURL() + { + return $this->attributes['linkurl']; + } public function getHead() { return $this->attributes['head']; diff --git a/app/Helpers/BoardConfig_helper.php b/app/Helpers/Category_helper.php similarity index 59% rename from app/Helpers/BoardConfig_helper.php rename to app/Helpers/Category_helper.php index 11b677d..ca7b8b4 100644 --- a/app/Helpers/BoardConfig_helper.php +++ b/app/Helpers/Category_helper.php @@ -1,18 +1,18 @@ %s", implode(" ", [...$attributes]), lang("BoardConfig.label.{$field}")); + return sprintf("%s", implode(" ", [...$attributes]), lang("Category.label.{$field}")); break; } } //header.php에서 getFieldForm_Helper사용 -function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldForm_CategoryHelper($field, $value, array $fieldFormOptions, array $attributes = array()) { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { @@ -22,7 +22,7 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, case 'isreply': case 'isupload': case 'isdownload': - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; + $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); // return form_multiselect($field, $fieldFormOptions[$field], $value, [...$attributes]); // foreach ($fieldFormOptions[$field] as $key => $label) { @@ -31,7 +31,7 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, // return implode(" ", $checkboxs); break; case "status": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; + $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); break; case 'updated_at': @@ -42,7 +42,7 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, return sprintf( "%s %s %s", form_password($field, DEFAULTS['EMPTY'], [...$attributes]), - lang("BoardConfig.label.confirmpassword"), + lang("Category.label.confirmpassword"), form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), ); break; @@ -56,18 +56,37 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, case 'name': return form_input($field, $value, [...$attributes, "placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); break; + case 'linkurl': + return form_input($field, $value, [...$attributes, "placeholder" => "예)/front/board", "style" => "width:100%; ::placeholder{ color:silver; opacity: 1; }"]); + break; default: return form_input($field, $value, [...$attributes]); break; } } // -function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) +function getFieldView_CategoryHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) { $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { case 'name': - return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]); + return sprintf( + "
%s %s
", + anchor( + current_url() . '/reply/' . $entity->getPrimaryKey(), + ICONS['REPLY'], + [ + ...$attributes, + "style" => sprintf("padding-left:%spx", $entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH']), + "target" => "_self" + ] + ), + anchor( + current_url() . '/view/' . $entity->getPrimaryKey(), + $value, + ["target" => "_self"] + ) + ); break; case 'upload_file': return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]); @@ -86,7 +105,7 @@ function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, ar } } // -function getFieldFilter_BoardConfigHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldFilter_CategoryHelper($field, $value, array $fieldFormOptions, array $attributes = array()) { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { @@ -96,41 +115,41 @@ function getFieldFilter_BoardConfigHelper($field, $value, array $fieldFormOption case 'isreply': case 'isupload': case 'isdownload': - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; + $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); break; default: - return getFieldForm_BoardConfigHelper($field, $value, $fieldFormOptions, $attributes); + return getFieldForm_CategoryHelper($field, $value, $fieldFormOptions, $attributes); break; } } // -function getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_value, array $attributes = array()) +function getFieldIndex_Column_CategoryHelper($field, $order_field, $order_value, array $attributes = array()) { - $label = lang("BoardConfig.label.{$field}"); + $label = lang("Category.label.{$field}"); $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); } // -function getFieldIndex_Row_BoardConfigHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_CategoryHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string { switch ($field) { default: - return getFieldView_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return getFieldView_CategoryHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); break; } } // -function getFieldIndex_Row_BoardConfigHelper_Admin($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_CategoryHelper_Admin($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string { switch ($field) { default: if (in_array($field, $fieldFilters)) { $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); - return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes); + return getFieldForm_CategoryHelper($field, $entity->$field, $fieldFormOptions, $attributes); } - return getFieldIndex_Row_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return getFieldIndex_Row_CategoryHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); break; } } // \ No newline at end of file diff --git a/app/Language/ko/Board.php b/app/Language/ko/Board.php index 1f82e4c..1bd2233 100644 --- a/app/Language/ko/Board.php +++ b/app/Language/ko/Board.php @@ -6,7 +6,7 @@ return [ 'grpno' => "그룹번호", 'grpord' => "부모번호", 'grpdpt' => "그룸Depth", - 'board_config_uid' => "설정", + 'category_uid' => "범주", 'user_uid' => "작성자", 'title' => "제목", 'content' => "내용", diff --git a/app/Language/ko/BoardConfig.php b/app/Language/ko/Category.php similarity index 91% rename from app/Language/ko/BoardConfig.php rename to app/Language/ko/Category.php index 33da6c7..7839300 100644 --- a/app/Language/ko/BoardConfig.php +++ b/app/Language/ko/Category.php @@ -5,10 +5,11 @@ $roles = [ 'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터", ]; return [ - 'title' => "게시판설정 정보", + 'title' => "범주 정보", 'label' => [ 'uid' => "번호", - 'name' => "게시판제목", + 'name' => "범주제목", + 'linkurl' => "연결URL", 'isaccess' => "접속권한", 'isread' => "읽기권한", 'iswrite' => "쓰기권한", diff --git a/app/Models/BoardModel.php b/app/Models/BoardModel.php index 8dcd3e2..371b888 100644 --- a/app/Models/BoardModel.php +++ b/app/Models/BoardModel.php @@ -6,7 +6,7 @@ use App\Entities\BoardEntity; class BoardModel extends BaseHierarchyModel { - private $_boardconfig_options = null; + private $_category_options = null; protected $table = "tw_board"; protected $returnType = BoardEntity::class; public function __construct() @@ -14,7 +14,7 @@ class BoardModel extends BaseHierarchyModel parent::__construct('Board'); $this->allowedFields = [ ...$this->allowedFields, - "board_config_uid", + "category_uid", "user_uid", 'title', "content", "passwd", "board_file", "view_cnt", "status" ]; @@ -31,8 +31,8 @@ class BoardModel extends BaseHierarchyModel protected function getFieldRule(string $field, array $rules, string $action = ""): array { switch ($field) { - case "board_config_uid": - $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; + case "category_uid": + $rules[$field] = "required|numeric"; break; case $this->getTitleField(): case "content": @@ -55,11 +55,11 @@ class BoardModel extends BaseHierarchyModel { switch ($field) { case 'board_config_uid': - if (is_null($this->_boardconfig_options)) { - $boardConfigModel = new BoardConfigModel(); - $this->_boardconfig_options = $boardConfigModel->getOptions(); + if (is_null($this->_category_options)) { + $categoryModel = new CategoryModel(); + $this->_category_options = $categoryModel->getOptions(); } - $options = $this->_boardconfig_options; + $options = $this->_category_options; break; default: return parent::getFieldFormOption($field); diff --git a/app/Models/BoardConfigModel.php b/app/Models/CategoryModel.php similarity index 67% rename from app/Models/BoardConfigModel.php rename to app/Models/CategoryModel.php index c5f146a..6ea18d0 100644 --- a/app/Models/BoardConfigModel.php +++ b/app/Models/CategoryModel.php @@ -2,19 +2,18 @@ namespace App\Models; -use App\Entities\BoardConfigEntity; +use App\Entities\CategoryEntity; -class BoardConfigModel extends BaseModel +class CategoryModel extends BaseHierarchyModel { - protected $table = "tw_board_config"; - protected $useAutoIncrement = false; - protected $returnType = BoardConfigEntity::class; + protected $table = "tw_category"; + protected $returnType = CategoryEntity::class; public function __construct() { - parent::__construct('BoardConfig'); + parent::__construct('Category'); $this->allowedFields = [ ...$this->allowedFields, - 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", + 'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "head", "tail", "status" ]; $this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),]; @@ -23,17 +22,21 @@ class BoardConfigModel extends BaseModel { return 'name'; } + public function getContentField(): string + { + return 'head'; + } protected function getFieldRule(string $field, array $rules, string $action = ""): array { switch ($field) { - case "uid": - $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; - $rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : ""; - break; case $this->getTitleField(): $rules[$field] = "required|trim|string"; $rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : ""; break; + case "linkurl": + $rules[$field] = "if_exist|trim|string"; + $rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : ""; + break; case "isaccess": case "isread": case "iswrite": @@ -52,19 +55,20 @@ class BoardConfigModel extends BaseModel return $rules; } //Form 선택용 Options Data용 - public function getOptions_TEST(array $conditions = array(), $options = array()): array + public function getOptions(array $conditions = array(), $options = array()): array { - foreach ($this->getEntitys($conditions) as $entity) { - // STATUS가 use가 아닐때 option을 disabled되게 하기위함 - if ($entity->getStatus() != DEFAULTS['STATUS']) { - $options[$entity->getPrimaryKey() . "\" disabled=\"disabled"] = $entity->getTitle(); + //대분류 부분은 선택이 되지 않게 하기위해 따로 만듬 (form_dropdown의 optgroup 기능) + $old_title = ""; + foreach ($this->where($conditions)->orderby("grpno DESC, grporder ASC")->findAll() as $entity) { + if ($entity->getHierarchy_Depth() == 1) { + $options[$entity->getTitle()] = []; + $old_title = $entity->getTitle(); } else { - $options[$entity->getPrimaryKey()] = $entity->getTitle(); + $options[$old_title][$entity->getPrimaryKey()] = $entity->getTitle(); } } return $options; } - //Field별 Form Option용 protected function changeFormData(string $action, string $field, array $formDatas, $entity) { @@ -93,24 +97,31 @@ class BoardConfigModel extends BaseModel return $entity; } - public function getEntity($conditions): BoardConfigEntity + public function getEntity($conditions): CategoryEntity { return parent::getEntity($conditions); } - public function create(array $formDatas): BoardConfigEntity + public function create(array $formDatas): CategoryEntity { - return $this->create_process(new BoardConfigEntity(), $formDatas); + return $this->create_process(new CategoryEntity(), $formDatas); } - public function modify(BoardConfigEntity $entity, array $formDatas): BoardConfigEntity + public function modify(CategoryEntity $entity, array $formDatas): CategoryEntity { return $this->modify_process($entity, $formDatas); } + public function reply($parent_entity, array $formDatas): CategoryEntity + { + return $this->reply_process($parent_entity, new CategoryEntity(), $formDatas); + } //Index관련 public function setIndexWordFilter(string $word) { parent::setIndexWordFilter($word); $this->orLike($this->getTitle(), $word, "both"); //befor , after , both + $this->orLike("linkurl", $word, "both"); //befor , after , both + $this->orLike("head", $word, "both"); //befor , after , both + $this->orLike("tail", $word, "both"); //befor , after , both $this->orLike("isaccess", $word, "both"); //befor , after , both $this->orLike("isread", $word, "both"); //befor , after , both $this->orLike("iswrite", $word, "both"); //befor , after , both diff --git a/app/Views/admin/boardconfig/index.php b/app/Views/admin/category/index.php similarity index 79% rename from app/Views/admin/boardconfig/index.php rename to app/Views/admin/category/index.php index 3e28890..b5ff33a 100644 --- a/app/Views/admin/boardconfig/index.php +++ b/app/Views/admin/category/index.php @@ -4,7 +4,7 @@
"get")) ?> @@ -13,7 +13,7 @@ - + @@ -24,7 +24,7 @@ getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> - + @@ -34,9 +34,9 @@
diff --git a/app/Views/admin/boardconfig/insert.php b/app/Views/admin/category/insert.php similarity index 76% rename from app/Views/admin/boardconfig/insert.php rename to app/Views/admin/category/insert.php index 3d99cd5..4276948 100644 --- a/app/Views/admin/boardconfig/insert.php +++ b/app/Views/admin/category/insert.php @@ -5,9 +5,9 @@
번호 작업
getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
- + diff --git a/app/Views/admin/category/reply.php b/app/Views/admin/category/reply.php new file mode 100644 index 0000000..093edff --- /dev/null +++ b/app/Views/admin/category/reply.php @@ -0,0 +1,21 @@ +extend('layouts/admin') ?> +section('content') ?> +
+ +
- +
+ + + + + + + + + +
+ $field), $fieldFormOptions) ?> + +
"btn btn-outline btn-primary")); ?>
+
+ +endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/boardconfig/update.php b/app/Views/admin/category/update.php similarity index 61% rename from app/Views/admin/boardconfig/update.php rename to app/Views/admin/category/update.php index 2f1385a..321a42f 100644 --- a/app/Views/admin/boardconfig/update.php +++ b/app/Views/admin/category/update.php @@ -5,15 +5,15 @@ - + - +
- $field), $fieldFormOptions) ?> + $field), $fieldFormOptions) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/boardconfig/view.php b/app/Views/admin/category/view.php similarity index 67% rename from app/Views/admin/boardconfig/view.php rename to app/Views/admin/category/view.php index 32f07b4..e2f7410 100644 --- a/app/Views/admin/boardconfig/view.php +++ b/app/Views/admin/category/view.php @@ -4,9 +4,9 @@ - + diff --git a/app/Views/layouts/admin/left_menu/board.php b/app/Views/layouts/admin/left_menu/board.php index 59867bb..0ad5d5c 100644 --- a/app/Views/layouts/admin/left_menu/board.php +++ b/app/Views/layouts/admin/left_menu/board.php @@ -4,7 +4,7 @@
- +