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 a517beb..193184a 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,17 +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('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('board', static function ($routes) {
$routes->get('', 'BoardController::index');
@@ -95,20 +93,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$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('view/(:num)', 'CategoryController::view/$1');
- $routes->get('reply/(:num)', 'CategoryController::reply_form/$1');
- $routes->post('reply/(:num)', 'CategoryController::reply/$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('product', static function ($routes) {
$routes->get('', 'ProductController::index');
$routes->get('excel', 'ProductController::excel/$1');
@@ -149,15 +133,6 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
});
- $routes->group('product', static function ($routes) {
- $routes->get('', 'ProductController::index');
- $routes->get('excel', 'ProductController::excel/$1');
- $routes->get('view/(:uuid)', 'ProductController::view/$1');
- });
- $routes->group('order', static function ($routes) {
- $routes->get('', 'OrderController::index');
- $routes->get('view/(:uuid)', 'OrderController::view/$1');
- });
});
/*
* --------------------------------------------------------------------
diff --git a/app/Config/Routes_Shoppinmall.php b/app/Config/Routes_Shoppinmall.php
index a517beb..193184a 100644
--- a/app/Config/Routes_Shoppinmall.php
+++ b/app/Config/Routes_Shoppinmall.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,17 +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('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('board', static function ($routes) {
$routes->get('', 'BoardController::index');
@@ -95,20 +93,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$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('view/(:num)', 'CategoryController::view/$1');
- $routes->get('reply/(:num)', 'CategoryController::reply_form/$1');
- $routes->post('reply/(:num)', 'CategoryController::reply/$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('product', static function ($routes) {
$routes->get('', 'ProductController::index');
$routes->get('excel', 'ProductController::excel/$1');
@@ -149,15 +133,6 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
});
- $routes->group('product', static function ($routes) {
- $routes->get('', 'ProductController::index');
- $routes->get('excel', 'ProductController::excel/$1');
- $routes->get('view/(:uuid)', 'ProductController::view/$1');
- });
- $routes->group('order', static function ($routes) {
- $routes->get('', 'OrderController::index');
- $routes->get('view/(:uuid)', 'OrderController::view/$1');
- });
});
/*
* --------------------------------------------------------------------
diff --git a/app/Controllers/Admin/BoardConfigController.php b/app/Controllers/Admin/BoardConfigController.php
deleted file mode 100644
index c675803..0000000
--- a/app/Controllers/Admin/BoardConfigController.php
+++ /dev/null
@@ -1,51 +0,0 @@
-_model = new BoardConfigModel();
- parent::initController($request, $response, $logger);
- $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
- $this->_viewPath .= strtolower($this->_model->getClassName());
- helper($this->_model->getClassName());
- }
-
- public function getFields(string $action = ""): array
- {
- $fields = [
- 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
- "status", "head", "tail",
- ];
- switch ($action) {
- case "index":
- case "excel":
- return [
- 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
- "status", "created_at"
- ];
- break;
- case "view":
- return [...$fields, "updated_at", "created_at"];
- break;
- default:
- return $fields;
- break;
- }
- }
- public function getFieldFilters(): array
- {
- return ["isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "status"];
- }
- public function getFieldBatchFilters(): array
- {
- return parent::getFieldBatchFilters();
- }
-}
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/CategoryController.php b/app/Controllers/Admin/CategoryController.php
index 4f57910..6fe941e 100644
--- a/app/Controllers/Admin/CategoryController.php
+++ b/app/Controllers/Admin/CategoryController.php
@@ -17,16 +17,23 @@ class CategoryController extends AdminController
$this->_viewPath .= strtolower($this->_model->getClassName());
helper($this->_model->getClassName());
}
+
public function getFields(string $action = ""): array
{
- $fields = ['name', "status", "head", "tail",];
+ $fields = [
+ 'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
+ "status", "head", "tail",
+ ];
switch ($action) {
case "index":
case "excel":
- return ['name', "status", "created_at"];
+ return [
+ 'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
+ "status", "created_at"
+ ];
break;
case "view":
- return ['name', "status", "created_at", "head", "tail",];
+ return [...$fields, "updated_at", "created_at"];
break;
default:
return $fields;
@@ -35,7 +42,7 @@ class CategoryController extends AdminController
}
public function getFieldFilters(): array
{
- return ["status"];
+ return ["isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "status"];
}
public function getFieldBatchFilters(): array
{
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/Database/shoppingmall.sql b/app/Database/shoppingmall.sql
index 852d9a9..0afc0c5 100644
--- a/app/Database/shoppingmall.sql
+++ b/app/Database/shoppingmall.sql
@@ -1,24 +1,3 @@
-DROP TABLE IF EXISTS shoppingmall.tw_category;
--- 1. 게시물 추가전 grpno에 해당하는 기존게시물의 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 shoppingmall.tw_category (
- uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Group번호와 type이 같아야하므로 항상 숫자여야함',
- 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(36) NOT NULL COMMENT '카테고리명',
- head text NOT NULL DEFAULT ' ' COMMENT '위 내용',
- tail text NOT NULL DEFAULT ' ' 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)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='상품 카테고리';
-
DROP TABLE IF EXISTS shoppingmall.tw_product;
CREATE TABLE shoppingmall.tw_product (
uid varchar(36) NOT NULL,
diff --git a/app/Entities/BoardConfigEntity.php b/app/Entities/BoardConfigEntity.php
deleted file mode 100644
index 318a3ef..0000000
--- a/app/Entities/BoardConfigEntity.php
+++ /dev/null
@@ -1,34 +0,0 @@
-attributes['uid'];
- }
- public function getTitle(): string
- {
- return $this->attributes['name'];
- }
- public function getStatus(): string
- {
- return $this->attributes['status'];
- }
-
- //추가기능
- public function getHead()
- {
- return $this->attributes['head'];
- }
- public function getTail()
- {
- return $this->attributes['tail'];
- }
-}
diff --git a/app/Entities/CategoryEntity.php b/app/Entities/CategoryEntity.php
index 4e90eb5..9dfcf16 100644
--- a/app/Entities/CategoryEntity.php
+++ b/app/Entities/CategoryEntity.php
@@ -23,6 +23,10 @@ class CategoryEntity extends BaseHierarchyEntity
}
//추가기능
+ 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/BoardConfig_helper.php
deleted file mode 100644
index 11b677d..0000000
--- a/app/Helpers/BoardConfig_helper.php
+++ /dev/null
@@ -1,136 +0,0 @@
-%s", implode(" ", [...$attributes]), lang("BoardConfig.label.{$field}"));
- break;
- }
-}
-
-//header.php에서 getFieldForm_Helper사용
-function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, array $attributes = array())
-{
- $value = $value ?: DEFAULTS['EMPTY'];
- switch ($field) {
- case 'isaccess':
- case 'isread':
- case 'iswrite':
- case 'isreply':
- case 'isupload':
- case 'isdownload':
- $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.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) {
- // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label;
- // }
- // return implode(" ", $checkboxs);
- break;
- case "status":
- $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
- return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
- break;
- case 'updated_at':
- case 'created_at':
- return form_input($field, $value, [...$attributes, 'class' => 'calender']);
- break;
- case 'passwd':
- return sprintf(
- "%s %s %s",
- form_password($field, DEFAULTS['EMPTY'], [...$attributes]),
- lang("BoardConfig.label.confirmpassword"),
- form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]),
- );
- break;
- case 'head':
- case 'tail':
- return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']);
- break;
- case 'upload_file':
- return form_upload($field);
- break;
- case 'name':
- return form_input($field, $value, [...$attributes, "placeholder" => "예)", "style" => "width:60%; ::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())
-{
- $value = $entity->$field ?: DEFAULTS['EMPTY'];
- switch ($field) {
- case 'name':
- return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "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"]);
- break;
- case 'updated_at':
- case 'created_at':
- return isset($value) ? str_split($value, 10)[0] : "";
- break;
- case 'head':
- case 'tail':
- return html_entity_decode($value);
- break;
- default:
- return in_array($field, $fieldFilters) && $value ? $fieldFormOptions[$field][$value] : $value;
- break;
- }
-} //
-
-function getFieldFilter_BoardConfigHelper($field, $value, array $fieldFormOptions, array $attributes = array())
-{
- $value = $value ?: DEFAULTS['EMPTY'];
- switch ($field) {
- case 'isaccess':
- case 'isread':
- case 'iswrite':
- case 'isreply':
- case 'isupload':
- case 'isdownload':
- $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
- return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
- break;
- default:
- return getFieldForm_BoardConfigHelper($field, $value, $fieldFormOptions, $attributes);
- break;
- }
-} //
-
-function getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_value, array $attributes = array())
-{
- $label = lang("BoardConfig.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
-{
- switch ($field) {
- default:
- return getFieldView_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
- break;
- }
-} //
-
-function getFieldIndex_Row_BoardConfigHelper_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 getFieldIndex_Row_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
- break;
- }
-} //
\ No newline at end of file
diff --git a/app/Helpers/Category_helper.php b/app/Helpers/Category_helper.php
index 646fb7a..ca7b8b4 100644
--- a/app/Helpers/Category_helper.php
+++ b/app/Helpers/Category_helper.php
@@ -14,10 +14,21 @@ function getFieldLabel_CategoryHelper($field, array $fieldRules, array $attribut
//header.php에서 getFieldForm_Helper사용
function getFieldForm_CategoryHelper($field, $value, array $fieldFormOptions, array $attributes = array())
{
+ $value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
- case "user_uid":
+ case 'isaccess':
+ case 'isread':
+ case 'iswrite':
+ case 'isreply':
+ case 'isupload':
+ case 'isdownload':
$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) {
+ // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label;
+ // }
+ // return implode(" ", $checkboxs);
break;
case "status":
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
@@ -37,12 +48,17 @@ function getFieldForm_CategoryHelper($field, $value, array $fieldFormOptions, ar
break;
case 'head':
case 'tail':
- case 'content':
return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']);
break;
case 'upload_file':
return form_upload($field);
break;
+ 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;
@@ -72,18 +88,17 @@ function getFieldView_CategoryHelper($field, $entity, array $fieldFilters, array
)
);
break;
- case 'head':
- case 'tail':
- case 'content':
- return html_entity_decode($value);
- break;
case 'upload_file':
- return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELLIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]);
+ return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]);
break;
case 'updated_at':
case 'created_at':
return isset($value) ? str_split($value, 10)[0] : "";
break;
+ case 'head':
+ case 'tail':
+ return html_entity_decode($value);
+ break;
default:
return in_array($field, $fieldFilters) && $value ? $fieldFormOptions[$field][$value] : $value;
break;
@@ -94,6 +109,15 @@ function getFieldFilter_CategoryHelper($field, $value, array $fieldFormOptions,
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
+ case 'isaccess':
+ case 'isread':
+ case 'iswrite':
+ case 'isreply':
+ case 'isupload':
+ case 'isdownload':
+ $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_CategoryHelper($field, $value, $fieldFormOptions, $attributes);
break;
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/BoardConfig.php
deleted file mode 100644
index 33da6c7..0000000
--- a/app/Language/ko/BoardConfig.php
+++ /dev/null
@@ -1,32 +0,0 @@
- '비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
- 'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
- 'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
-];
-return [
- 'title' => "게시판설정 정보",
- '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" => $roles,
- 'STATUS' => ['use' => '사용', 'unuse' => '사용않함'],
-];
diff --git a/app/Language/ko/Category.php b/app/Language/ko/Category.php
index fb2f2e2..7839300 100644
--- a/app/Language/ko/Category.php
+++ b/app/Language/ko/Category.php
@@ -1,17 +1,33 @@
'비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
+ 'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
+ 'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
+];
return [
- 'title' => "Category 정보",
+ 'title' => "범주 정보",
'label' => [
'uid' => "번호",
- 'grpno' => "그룹번호",
- 'grpord' => "부모번호",
- 'grpdpt' => "그룸Depth",
- 'name' => "제목",
+ 'name' => "범주제목",
+ 'linkurl' => "연결URL",
+ '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" => $roles,
'STATUS' => ['use' => '사용', 'unuse' => '사용않함'],
];
diff --git a/app/Models/BoardConfigModel.php b/app/Models/BoardConfigModel.php
deleted file mode 100644
index c5f146a..0000000
--- a/app/Models/BoardConfigModel.php
+++ /dev/null
@@ -1,121 +0,0 @@
-allowedFields = [
- ...$this->allowedFields,
- 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
- "head", "tail", "status"
- ];
- $this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
- }
- public function getTitleField(): string
- {
- return 'name';
- }
- 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 "isaccess":
- case "isread":
- case "iswrite":
- case "isreply":
- case "isupload":
- case "isdownload":
- //아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
- // $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user,guest]";
- //아래 Rule은 checkbox를 사용시에는 required만 우선 써야 수정시 validate문제없음
- $rules[$field] = "required";
- break;
- default:
- $rules = parent::getFieldRule($field, $rules, $action);
- break;
- }
- return $rules;
- }
- //Form 선택용 Options Data용
- public function getOptions_TEST(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();
- } else {
- $options[$entity->getPrimaryKey()] = $entity->getTitle();
- }
- }
- return $options;
- }
-
- //Field별 Form Option용
- protected function changeFormData(string $action, string $field, array $formDatas, $entity)
- {
- switch ($field) {
- case "isaccess":
- case "isread":
- case "iswrite":
- case "isreply":
- case "isupload":
- case "isdownload":
- case "isaccess":
- if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
- $entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
- }
- break;
- case "head":
- case "tail":
- if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
- $entity->$field = htmlentities($formDatas[$field]);
- }
- break;
- default:
- $entity = parent::changeFormData($action, $field, $formDatas, $entity);
- break;
- }
- return $entity;
- }
-
- public function getEntity($conditions): BoardConfigEntity
- {
- return parent::getEntity($conditions);
- }
- public function create(array $formDatas): BoardConfigEntity
- {
- return $this->create_process(new BoardConfigEntity(), $formDatas);
- }
- public function modify(BoardConfigEntity $entity, array $formDatas): BoardConfigEntity
- {
- return $this->modify_process($entity, $formDatas);
- }
-
- //Index관련
- public function setIndexWordFilter(string $word)
- {
- parent::setIndexWordFilter($word);
- $this->orLike($this->getTitle(), $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
- $this->orLike("isreply", $word, "both"); //befor , after , both
- $this->orLike("isupload", $word, "both"); //befor , after , both
- $this->orLike("isdownload", $word, "both"); //befor , after , both
- }
-}
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/CategoryModel.php b/app/Models/CategoryModel.php
index f41d6fa..6ea18d0 100644
--- a/app/Models/CategoryModel.php
+++ b/app/Models/CategoryModel.php
@@ -6,13 +6,16 @@ use App\Entities\CategoryEntity;
class CategoryModel extends BaseHierarchyModel
{
- //BaseHierarchyModel를 확장하면 grpno가 숫자이고, primarykey를 대분류 생성시 copy하여 grpno에 넣고 sorting하므로
protected $table = "tw_category";
protected $returnType = CategoryEntity::class;
public function __construct()
{
parent::__construct('Category');
- $this->allowedFields = [...$this->allowedFields, 'name', "head", "tail", "status"];
+ $this->allowedFields = [
+ ...$this->allowedFields,
+ 'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
+ "head", "tail", "status"
+ ];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
}
public function getTitleField(): string
@@ -27,11 +30,23 @@ class CategoryModel extends BaseHierarchyModel
{
switch ($field) {
case $this->getTitleField():
- $rules[$field] = "required|trim|string";
+ $rules[$field] = "required|trim|string";
+ $rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
break;
- case "head":
- case "tail":
- $rules[$field] = "if_exist|string";
+ case "linkurl":
+ $rules[$field] = "if_exist|trim|string";
+ $rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
+ break;
+ case "isaccess":
+ case "isread":
+ case "iswrite":
+ case "isreply":
+ case "isupload":
+ case "isdownload":
+ //아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
+ // $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user,guest]";
+ //아래 Rule은 checkbox를 사용시에는 required만 우선 써야 수정시 validate문제없음
+ $rules[$field] = "required";
break;
default:
$rules = parent::getFieldRule($field, $rules, $action);
@@ -39,13 +54,13 @@ class CategoryModel extends BaseHierarchyModel
}
return $rules;
}
-
+ //Form 선택용 Options Data용
public function getOptions(array $conditions = array(), $options = array()): array
{
//대분류 부분은 선택이 되지 않게 하기위해 따로 만듬 (form_dropdown의 optgroup 기능)
$old_title = "";
foreach ($this->where($conditions)->orderby("grpno DESC, grporder ASC")->findAll() as $entity) {
- if ($entity->getPrimaryKey() == $entity->getHierarchy_No()) {
+ if ($entity->getHierarchy_Depth() == 1) {
$options[$entity->getTitle()] = [];
$old_title = $entity->getTitle();
} else {
@@ -54,12 +69,38 @@ class CategoryModel extends BaseHierarchyModel
}
return $options;
}
+ //Field별 Form Option용
+ protected function changeFormData(string $action, string $field, array $formDatas, $entity)
+ {
+ switch ($field) {
+ case "isaccess":
+ case "isread":
+ case "iswrite":
+ case "isreply":
+ case "isupload":
+ case "isdownload":
+ case "isaccess":
+ if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
+ $entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
+ }
+ break;
+ case "head":
+ case "tail":
+ if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
+ $entity->$field = htmlentities($formDatas[$field]);
+ }
+ break;
+ default:
+ $entity = parent::changeFormData($action, $field, $formDatas, $entity);
+ break;
+ }
+ return $entity;
+ }
public function getEntity($conditions): CategoryEntity
{
return parent::getEntity($conditions);
}
-
public function create(array $formDatas): CategoryEntity
{
return $this->create_process(new CategoryEntity(), $formDatas);
@@ -77,8 +118,15 @@ class CategoryModel extends BaseHierarchyModel
public function setIndexWordFilter(string $word)
{
parent::setIndexWordFilter($word);
- $this->orLike($this->getTitleField(), $word, "both");
+ $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
+ $this->orLike("isreply", $word, "both"); //befor , after , both
+ $this->orLike("isupload", $word, "both"); //befor , after , both
+ $this->orLike("isdownload", $word, "both"); //befor , after , both
}
}
diff --git a/app/Views/admin/boardconfig/index.php b/app/Views/admin/boardconfig/index.php
deleted file mode 100644
index 3e28890..0000000
--- a/app/Views/admin/boardconfig/index.php
+++ /dev/null
@@ -1,45 +0,0 @@
-= $this->extend('layouts/admin') ?>
-= $this->section('content') ?>
-
-
- = form_open(current_url(), array("method" => "get")) ?>
-
- 조건검색:= getFieldFilter_BoardConfigHelper($field, $$field, $fieldFormOptions) ?>
- = $this->include('templates/admin/index_head'); ?>
-
- = form_close(); ?>
-
- = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
-
-
- 번호
- = getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_value) ?>
- 작업
-
-
-
- getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
-
- = form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
- = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
-
-
- = getFieldIndex_Row_BoardConfigHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?>
-
- = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
-
-
-
-
-
-
- = form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
- = getFieldFilter_BoardConfigHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?>
- = form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?>
- = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
-
- = $pagination ?>
-
- = form_close(); ?>
-
-= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/boardconfig/insert.php b/app/Views/admin/boardconfig/insert.php
deleted file mode 100644
index 3d99cd5..0000000
--- a/app/Views/admin/boardconfig/insert.php
+++ /dev/null
@@ -1,21 +0,0 @@
-= $this->extend('layouts/admin') ?>
-= $this->section('content') ?>
-
- = form_open_multipart(current_url(), $forms['attributes'], $forms['hiddens']) ?>
-
-
-= form_close(); ?>
-= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/boardconfig/update.php b/app/Views/admin/boardconfig/update.php
deleted file mode 100644
index 2f1385a..0000000
--- a/app/Views/admin/boardconfig/update.php
+++ /dev/null
@@ -1,21 +0,0 @@
-= $this->extend('layouts/admin') ?>
-= $this->section('content') ?>
-
- = form_open_multipart(current_url(), $forms['attributes'], $forms['hiddens']) ?>
-
-
-= form_close(); ?>
-= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/boardconfig/view.php b/app/Views/admin/boardconfig/view.php
deleted file mode 100644
index 32f07b4..0000000
--- a/app/Views/admin/boardconfig/view.php
+++ /dev/null
@@ -1,16 +0,0 @@
-= $this->extend('layouts/admin') ?>
-= $this->section('content') ?>
-
-= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/category/index.php b/app/Views/admin/category/index.php
index 9f35470..b5ff33a 100644
--- a/app/Views/admin/category/index.php
+++ b/app/Views/admin/category/index.php
@@ -36,7 +36,7 @@
= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
= getFieldFilter_CategoryHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?>
= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?>
- = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
+ = anchor(current_url() . '/insert', '대범주추가', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
= $pagination ?>
diff --git a/app/Views/admin/category/insert.php b/app/Views/admin/category/insert.php
index c9d0063..4276948 100644
--- a/app/Views/admin/category/insert.php
+++ b/app/Views/admin/category/insert.php
@@ -13,7 +13,7 @@
- = form_submit('', '대분류입력', array("class" => "btn btn-outline btn-primary")); ?>
+ = form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/category/reply.php b/app/Views/admin/category/reply.php
index 919b319..093edff 100644
--- a/app/Views/admin/category/reply.php
+++ b/app/Views/admin/category/reply.php
@@ -13,7 +13,7 @@
- = form_submit('', '중분류입력', array("class" => "btn btn-outline btn-primary")); ?>
+ = form_submit('', '중범주추가', array("class" => "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/category/update.php b/app/Views/admin/category/update.php
index 3c6238a..321a42f 100644
--- a/app/Views/admin/category/update.php
+++ b/app/Views/admin/category/update.php
@@ -13,7 +13,7 @@
- = form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?>
+ = form_submit('', '범주수정', array("class" => "btn btn-outline btn-primary")); ?>
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 @@