diff --git a/app/Config/Constants.php b/app/Config/Constants.php
index ac19746..eea5e28 100644
--- a/app/Config/Constants.php
+++ b/app/Config/Constants.php
@@ -157,12 +157,14 @@ define('AUTH_ADAPTERS', [
],
]);
//등급 관련
-define('ROLES', [
- 'guest' => '비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
- 'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
- 'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
+define('FORM_OPTIONS', [
+ 'ROLE' => [
+ 'guest' => '비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
+ 'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
+ 'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
+ ],
+ 'STATUS' => ["use" => "사용", "unuse" => "사용않함",],
]);
-define('STATUS', ["use" => "사용", "unuse" => "사용않함",]);
//Upload , Download 관련
define('PATHS', [
@@ -199,8 +201,9 @@ define('DEFAULTS', [
'PERPAGE' => getenv('default.perpage') ?: 20,
]);
-//UUID초기값 정의
-define('UUIDS', [
- 'NAMESPACE' => getenv('uuid.namespace') ?: "8fc990b07418d5826d98de952cfb268dee4a23a3",
- 'SECRET' => getenv('uuid.secret') ?: "delftstack1",
+//API Adapter초기갑 정의
+define('API', [
+ 'SSL_VERIFY' => getenv('api.ssl') == 'true' ? true : false,
+ 'COOKIE_FILE' => PATHS['API'] . getenv('api.cookie.file') ?: "api-cookie_" . date("Ymd") . ".log",
+ 'DEBUG_FILE' => PATHS['API'] . getenv('api.debug.file') ?: "api-debug_" . date("Ymd") . ".log",
]);
diff --git a/app/Controllers/Admin/BoardConfigController.php b/app/Controllers/Admin/BoardConfigController.php
index dac7686..eecc3a6 100644
--- a/app/Controllers/Admin/BoardConfigController.php
+++ b/app/Controllers/Admin/BoardConfigController.php
@@ -19,13 +19,13 @@ class BoardConfigController extends \App\Controllers\Admin\AdminController
'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'head', 'tail'],
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'],
'fieldRules' => [
- 'name' => 'required|string|is_unique[tw_board_conifg.name]',
- 'isaccess' => 'required|string',
- 'isread' => 'required|string',
- 'iswrite' => 'required|string',
- 'isreply' => 'required|string',
- 'isupload' => 'required|string',
- 'isdownload' => 'required|string',
+ 'name' => 'required|string|is_unique[tw_board_config.name]',
+ 'isaccess' => 'required',
+ 'isread' => 'required',
+ 'iswrite' => 'required',
+ 'isreply' => 'required',
+ 'isupload' => 'required',
+ 'isdownload' => 'required',
'head' => 'if_exist|string',
'tail' => 'if_exist|string',
'status' => 'if_exist|string',
@@ -36,12 +36,12 @@ class BoardConfigController extends \App\Controllers\Admin\AdminController
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'],
'fieldRules' => [
'name' => 'required|string',
- 'isaccess' => 'required|string',
- 'isread' => 'required|string',
- 'iswrite' => 'required|string',
- 'isreply' => 'required|string',
- 'isupload' => 'required|string',
- 'isdownload' => 'required|string',
+ 'isaccess' => 'required',
+ 'isread' => 'required',
+ 'iswrite' => 'required',
+ 'isreply' => 'required',
+ 'isupload' => 'required',
+ 'isdownload' => 'required',
'head' => 'if_exist|string',
'tail' => 'if_exist|string',
'status' => 'if_exist|string',
@@ -52,12 +52,12 @@ class BoardConfigController extends \App\Controllers\Admin\AdminController
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'],
'fieldRules' => [
'name' => 'required|string',
- 'isaccess' => 'required|string',
- 'isread' => 'required|string',
- 'iswrite' => 'required|string',
- 'isreply' => 'required|string',
- 'isupload' => 'required|string',
- 'isdownload' => 'required|string',
+ 'isaccess' => 'required',
+ 'isread' => 'required',
+ 'iswrite' => 'required',
+ 'isreply' => 'required',
+ 'isupload' => 'required',
+ 'isdownload' => 'required',
'head' => 'if_exist|string',
'tail' => 'if_exist|string',
'status' => 'if_exist|string',
@@ -66,7 +66,7 @@ class BoardConfigController extends \App\Controllers\Admin\AdminController
'index' => [
'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'],
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'],
- 'batchjobFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'],
+ 'batchjobFilters' => ['status'],
],
'excel' => [
'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'],
diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php
index dc827e4..cd933fa 100644
--- a/app/Controllers/Admin/BoardController.php
+++ b/app/Controllers/Admin/BoardController.php
@@ -2,17 +2,16 @@
namespace App\Controllers\Admin;
-use App\Models\UserModel;
+use App\Models\BoardConfigModel;
use App\Models\BoardModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
-use App\Libraries\Log\Log;
class BoardController extends \App\Controllers\Admin\AdminController
{
- private $_userModel = null;
- private $_user_uids = null;
+ private $_boardConfigModel = null;
+ private $_board_config_uids = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@@ -20,10 +19,10 @@ class BoardController extends \App\Controllers\Admin\AdminController
$this->_model = new BoardModel();
$this->_defines = [
'insert' => [
- 'fields' => ['board_category', 'title', 'content', 'passwd', 'confirmpassword', 'upload_file', 'status'],
- 'fieldFilters' => ['board_category', 'user_uid', 'status'],
+ 'fields' => ['board_config_uid', 'title', 'content', 'passwd', 'confirmpassword', 'upload_file', 'status'],
+ 'fieldFilters' => ['board_config_uid', 'user_uid', 'status'],
'fieldRules' => [
- 'board_category' => 'required|string',
+ 'board_config_uid' => 'required|string',
'title' => 'required|string',
'content' => 'required|string',
'passwd' => 'if_exist|trim|string',
@@ -34,10 +33,10 @@ class BoardController extends \App\Controllers\Admin\AdminController
]
],
'update' => [
- 'fields' => ['board_category', 'title', 'content', 'passwd', 'confirmpassword', 'upload_file', 'status'],
- 'fieldFilters' => ['board_category', 'user_uid', 'status'],
+ 'fields' => ['board_config_uid', 'title', 'content', 'passwd', 'confirmpassword', 'upload_file', 'status'],
+ 'fieldFilters' => ['board_config_uid', 'user_uid', 'status'],
'fieldRules' => [
- 'board_category' => 'required|string',
+ 'board_config_uid' => 'required|string',
'title' => 'required|string',
'content' => 'required|string',
'passwd' => 'if_exist|trim|string',
@@ -48,18 +47,18 @@ class BoardController extends \App\Controllers\Admin\AdminController
],
],
'view' => [
- 'fields' => ['board_category', 'user_uid', 'title', 'view_cnt', 'status', 'updated_at', 'created_at', 'content'],
- 'fieldFilters' => ['board_category', 'user_uid', 'status'],
- 'fieldRules' => ['board_category', 'user_uid', 'status'],
+ 'fields' => ['board_config_uid', 'user_uid', 'title', 'view_cnt', 'status', 'updated_at', 'created_at', 'content'],
+ 'fieldFilters' => ['board_config_uid', 'user_uid', 'status'],
+ 'fieldRules' => ['board_config_uid', 'user_uid', 'status'],
],
'index' => [
- 'fields' => ['board_category', 'user_uid', 'title', 'view_cnt', 'status', 'updated_at', 'created_at'],
- 'fieldFilters' => ['board_category', 'user_uid', 'status'],
- 'batchjobFilters' => ['board_category', 'user_uid', 'status'],
+ 'fields' => ['board_config_uid', 'user_uid', 'title', 'view_cnt', 'status', 'updated_at', 'created_at'],
+ 'fieldFilters' => ['board_config_uid', 'user_uid', 'status'],
+ 'batchjobFilters' => ['board_config_uid', 'user_uid', 'status'],
],
'excel' => [
- 'fields' => ['board_category', 'user_uid', 'title', 'view_cnt', 'status', 'updated_at', 'created_at'],
- 'fieldFilters' => ['board_category', 'user_uid', 'status'],
+ 'fields' => ['board_config_uid', 'user_uid', 'title', 'view_cnt', 'status', 'updated_at', 'created_at'],
+ 'fieldFilters' => ['board_config_uid', 'user_uid', 'status'],
],
];
helper($this->_className);
@@ -68,21 +67,22 @@ class BoardController extends \App\Controllers\Admin\AdminController
$this->_viewDatas['className'] = $this->_className;
}
- private function getUserModel(): UserModel
+ //BoardConfig모델
+ final protected function getBoardConfigModel(): BoardConfigModel
{
- return is_null($this->_userModel) ? new UserModel() : $this->_userModel;
+ return is_null($this->_boardConfigModel) ? new BoardConfigModel() : $this->_boardConfigModel;
}
//Field별 Form Option용
protected function getFieldFormOption(string $field): array
{
switch ($field) {
- case 'user_uid':
- if (is_null($this->_user_uids)) {
+ case 'board_config_uid':
+ if (is_null($this->_board_config_uids)) {
//모든 필요한 FormOption등 조기화작업 필요
- $this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']);
+ $this->_board_config_uids = $this->getBoardConfigModel()->getFieldFormOptions(['status' => 'use']);
}
- return $this->_user_uids;
+ return $this->_board_config_uids;
default:
return parent::getFieldFormOption($field);
break;
@@ -94,7 +94,7 @@ class BoardController extends \App\Controllers\Admin\AdminController
{
switch ($field) {
case 'upload_file':
- $this->_viewDatas['fieldDatas'][$field] = $this->single_upload_procedure($field, $entity);
+ return $this->single_upload_procedure($field, $entity);
break;
default:
return parent::getFieldFormData($field, $entity);
diff --git a/app/Controllers/Admin/LoggerController.php b/app/Controllers/Admin/LoggerController.php
index 40b5533..7151fb1 100644
--- a/app/Controllers/Admin/LoggerController.php
+++ b/app/Controllers/Admin/LoggerController.php
@@ -20,17 +20,17 @@ class LoggerController extends \App\Controllers\Admin\AdminController
$this->_defines = [
'view' => [
'fields' => ['user_uid', 'title', 'content', 'status', 'created_at'],
- 'fieldFilters' => ['user_uid', 'status'],
+ 'fieldFilters' => ['user_uid'],
'fieldRules' => [],
],
'index' => [
'fields' => ['user_uid', 'title', 'status', 'created_at'],
- 'fieldFilters' => ['user_uid', 'status'],
+ 'fieldFilters' => ['user_uid'],
'batchjobFilters' => [],
],
'excel' => [
'fields' => ['user_uid', 'title', 'status', 'created_at'],
- 'fieldFilters' => ['user_uid', 'status'],
+ 'fieldFilters' => ['user_uid'],
],
];
helper($this->_className);
@@ -39,22 +39,10 @@ class LoggerController extends \App\Controllers\Admin\AdminController
$this->_viewDatas['className'] = $this->_className;
}
- private function getUserModel(): UserModel
- {
- return is_null($this->_userModel) ? new UserModel() : $this->_userModel;
- }
-
//Field별 Form Option용
protected function getFieldFormOption(string $field): array
{
switch ($field) {
- case 'user_uid':
- if (is_null($this->_user_uids)) {
- //모든 필요한 FormOption등 조기화작업 필요
- $this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']);
- }
- return $this->_user_uids;
- break;
default:
return parent::getFieldFormOption($field);
break;
diff --git a/app/Controllers/Admin/UserSNSController.php b/app/Controllers/Admin/UserSNSController.php
index cef0d82..1d003e1 100644
--- a/app/Controllers/Admin/UserSNSController.php
+++ b/app/Controllers/Admin/UserSNSController.php
@@ -2,7 +2,6 @@
namespace App\Controllers\Admin;
-use App\Models\UserModel;
use App\Models\UserSNSModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@@ -10,7 +9,6 @@ use Psr\Log\LoggerInterface;
class UserSNSController extends \App\Controllers\Admin\AdminController
{
- private $_userModel = null;
private $_user_uids = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
@@ -39,11 +37,6 @@ class UserSNSController extends \App\Controllers\Admin\AdminController
$this->_viewDatas['className'] = $this->_className;
}
- private function getUserModel(): UserModel
- {
- return is_null($this->_userModel) ? new UserModel() : $this->_userModel;
- }
-
//Field별 Form Option용
protected function getFieldFormOption(string $field): array
{
diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php
index d66a3a8..2dbb43a 100644
--- a/app/Controllers/BaseController.php
+++ b/app/Controllers/BaseController.php
@@ -9,6 +9,7 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Libraries\Log\Log;
+use App\Models\UserModel;
/**
* Class BaseController
@@ -47,6 +48,8 @@ abstract class BaseController extends Controller
/**
* Constructor.
*/
+ private $_userModel = null;
+ private $_user_uids = array();
protected $_model = null;
protected $_className = '';
protected $_defines = array();
@@ -74,26 +77,39 @@ abstract class BaseController extends Controller
}
}
+ //User모델
+ final protected function getUserModel(): UserModel
+ {
+ return is_null($this->_userModel) ? new UserModel() : $this->_userModel;
+ }
+
//Field별 Form Option용
protected function getFieldFormOption(string $field): array
{
switch ($field) {
- default:
- $fieldFormOptionDatas = lang($this->_className . '.' . strtoupper($field));
- if (!is_array($fieldFormOptionDatas)) {
- throw new \Exception(__FUNCTION__ . "에서 {$field}의 데이터가 array가 아닙니다.\n" . var_export($fieldFormOptionDatas, true));
+ case 'user_uid':
+ if (is_null($this->_user_uids)) {
+ //모든 필요한 FormOption등 조기화작업 필요
+ $this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']);
}
- return $fieldFormOptionDatas;
+ return $this->_user_uids;
+ break;
+ default:
+ $formOptionDatas = lang($this->_className . '.' . strtoupper($field));
+ if (!is_array($formOptionDatas)) {
+ throw new \Exception("{$this->_className}에서 Field:{$field}의 FormOptionData가 array가 아닙니다.\n" . var_export($formOptionDatas, true));
+ }
+ return $formOptionDatas;
break;
}
}
//Field별 Form Option용
- final protected function getFieldFormOptions(array $fieldFilters): array
+ final protected function getFieldFormOptions(array $fields): array
{
$fieldFormOptions = array();
- foreach ($fieldFilters as $field) {
- if (is_array($field)) {
- throw new \Exception(__FUNCTION__ . "에서 field가 array 입니다.\n" . var_export($fieldFilters, true));
+ foreach ($fields as $field) {
+ if (!is_string($field)) {
+ throw new \Exception(__FUNCTION__ . "에서 {$this->_className}의 Field:{$field}가 string 아닙니다.\n" . var_export($fields, true));
}
$fieldFormOptions[$field] = $this->getFieldFormOption($field);
}
@@ -104,8 +120,8 @@ abstract class BaseController extends Controller
{
$tempRules = $this->_model->getValidationRules(['only' => $fields]);
foreach ($fields as $field) {
- if (is_array($field)) {
- throw new \Exception(__FUNCTION__ . "에서 field가 array 입니다.\n" . var_export($fieldRules, true));
+ if (!is_string($field)) {
+ throw new \Exception(__FUNCTION__ . "에서 {$field}가 string 아닙니다.\n" . var_export($fieldRules, true));
}
if (array_key_exists($field, $fieldRules)) {
$tempRules[$field] = $fieldRules[$field];
@@ -118,20 +134,8 @@ abstract class BaseController extends Controller
protected function getFieldFormData(string $field, $entity = null)
{
switch ($field) {
- case 'passwd':
- //암호는 보안상 log에 남지 않기
- $this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
- break;
default:
- $this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
- if (is_null($entity)) {
- Log::add("info", "{$field} : {$this->_viewDatas['fieldDatas'][$field]}");
- } else {
- Log::add(
- "info",
- "{$field} : {$entity->$field} => {$this->_viewDatas['fieldDatas'][$field]}"
- );
- }
+ return $this->request->getVar($field);
break;
}
}
@@ -214,7 +218,8 @@ abstract class BaseController extends Controller
//변경된 값 적용
$this->_viewDatas['fieldDatas'] = array();
foreach ($this->_viewDatas['fields'] as $field) {
- $this->getFieldFormData($field);
+ $this->_viewDatas['fieldDatas'][$field] = $this->getFieldFormData($field);
+ Log::add("info", "{$field} : " . var_export($this->_viewDatas['fieldDatas'][$field], true));
}
//변경할 값 확인
if (!$this->validate($this->_viewDatas['fieldRules'])) {
@@ -241,7 +246,7 @@ abstract class BaseController extends Controller
$message = __FUNCTION__ . " 실패하였습니다.";
Log::add("warning", $e->getMessage());
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
- Log::save("{$this->_viewDatas['title']} {$message}", false);
+ Log::save("{$this->_viewDatas['title']} {$message}", 'error');
return redirect()->back()->withInput()->with("error", $message . "
\n{$e->getMessage()}");
}
}
@@ -280,7 +285,11 @@ abstract class BaseController extends Controller
//변경된 값 적용
$this->_viewDatas['fieldDatas'] = array();
foreach ($this->_viewDatas['fields'] as $field) {
- $this->getFieldFormData($field, $entity);
+ $this->_viewDatas['fieldDatas'][$field] = $this->getFieldFormData($field, $entity);
+ Log::add(
+ "info",
+ "{$field} : {$entity->$field} => " . var_export($this->_viewDatas['fieldDatas'][$field])
+ );
}
//변경할 값 확인
if (!$this->validate($this->_viewDatas['fieldRules'])) {
@@ -307,7 +316,7 @@ abstract class BaseController extends Controller
$message = __FUNCTION__ . " 실패하였습니다.";
Log::add("warning", $e->getMessage());
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
- Log::save("{$this->_viewDatas['title']} {$message}", false);
+ Log::save("{$this->_viewDatas['title']} {$message}", 'error');
return redirect()->back()->withInput()->with("error", $message . "
\n{$e->getMessage()}");
}
}
@@ -360,7 +369,7 @@ abstract class BaseController extends Controller
$message = __FUNCTION__ . " 실패하였습니다.";
Log::add("warning", $e->getMessage());
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
- Log::save("{$this->_viewDatas['title']} {$message}", false);
+ Log::save("{$this->_viewDatas['title']} {$message}", 'error');
return redirect()->back()->withInput()->with("error", $message . "
\n{$e->getMessage()}");
}
}
@@ -394,7 +403,7 @@ abstract class BaseController extends Controller
$message = __FUNCTION__ . " 실패하였습니다.";
Log::add("warning", $e->getMessage());
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
- Log::save("{$this->_viewDatas['title']} {$message}", false);
+ Log::save("{$this->_viewDatas['title']} {$message}", 'error');
return alert_CommonHelper($message . "
\n{$e->getMessage()}", 'back');
}
}
@@ -449,7 +458,7 @@ abstract class BaseController extends Controller
$message = "총: " . count($uids) . "개의 수정(Batchjob)을 실패하였습니다.";
Log::add("warning", $e->getMessage());
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
- Log::save("{$this->_viewDatas['title']} {$message}", false);
+ Log::save("{$this->_viewDatas['title']} {$message}", 'error');
return alert_CommonHelper($message . "
\n{$e->getMessage()}", 'back');
}
}
@@ -476,7 +485,7 @@ abstract class BaseController extends Controller
} catch (\Exception $e) {
$message = __FUNCTION__ . " 실패하였습니다.";
Log::add("warning", $e->getMessage());
- Log::save("{$this->_viewDatas['title']} {$message}", false);
+ Log::save("{$this->_viewDatas['title']} {$message}", 'error');
return alert_CommonHelper($message . "
\n{$e->getMessage()}", 'back');
}
}
@@ -615,7 +624,7 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldFilters'] = $this->_defines['excel']['fieldFilters'];
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
}
- private function excel_getSpreadSheet()
+ protected function excel_spreadSheet()
{
//Excepl 초기화
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
@@ -642,13 +651,18 @@ abstract class BaseController extends Controller
protected function excel_process()
{
$fileName = date('Y-m-d_Hm') . '.xlsx';
- //파일저장 참고:https://teserre.tistory.com/19
- $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->excel_getSpreadSheet(), 'Xlsx');
- //파일저장용
- // $writer->save(Excel_FilePath . '/' . $fileName);
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->excel_spreadSheet(), 'Xlsx');
+ //결과파일저장
+ $writer->save(PATHS['EXCEL'] . '/' . $fileName);
//Download시
header("Content-Type: application/vnd.ms-excel");
header(sprintf("Content-Disposition: attachment; filename=%s", urlencode($fileName)));
+ header("Expires: 0");
+ header("Cache-Control: must-revalidate");
+ header("Pragma: public");
+ header("Content-Length:" . filesize(PATHS['EXCEL'] . '/' . $fileName));
+ // flush();
+ // return readfile(PATHS['EXCEL'] . '/' . $fileName);
return $writer->save('php://output');
}
protected function excel_procedure()
diff --git a/app/Database/board.sql b/app/Database/board.sql
index 531dced..93250e4 100644
--- a/app/Database/board.sql
+++ b/app/Database/board.sql
@@ -26,10 +26,10 @@ DROP TABLE IF EXISTS tw_board;
-- select * from tw_board order by grpno desc,grporder asc
CREATE TABLE tw_board (
uid int(10) unsigned NOT NULL AUTO_INCREMENT,
- grpno int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음',
- grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 0부터시작',
- grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdpt+1씩 추가필요',
- board_category_uid varchar(36) NOT NULL COMMENT '게시판구분',
+ grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: uid와 Type맞춰야함 , 상위가없을시 기본 uid와 같음',
+ grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 최상위시 1부터시작',
+ grpdepth int(2) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 최상위시 1부터시작 , 상위 grpdpt+1씩 추가필요',
+ board_config_uid varchar(36) NOT NULL COMMENT '게시판구분',
user_uid varchar(36) NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',
@@ -39,13 +39,14 @@ CREATE TABLE tw_board (
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (uid),
- CONSTRAINT FOREIGN KEY (board_category_uid) REFERENCES tw_board_config (uid),
+ CONSTRAINT FOREIGN KEY (board_config_uid) REFERENCES tw_board_config (uid),
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (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 tw_board_file;
CREATE TABLE tw_board_file (
uid int(10) unsigned NOT NULL AUTO_INCREMENT,
- tw_board_uid int(10) unsigned NOT NULL COMMENT '게시판 정보',
+ 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 '실제파일명',
@@ -53,5 +54,5 @@ CREATE TABLE tw_board_file (
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (uid),
- CONSTRAINT FOREIGN KEY (tw_board_uid) REFERENCES tw_board (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
diff --git a/app/Helpers/Admin/BoardConfig_helper.php b/app/Helpers/Admin/BoardConfig_helper.php
index 575a571..c3610f1 100644
--- a/app/Helpers/Admin/BoardConfig_helper.php
+++ b/app/Helpers/Admin/BoardConfig_helper.php
@@ -12,7 +12,7 @@ function getFieldLabel_BoardConfigHelper($field, array $fieldRules, array $attri
}
//header.php에서 getFieldForm_Helper사용
-function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, array $attributes = array())
+function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, array $attributes = array())
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
@@ -22,14 +22,14 @@ function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, arra
case 'isreply':
case 'isupload':
case 'isdownload':
- foreach ($formOptions[$field] as $key => $label) {
- $checkboxs[] = form_checkbox("{$field}[]", $key, $key != 'guest' || $key == $value, $attributes) . $label;
+ foreach ($fieldFormOptions[$field] as $key => $label) {
+ $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? $value : explode("|", $value)), $attributes) . $label;
}
return implode(" ", $checkboxs);
break;
case 'status':
- $formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$formOptions[$field]];
- return form_dropdown($field, $formOptions[$field], $value, $attributes);
+ $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
+ return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
break;
case 'updated_at':
case 'created_at':
@@ -52,6 +52,17 @@ function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, arra
function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{
switch ($field) {
+ case 'isaccess':
+ case 'isread':
+ case 'iswrite':
+ case 'isreply':
+ case 'isupload':
+ case 'isdownload':
+ foreach ($fieldFormOptions[$field] as $key => $label) {
+ $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode("|", $entity->$field)), $attributes) . $label;
+ }
+ return implode(" ", $checkboxs);
+ break;
case 'head':
case 'tail':
return html_entity_decode($entity->$field);
@@ -65,7 +76,7 @@ function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, ar
}
} //
-function getFieldFilter_BoardConfigHelper($field, $value, array $formOptions, array $attributes = array())
+function getFieldFilter_BoardConfigHelper($field, $value, array $fieldFormOptions, array $attributes = array())
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
@@ -75,11 +86,11 @@ function getFieldFilter_BoardConfigHelper($field, $value, array $formOptions, ar
case 'isreply':
case 'isupload':
case 'isdownload':
- $formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$formOptions[$field]];
- return form_dropdown($field, $formOptions[$field], $value, $attributes);
+ $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
+ return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
break;
default:
- return getFieldForm_BoardConfigHelper($field, $value, $formOptions, $attributes);
+ return getFieldForm_BoardConfigHelper($field, $value, $fieldFormOptions, $attributes);
break;
}
} //
@@ -98,6 +109,17 @@ function getFieldIndex_Row_BoardConfigHelper($field, array $row, array $fieldFil
case 'name':
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], ["target" => "_self"]);
break;
+ case 'isaccess':
+ case 'isread':
+ case 'iswrite':
+ case 'isreply':
+ case 'isupload':
+ case 'isdownload':
+ foreach ($fieldFormOptions[$field] as $key => $label) {
+ $checkboxs[] = form_checkbox($field, $key, in_array($key, explode("|", $row[$field])), $attributes) . $label;
+ }
+ return '