servermgrv2 init...
This commit is contained in:
parent
5d1ddc3c8b
commit
ce698d7d75
@ -140,7 +140,7 @@ define('SESSION_NAMES', [
|
||||
'ISLOGIN' => "islogined",
|
||||
'AUTH' => 'auth'
|
||||
]);
|
||||
define('AUTH_FIELDS', ['id', 'title', 'role']);
|
||||
define('AUTH_FIELDS', ['ID' => 'id', 'TITLE' => 'title', 'ROLE' => 'role']);
|
||||
|
||||
//인증 관련
|
||||
define('AUTH_ADAPTERS', [
|
||||
@ -158,9 +158,9 @@ define('AUTH_ADAPTERS', [
|
||||
]);
|
||||
//등급 관련
|
||||
define('ROLES', [
|
||||
'CUSTOMERS' => ['user' => '일반회원', 'vip' => 'VIP회원'],
|
||||
'SELLERS' => ['bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러'],
|
||||
'OPERATORS' => ['manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터"],
|
||||
'guest' => '비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
|
||||
'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
|
||||
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
|
||||
]);
|
||||
define('STATUS', ["use" => "사용", "unuse" => "사용않함",]);
|
||||
|
||||
@ -180,6 +180,7 @@ foreach (PATHS as $key => $path) {
|
||||
//아이콘 및 Sound관련
|
||||
define('ICONS', [
|
||||
'NEW' => '<i class="fa fa-paper-plane" aria-hidden="true"></i>',
|
||||
'REPLY' => '<button style="font-size:12px"><i class="fa fa-reply"></i>Reply</button>',
|
||||
'DELETE' => '<i class="fa fa-trash-o"></i>',
|
||||
'RELOAD' => '<i class="fa fa-refresh" aria-hidden="true"></i>',
|
||||
'SETTING' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
|
||||
|
||||
@ -74,14 +74,28 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('toggle/(:num)/(:hash)', 'LoggerController::toggle/$1/$2', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('batchjob', 'LoggerController::batchjob', ['filter' => 'authFilter:master']);
|
||||
});
|
||||
$routes->group('boardconfig', static function ($routes) {
|
||||
$routes->get('', 'BoardConfigController::index');
|
||||
$routes->get('excel', 'BoardConfigController::excel/$1');
|
||||
$routes->get('insert', 'BoardConfigController::insert_form', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('insert', 'BoardConfigController::insert', ['filter' => 'authFilter:master,director']);
|
||||
$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,director']);
|
||||
$routes->get('toggle/(:uuid)/(:hash)', 'BoardConfigController::toggle/$1/$2', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('batchjob', 'BoardConfigController::batchjob', ['filter' => 'authFilter:master,director']);
|
||||
});
|
||||
$routes->group('board', static function ($routes) {
|
||||
$routes->get('', 'BoardController::index');
|
||||
$routes->get('excel', 'BoardController::excel');
|
||||
$routes->get('excel', 'BoardController::excel/$1');
|
||||
$routes->get('insert', 'BoardController::insert_form', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('insert', 'BoardController::insert', ['filter' => 'authFilter:master,director']);
|
||||
$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,director']);
|
||||
$routes->get('toggle/(:num)/(:hash)', 'BoardController::toggle/$1/$2', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('batchjob', 'BoardController::batchjob', ['filter' => 'authFilter:master,director']);
|
||||
|
||||
123
app/Controllers/Admin/BoardConfigController.php
Normal file
123
app/Controllers/Admin/BoardConfigController.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Models\BoardConfigModel;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class BoardConfigController extends \App\Controllers\Admin\AdminController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_className .= '/BoardConfig';
|
||||
$this->_model = new BoardConfigModel();
|
||||
$this->_defines = [
|
||||
'insert' => [
|
||||
'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',
|
||||
'head' => 'if_exist|string',
|
||||
'tail' => 'if_exist|string',
|
||||
'status' => 'if_exist|string',
|
||||
]
|
||||
],
|
||||
'update' => [
|
||||
'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'head', 'tail'],
|
||||
'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',
|
||||
'head' => 'if_exist|string',
|
||||
'tail' => 'if_exist|string',
|
||||
'status' => 'if_exist|string',
|
||||
]
|
||||
],
|
||||
'view' => [
|
||||
'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'head', 'tail'],
|
||||
'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',
|
||||
'head' => 'if_exist|string',
|
||||
'tail' => 'if_exist|string',
|
||||
'status' => 'if_exist|string',
|
||||
]
|
||||
],
|
||||
'index' => [
|
||||
'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'],
|
||||
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'],
|
||||
'batchjobFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'],
|
||||
],
|
||||
'excel' => [
|
||||
'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'],
|
||||
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'],
|
||||
],
|
||||
];
|
||||
helper($this->_className);
|
||||
$this->_viewPath = strtolower($this->_className);
|
||||
$this->_viewDatas['title'] = lang($this->_className . '.title');
|
||||
$this->_viewDatas['className'] = $this->_className;
|
||||
}
|
||||
|
||||
////Action 모음
|
||||
//Insert관련
|
||||
final public function insert()
|
||||
{
|
||||
return $this->insert_procedure();
|
||||
}
|
||||
//Update관련
|
||||
final public function update($uid)
|
||||
{
|
||||
return $this->update_procedure($uid);
|
||||
}
|
||||
//Toggle관련
|
||||
final public function toggle($uid, string $field)
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//Batchjob 관련
|
||||
final public function batchjob()
|
||||
{
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//Delete 관련
|
||||
final public function delete($uid)
|
||||
{
|
||||
return $this->delete_procedure($uid);
|
||||
}
|
||||
//View 관련
|
||||
final public function view($uid)
|
||||
{
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//Index 관련
|
||||
final public function index()
|
||||
{
|
||||
return $this->index_procedure();
|
||||
}
|
||||
//Excel 관련
|
||||
final public function excel()
|
||||
{
|
||||
return $this->excel_procedure();
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ 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
|
||||
{
|
||||
@ -19,30 +20,32 @@ class BoardController extends \App\Controllers\Admin\AdminController
|
||||
$this->_model = new BoardModel();
|
||||
$this->_defines = [
|
||||
'insert' => [
|
||||
'fields' => ['board_category', 'title', 'content', 'passwd', 'confirmpassword', 'status'],
|
||||
'fields' => ['board_category', 'title', 'content', 'passwd', 'confirmpassword', 'upload_file', 'status'],
|
||||
'fieldFilters' => ['board_category', 'user_uid', 'status'],
|
||||
'fieldRules' => [
|
||||
'board_category' => 'required|string',
|
||||
'title' => 'required|string',
|
||||
'content' => 'required|string',
|
||||
'passwd' => 'if_exist|trim|string',
|
||||
'confirmpassword' => 'if_exist|trim|matches[passwd]',
|
||||
'view_cnt' => 'if_exist|numeric',
|
||||
'status' => 'if_exist|string',
|
||||
'board_category' => 'required|string',
|
||||
'title' => 'required|string',
|
||||
'content' => 'required|string',
|
||||
'passwd' => 'if_exist|trim|string',
|
||||
'confirmpassword' => 'if_exist|trim|matches[passwd]',
|
||||
'view_cnt' => 'if_exist|numeric',
|
||||
'status' => 'if_exist|string',
|
||||
'upload_file' => 'if_exist|uploaded[upload_file]|is_image[upload_file]|mime_in[upload_file,image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[upload_file,100]|max_dims[upload_file,1024,768]'
|
||||
]
|
||||
],
|
||||
'update' => [
|
||||
'fields' => ['board_category', 'title', 'content', 'passwd', 'confirmpassword', 'status'],
|
||||
'fields' => ['board_category', 'title', 'content', 'passwd', 'confirmpassword', 'upload_file', 'status'],
|
||||
'fieldFilters' => ['board_category', 'user_uid', 'status'],
|
||||
'fieldRules' => [
|
||||
'board_category' => 'required|string',
|
||||
'title' => 'required|string',
|
||||
'content' => 'required|string',
|
||||
'passwd' => 'if_exist|trim|string',
|
||||
'confirmpassword' => 'if_exist|trim|matches[passwd]',
|
||||
'view_cnt' => 'if_exist|numeric',
|
||||
'status' => 'if_exist|string',
|
||||
]
|
||||
'board_category' => 'required|string',
|
||||
'title' => 'required|string',
|
||||
'content' => 'required|string',
|
||||
'passwd' => 'if_exist|trim|string',
|
||||
'confirmpassword' => 'if_exist|trim|matches[passwd]',
|
||||
'view_cnt' => 'if_exist|numeric',
|
||||
'status' => 'if_exist|string',
|
||||
'upload_file' => 'if_exist|uploaded[upload_file]|is_image[upload_file]|mime_in[upload_file,image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[upload_file,100]|max_dims[upload_file,1024,768]',
|
||||
],
|
||||
],
|
||||
'view' => [
|
||||
'fields' => ['board_category', 'user_uid', 'title', 'view_cnt', 'status', 'updated_at', 'created_at', 'content'],
|
||||
@ -63,6 +66,29 @@ class BoardController extends \App\Controllers\Admin\AdminController
|
||||
$this->_viewPath = strtolower($this->_className);
|
||||
$this->_viewDatas['title'] = lang($this->_className . '.title');
|
||||
$this->_viewDatas['className'] = $this->_className;
|
||||
//게시판 초기화
|
||||
$this->initConfig();
|
||||
}
|
||||
|
||||
private function initConfig()
|
||||
{
|
||||
foreach ((array)lang($this->_className . '.BOARD_CATEGORY') as $key => $label) {
|
||||
$this->_viewDatas['board_configs'][$key] = [
|
||||
'isHierarchy' => getenv("board.{$key}.hierarchy") ?: false,
|
||||
'isAccess' => getenv("board.{$key}.access") ?: true,
|
||||
'isAccessRoles' => getenv("board.{$key}.access.roles") ?: array_values(ROLES),
|
||||
'isRead' => getenv("board.{$key}.read") ?: true,
|
||||
'isReadRoles' => getenv("board.{$key}.read.roles") ?: array_values(ROLES),
|
||||
'isWrite' => getenv("board.{$key}.write") ?: false,
|
||||
'isWriteRoles' => getenv("board.{$key}.write.roles") ?: array_values(ROLES),
|
||||
'isReply' => getenv("board.{$key}.reply") ?: false,
|
||||
'isReplyRoles' => getenv("board.{$key}.reply.roles") ?: array_values(ROLES),
|
||||
'isUpload' => getenv("board.{$key}.upload") ?: false,
|
||||
'isUploadRoles' => getenv("board.{$key}.upload.roles") ?: array_values(ROLES),
|
||||
];
|
||||
}
|
||||
// echo var_export($this->_viewDatas['board_configs'], true);
|
||||
// exit;
|
||||
}
|
||||
|
||||
private function getUserModel(): UserModel
|
||||
@ -89,8 +115,26 @@ class BoardController extends \App\Controllers\Admin\AdminController
|
||||
}
|
||||
}
|
||||
|
||||
//Field별 Form Datas 처리용
|
||||
protected function getFieldFormData(string $field, $entity = null)
|
||||
{
|
||||
switch ($field) {
|
||||
case 'upload_file':
|
||||
$this->_viewDatas['fieldDatas'][$field] = $this->single_upload_procedure($field, $entity);
|
||||
break;
|
||||
default:
|
||||
return parent::getFieldFormData($field, $entity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////Action 모음
|
||||
//Insert관련
|
||||
protected function insert_process()
|
||||
{
|
||||
// upload처리
|
||||
return parent::insert_process();
|
||||
}
|
||||
final public function insert()
|
||||
{
|
||||
return $this->insert_procedure();
|
||||
@ -100,6 +144,11 @@ class BoardController extends \App\Controllers\Admin\AdminController
|
||||
{
|
||||
return $this->update_procedure($uid);
|
||||
}
|
||||
//Reply 관련
|
||||
final public function reply(int $uid)
|
||||
{
|
||||
return $this->reply_procedure($uid);
|
||||
}
|
||||
//Toggle관련
|
||||
final public function toggle($uid, string $field)
|
||||
{
|
||||
@ -116,6 +165,12 @@ class BoardController extends \App\Controllers\Admin\AdminController
|
||||
return $this->delete_procedure($uid);
|
||||
}
|
||||
//View 관련
|
||||
protected function view_process($entity)
|
||||
{
|
||||
// view_cnt에 추가하기위함
|
||||
$this->_model->increaseViewCount($entity->getPrimaryKey());
|
||||
return parent::view_process($entity);
|
||||
}
|
||||
final public function view($uid)
|
||||
{
|
||||
return $this->view_procedure($uid);
|
||||
|
||||
@ -65,26 +65,26 @@ class UserSNSController extends \App\Controllers\Admin\AdminController
|
||||
}
|
||||
|
||||
////Action 모음
|
||||
//Insert관련
|
||||
// final public function insert()
|
||||
// {
|
||||
// return $this->insert_procedure();
|
||||
// }
|
||||
// //Update관련
|
||||
// final public function update($uid)
|
||||
// {
|
||||
// return $this->update_procedure($uid);
|
||||
// }
|
||||
// Insert관련
|
||||
final public function insert()
|
||||
{
|
||||
return $this->insert_procedure();
|
||||
}
|
||||
//Update관련
|
||||
final public function update($uid)
|
||||
{
|
||||
return $this->update_procedure($uid);
|
||||
}
|
||||
//Toggle관련
|
||||
final public function toggle($uid, string $field)
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
// //Batchjob 관련
|
||||
// final public function batchjob()
|
||||
// {
|
||||
// return $this->batchjob_procedure();
|
||||
// }
|
||||
//Batchjob 관련
|
||||
final public function batchjob()
|
||||
{
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//Delete 관련
|
||||
final public function delete($uid)
|
||||
{
|
||||
|
||||
@ -79,14 +79,14 @@ abstract class BaseController extends Controller
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$temps = lang($this->_className . '.' . strtoupper($field));
|
||||
if (!is_array($temps)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 {$field}의 데이터가 array가 아닙니다.\n" . var_export($temps, true));
|
||||
$fieldFormOptionDatas = (array)lang($this->_className . '.' . strtoupper($field));
|
||||
if (!is_array($fieldFormOptionDatas)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 {$field}의 데이터가 array가 아닙니다.\n" . var_export($fieldFormOptionDatas, true));
|
||||
}
|
||||
return array_merge(
|
||||
[DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택'],
|
||||
lang($this->_className . '.' . strtoupper($field))
|
||||
);
|
||||
return [
|
||||
DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택',
|
||||
...$fieldFormOptionDatas
|
||||
];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -117,6 +117,73 @@ abstract class BaseController extends Controller
|
||||
return $tempRules;
|
||||
}
|
||||
|
||||
//Field별 Form Datas 처리용
|
||||
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]}"
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Upload FIle관련
|
||||
protected function upload_file_process($upfile)
|
||||
{
|
||||
$fileName = "";
|
||||
if ($upfile->isValid() && !$upfile->hasMoved()) {
|
||||
$fileName = $upfile->getRandomName();
|
||||
$upfile->move(PATHS['UPLOAD'], $fileName);
|
||||
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
||||
$fileName = $upfile->getRandomName();
|
||||
}
|
||||
return $fileName;
|
||||
}
|
||||
protected function single_upload_procedure(string $field, $entity = null)
|
||||
{
|
||||
$upfile = $this->request->getFile($field);
|
||||
$fileName = $this->upload_file_process($upfile);
|
||||
// $fileDatas=array();
|
||||
// if ($upfile->isValid() && !$upfile->hasMoved()) {
|
||||
// $filepath = PATHS['UPLOAD'] . $upfile->store();
|
||||
// $fileDatas = [
|
||||
// 'uploaded_fileinfo' => new \CodeIgniter\Files\File($filepath)
|
||||
// ];
|
||||
// return $fileDatas;
|
||||
// }
|
||||
return $fileName;
|
||||
}
|
||||
protected function multiple_upload_procedure(string $field, $entity = null): array
|
||||
{
|
||||
//Multiple파일의경우 html에서는 필드명[]를 넣어야하며
|
||||
//rule에서 "uploaded[필드명.0]|is_image[필드명]~~" 이런식으로 넣어야함
|
||||
$fileNames = array();
|
||||
if ($upfiles = $this->request->getFiles()) {
|
||||
foreach ($upfiles[$field] as $upfile) {
|
||||
if ($upfile->isValid() && !$upfile->hasMoved()) {
|
||||
$fileName = $this->upload_file_process($upfile);
|
||||
array_push(
|
||||
$this->_viewDatas['fieldDatas'][$field],
|
||||
$fileName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $fileNames;
|
||||
}
|
||||
|
||||
//Insert관련
|
||||
protected function insert_init()
|
||||
{
|
||||
@ -150,8 +217,7 @@ abstract class BaseController extends Controller
|
||||
//변경된 값 적용
|
||||
$this->_viewDatas['fieldDatas'] = array();
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
$this->_viewDatas['fieldDatas'][$field] = rtrim($this->request->getVar($field));
|
||||
Log::add("info", "{$field} : {$this->_viewDatas['fieldDatas'][$field]}");
|
||||
$this->getFieldFormData($field);
|
||||
}
|
||||
//변경할 값 확인
|
||||
if (!$this->validate($this->_viewDatas['fieldRules'])) {
|
||||
@ -217,16 +283,7 @@ abstract class BaseController extends Controller
|
||||
//변경된 값 적용
|
||||
$this->_viewDatas['fieldDatas'] = array();
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
$this->_viewDatas['fieldDatas'][$field] = rtrim($this->request->getVar($field));
|
||||
if ($entity->$field != $this->_viewDatas['fieldDatas'][$field]) {
|
||||
// 기존값을 DB에서 수정전까지 유지하기위해서
|
||||
// $entity->$field = $this->_viewDatas['fieldDatas'][$field];
|
||||
//암호는 보안상 log에 남지 않게하기 위함
|
||||
Log::add(
|
||||
$field == 'passwd' ? "debug" : "info",
|
||||
"{$field} : {$entity->$field} => {$this->_viewDatas['fieldDatas'][$field]}"
|
||||
);
|
||||
}
|
||||
$this->getFieldFormData($field, $entity);
|
||||
}
|
||||
//변경할 값 확인
|
||||
if (!$this->validate($this->_viewDatas['fieldRules'])) {
|
||||
@ -258,6 +315,59 @@ abstract class BaseController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
//Reply관련
|
||||
protected function reply_init()
|
||||
{
|
||||
return $this->update_init();
|
||||
}
|
||||
protected function reply_form_init()
|
||||
{
|
||||
return $this->update_form_init();
|
||||
}
|
||||
protected function reply_form_process($entity)
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
final public function reply_form($uid)
|
||||
{
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$this->reply_init();
|
||||
$this->reply_form_init();
|
||||
$this->_viewDatas['entity'] = $this->update_form_process($entity);
|
||||
return view($this->_viewPath . '/reply', $this->_viewDatas);
|
||||
} catch (\Exception $e) {
|
||||
return alert_CommonHelper($e->getMessage(), 'back');
|
||||
}
|
||||
}
|
||||
protected function reply_validate($entity)
|
||||
{
|
||||
return $this->update_validate($entity);
|
||||
}
|
||||
protected function reply_process($entity)
|
||||
{
|
||||
return $this->_model->reply($entity, $this->_viewDatas['fieldDatas']);
|
||||
}
|
||||
protected function reply_procedure($uid)
|
||||
{
|
||||
$message = "";
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$this->reply_init();
|
||||
$entity = $this->reply_validate($entity);
|
||||
$entity = $this->reply_process($entity);
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
|
||||
Log::save("{$this->_viewDatas['title']} {$message}");
|
||||
return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
$message = __FUNCTION__ . " 실패하였습니다.";
|
||||
Log::add("warning", $e->getMessage());
|
||||
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
|
||||
Log::save("{$this->_viewDatas['title']} {$message}", false);
|
||||
return redirect()->back()->withInput()->with("error", $message . "<br>\n{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
//Toggle 관련
|
||||
protected function toggle_init($field)
|
||||
{
|
||||
|
||||
@ -1,16 +1,35 @@
|
||||
|
||||
DROP TABLE IF EXISTS tw_board_config;
|
||||
CREATE TABLE 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: 사용않함 등등',
|
||||
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 tw_board;
|
||||
-- 1. 게시물 추가전 grpno에 해당하는 기존게시물의 grpord를 +1씩증가 작업
|
||||
-- update tw_board set grpord=grpord+1 where grpno=그룹번호 and grpord > 선택한 grpno
|
||||
-- update tw_board set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno
|
||||
-- 2. 게시물 추가시 작업
|
||||
-- insert tw_board grpno=그룹번호,grpord=grpord+1,grpdpt=grpdpt+1
|
||||
-- insert tw_board grpno=그룹번호,grporder=grporder+1,grpdepth=grpdepth+1
|
||||
-- 3. 게시물 조회시 작업
|
||||
-- select * from tw_board order by grpno desc,grpord asc
|
||||
-- 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와 같음',
|
||||
grpord int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 0부터시작',
|
||||
grpdpt int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdpt+1씩 추가필요',
|
||||
board_category varchar(10) NOT NULL COMMENT '게시판구분',
|
||||
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 '게시판구분',
|
||||
user_uid varchar(36) NULL COMMENT '작성자 정보',
|
||||
title varchar(255) NOT NULL COMMENT '제목',
|
||||
content text NOT NULL COMMENT '내용',
|
||||
@ -20,5 +39,19 @@ 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 (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 ='게시판 정보';
|
||||
|
||||
CREATE TABLE tw_board_file (
|
||||
uid int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
tw_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 (tw_board_uid) REFERENCES tw_board (uid)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='게시판 File정보';
|
||||
@ -4,7 +4,7 @@ namespace App\Entities;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
abstract class CommonEntity extends Entity
|
||||
abstract class BaseEntity extends Entity
|
||||
{
|
||||
abstract public function getPrimaryKey();
|
||||
abstract public function getTitle();
|
||||
29
app/Entities/BoardConfigEntity.php
Normal file
29
app/Entities/BoardConfigEntity.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\BaseEntity;
|
||||
|
||||
class BoardConfigEntity extends BaseEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->attributes['name'];
|
||||
}
|
||||
public function getHead()
|
||||
{
|
||||
return $this->attributes['head'];
|
||||
}
|
||||
public function getTail()
|
||||
{
|
||||
return $this->attributes['tail'];
|
||||
}
|
||||
}
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Entities\BaseEntity;
|
||||
|
||||
class BoardEntity extends CommonEntity
|
||||
class BoardEntity extends BaseEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Entities\BaseEntity;
|
||||
|
||||
class HPILOEntity extends CommonEntity
|
||||
class HPILOEntity extends BaseEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
@ -2,17 +2,20 @@
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
class LoggerEntity extends CommonEntity
|
||||
use App\Entities\BaseEntity;
|
||||
|
||||
class LoggerEntity extends BaseEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
|
||||
public function getPrimaryKey(){
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getTitle(){
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->attributes['title'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Entities\BaseEntity;
|
||||
|
||||
class UserEntity extends CommonEntity
|
||||
class UserEntity extends BaseEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Entities\BaseEntity;
|
||||
|
||||
class UserSNSEntity extends CommonEntity
|
||||
class UserSNSEntity extends BaseEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
@ -30,11 +30,13 @@ class AuthFilter implements FilterInterface
|
||||
$auth = session()->get(SESSION_NAMES['AUTH']);
|
||||
// dd($auth);
|
||||
// 회원 ROLE이 필요ROLE 목록에 존재하지 않으면(ACL)
|
||||
if (!in_array($auth['role'], $arguments)) {
|
||||
if (!in_array($auth[AUTH_FIELDS['ROLE']], $arguments)) {
|
||||
return redirect()->to('/login')->with(
|
||||
'error',
|
||||
sprintf(
|
||||
"{$auth['role']},{$$auth['title']}회원님은 접속에 필요한 권한[%s]이 없습니다. ",
|
||||
"%s,%s회원님은 접속에 필요한 권한[%s]이 없습니다. ",
|
||||
$auth[AUTH_FIELDS['ROLE']],
|
||||
$auth[AUTH_FIELDS['TITLE']],
|
||||
implode(",", $arguments)
|
||||
)
|
||||
);
|
||||
|
||||
103
app/Helpers/Admin/BoardConfig_helper.php
Normal file
103
app/Helpers/Admin/BoardConfig_helper.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
function getFieldLabel_BoardConfigHelper($field, array $fieldRules, array $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
if (strpos($fieldRules[$field], 'required') !== false) {
|
||||
array_push($attributes, 'style="color:red";');
|
||||
}
|
||||
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/BoardConfig.label.{$field}"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//header.php에서 getFieldForm_Helper사용
|
||||
function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
case 'isaccess':
|
||||
case 'isread':
|
||||
case 'iswrite':
|
||||
case 'isreply':
|
||||
case 'isupload':
|
||||
case 'isdownload':
|
||||
case 'status':
|
||||
return form_multiselect($field, $formOptions[$field], explode('|', $value), [...$attributes, 'row' => 10]);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
return form_input($field, $value, [...$attributes, 'class' => 'calender']);
|
||||
break;
|
||||
case 'passwd':
|
||||
case 'confirmpassword':
|
||||
return form_password($field, DEFAULTS['EMPTY'], $attributes);
|
||||
break;
|
||||
case 'head':
|
||||
case 'tail':
|
||||
return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']);
|
||||
break;
|
||||
default:
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $entity->$field;
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldFilter_BoardConfigHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
case 'isaccess':
|
||||
case 'isread':
|
||||
case 'iswrite':
|
||||
case 'isreply':
|
||||
case 'isupload':
|
||||
case 'isdownload':
|
||||
case 'status':
|
||||
return form_dropdown($field, $formOptions[$field], explode('|', $value), [...$attributes, 'row' => 10]);
|
||||
break;
|
||||
default:
|
||||
return getFieldForm_BoardConfigHelper($field, $value, $formOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/BoardConfig.label.{$field}");
|
||||
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $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, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'name':
|
||||
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], ["target" => "_self"]);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldFilter_BoardConfigHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -32,6 +32,9 @@ function getFieldForm_BoardHelper($field, $value, array $formOptions, array $att
|
||||
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;
|
||||
default:
|
||||
return form_input($field, $value, [...$attributes, 'size' => '80']);
|
||||
break;
|
||||
@ -53,6 +56,16 @@ function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $f
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldFilter_BoardHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
default:
|
||||
return getFieldForm_BoardHelper($field, $value, $formOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_BoardHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/Board.label.{$field}");
|
||||
@ -65,7 +78,12 @@ function getFieldIndex_Row_BoardHelper($field, array $row, array $fieldFilters,
|
||||
{
|
||||
switch ($field) {
|
||||
case 'title':
|
||||
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], ["target" => "_self"]);
|
||||
return sprintf(
|
||||
'<div style="text-align:left; padding-left:%spx;">%s %s</div>',
|
||||
$row['grpdepth'] * 30,
|
||||
anchor(current_url() . '/view/' . $row['uid'], $row[$field], ["target" => "_self"]),
|
||||
anchor(current_url() . '/reply/' . $row['uid'], ICONS['REPLY'], ["target" => "_self"])
|
||||
);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
@ -74,7 +92,7 @@ function getFieldIndex_Row_BoardHelper($field, array $row, array $fieldFilters,
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldForm_BoardHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
return getFieldFilter_BoardHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
|
||||
@ -46,6 +46,16 @@ function getFieldView_LoggerHelper($field, $entity, array $fieldFilters, array $
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldFilter_LoggerHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
default:
|
||||
return getFieldForm_LoggerHelper($field, $value, $formOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_LoggerHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/Logger.label.{$field}");
|
||||
@ -71,7 +81,7 @@ function getFieldIndex_Row_LoggerHelper($field, array $row, array $fieldFilters,
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldForm_LoggerHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
return getFieldFilter_LoggerHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
|
||||
@ -43,6 +43,16 @@ function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldFilter_UserSNSHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
default:
|
||||
return getFieldForm_UserSNSHelper($field, $value, $formOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_UserSNSHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/UserSNS.label.{$field}");
|
||||
@ -64,7 +74,7 @@ function getFieldIndex_Row_UserSNSHelper($field, array $row, array $fieldFilters
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldForm_UserSNSHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
return getFieldFilter_UserSNSHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
|
||||
@ -46,6 +46,16 @@ function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fi
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldFilter_UserHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
default:
|
||||
return getFieldForm_UserHelper($field, $value, $formOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_UserHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/User.label.{$field}");
|
||||
@ -67,7 +77,7 @@ function getFieldIndex_Row_UserHelper($field, array $row, array $fieldFilters, $
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldForm_UserHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
return getFieldFilter_UserHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
|
||||
@ -13,6 +13,7 @@ return [
|
||||
'passwd' => "암호",
|
||||
'confirmpassword' => "암호확인",
|
||||
'view_cnt' => "조회수",
|
||||
'upload_file' => "UploadFile",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일"
|
||||
|
||||
26
app/Language/en/Admin/BoardConfig.php
Normal file
26
app/Language/en/Admin/BoardConfig.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
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" => [...STATUS],
|
||||
];
|
||||
@ -50,7 +50,7 @@ abstract class Adapter
|
||||
{
|
||||
$this->_session->set(SESSION_NAMES['ISLOGIN'], true);
|
||||
$auths = [];
|
||||
foreach (AUTH_FIELDS as $field) {
|
||||
foreach (AUTH_FIELDS as $key => $field) {
|
||||
switch ($field) {
|
||||
case 'id':
|
||||
$auths[$field] = $entity->getPrimaryKey();
|
||||
|
||||
@ -4,9 +4,9 @@ namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
use App\Libraries\Log\Log;
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Entities\BaseEntity;
|
||||
|
||||
abstract class CommonModel extends Model
|
||||
abstract class BaseModel extends Model
|
||||
{
|
||||
protected $DBGroup = 'default';
|
||||
// protected $table = 'user';
|
||||
@ -41,8 +41,8 @@ abstract class CommonModel extends Model
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
abstract public function getEntityByField($field, $value): ?CommonEntity;
|
||||
abstract public function getEntity($uid): ?CommonEntity;
|
||||
abstract public function getEntityByField($field, $value): ?BaseEntity;
|
||||
abstract public function getEntity($uid): ?BaseEntity;
|
||||
abstract public function getFieldFormOptions(): array;
|
||||
|
||||
//참고:https://www.delftstack.com/howto/php/php-uuid/#create-a-function-to-generate-v5-uuid-in-php
|
||||
@ -73,6 +73,60 @@ abstract class CommonModel extends Model
|
||||
substr($hashing, 20, 12)
|
||||
);
|
||||
}
|
||||
|
||||
//계층형구조구현
|
||||
final protected function setHierarchyCreate($entity)
|
||||
{
|
||||
//자기자신이 최상위가 되게 만들기위함
|
||||
$entity->grpno = $entity->getPrimaryKey();
|
||||
// echo var_export($entity, true);
|
||||
// exit;
|
||||
//값변경후 다시 저장
|
||||
if (!$this->save($entity)) {
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getLastQuery());
|
||||
Log::add("error", implode("\n", $this->errors()));
|
||||
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->errors(), true));
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
final protected function setHierarchyReply($entity, $replyEntity)
|
||||
{
|
||||
//부모의 그룹과 grpno가 같고, 부모의 grporder보다 1 큰것을 grporder+1을 해서 update
|
||||
//escape -> false옵션 반드시 있어야함
|
||||
$this->builder()->set('grporder', 'grporder+1', false);
|
||||
$this->builder()->where([
|
||||
'grpno' => $entity->grpno,
|
||||
'grporder >' => $entity->grporder
|
||||
]);
|
||||
$this->builder()->update();
|
||||
// echo $this->getLastQuery();
|
||||
// exit;
|
||||
|
||||
//reply용 설정
|
||||
$replyEntity->grpno = $entity->grpno;
|
||||
$replyEntity->grporder = $entity->grporder + 1;
|
||||
$replyEntity->grpdepth = $entity->grpdepth + 1;
|
||||
return $replyEntity;
|
||||
}
|
||||
|
||||
protected function changeFormData($field, $value)
|
||||
{
|
||||
switch ($field) {
|
||||
case 'passwd':
|
||||
return $value ? password_hash($value, PASSWORD_DEFAULT) : "";
|
||||
break;
|
||||
case 'content':
|
||||
return htmlentities($value);
|
||||
break;
|
||||
case 'status':
|
||||
return $value ?: DEFAULTS['STATUS'];
|
||||
break;
|
||||
default:
|
||||
return $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final protected function create_process($entity)
|
||||
{
|
||||
//primaryKey 할당
|
||||
@ -80,11 +134,16 @@ abstract class CommonModel extends Model
|
||||
$pk = $this->primaryKey;
|
||||
$entity->$pk = $this->getUUIDv5_CommonTrait();
|
||||
}
|
||||
// echo var_export($entity, true);
|
||||
// exit;
|
||||
if (!$this->save($entity)) {
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getLastQuery());
|
||||
Log::add("error", implode("\n", $this->errors()));
|
||||
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->errors(), true));
|
||||
}
|
||||
// echo "<HR>";
|
||||
// echo $this->getLastQuery();
|
||||
// exit;
|
||||
//primaryKey 할당
|
||||
if ($this->useAutoIncrement === true) {
|
||||
$pk = $this->primaryKey;
|
||||
@ -94,6 +153,7 @@ abstract class CommonModel extends Model
|
||||
}
|
||||
final protected function modify_process($entity)
|
||||
{
|
||||
$entity->updated_at = time();
|
||||
if ($entity->hasChanged()) {
|
||||
if (!$this->save($entity)) {
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getLastQuery());
|
||||
@ -106,6 +166,17 @@ abstract class CommonModel extends Model
|
||||
return $entity;
|
||||
}
|
||||
|
||||
//View관련 (게시판등의 조회수 증가함수)
|
||||
final public function increaseViewCount($uid, $field = 'view_cnt', int $cnt = 1)
|
||||
{
|
||||
//escape -> false옵션 반드시 있어야함
|
||||
$this->builder()->set($field, "{$field}+{$cnt}", false);
|
||||
$this->builder()->where($this->primaryKey, $uid);
|
||||
$this->builder()->update();
|
||||
// echo $this->getLastQuery();
|
||||
// exit;
|
||||
}
|
||||
|
||||
//Index관련
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
88
app/Models/BoardConfigModel.php
Normal file
88
app/Models/BoardConfigModel.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Entities\BoardConfigEntity;
|
||||
|
||||
class BoardConfigModel extends BaseModel
|
||||
{
|
||||
protected $table = 'tw_board_config';
|
||||
// protected $primaryKey = 'uid';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $allowedFields = ['uid', 'name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'head', 'tail', 'status', 'updated_at'];
|
||||
protected $validationRules = [
|
||||
'uid' => 'required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]',
|
||||
'name' => 'required|string',
|
||||
'isaccess' => 'required|string',
|
||||
'isread' => 'required|string',
|
||||
'iswrite' => 'required|string',
|
||||
'isreply' => 'required|string',
|
||||
'isupload' => 'required|string',
|
||||
'isdownload' => 'required|string',
|
||||
'head' => 'if_exist|string',
|
||||
'tail' => 'if_exist|string',
|
||||
'status' => 'if_exist|string',
|
||||
'updated_at' => 'if_exist|valid_date',
|
||||
'created_at' => 'if_exist|valid_date',
|
||||
];
|
||||
|
||||
public function getEntityByField($field, $value): ?BoardConfigEntity
|
||||
{
|
||||
$entity = $this->asObject(BoardConfigEntity::class)->where($field, $value)->first();
|
||||
if (is_null($entity)) {
|
||||
throw new \Exception("해당 데이터가 없습니다.\n {$field}->{$value}");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
public function getEntity($uid): ?BoardConfigEntity
|
||||
{
|
||||
return $this->getEntityByField($this->primaryKey, $uid);
|
||||
}
|
||||
public function getFieldFormOptions(array $wheres = array(), $temps = array()): array
|
||||
{
|
||||
foreach ($this->asObject(BoardConfigEntity::class)->where($wheres)->findAll() as $entity) {
|
||||
$temps[$entity->getPrimaryKey()] = $entity->getTitle();
|
||||
}
|
||||
return $temps;
|
||||
}
|
||||
|
||||
protected function changeFormData($field, $value)
|
||||
{
|
||||
switch ($field) {
|
||||
case 'head':
|
||||
case 'tail':
|
||||
return htmlentities($value);
|
||||
break;
|
||||
default:
|
||||
return $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public function create(array $formDatas): BoardConfigEntity
|
||||
{
|
||||
$entity = new BoardConfigEntity($formDatas);
|
||||
foreach ($formDatas as $field => $value) {
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return parent::create_process($entity);
|
||||
}
|
||||
public function modify(BoardConfigEntity $entity, array $formDatas): BoardConfigEntity
|
||||
{
|
||||
foreach ($formDatas as $field => $value) {
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return parent::modify_process($entity);
|
||||
}
|
||||
|
||||
//Index관련
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike('name', $word, 'both'); //befor , after , both
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = 'ASC')
|
||||
{
|
||||
$this->orderBy("name", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
}
|
||||
}
|
||||
@ -4,25 +4,25 @@ namespace App\Models;
|
||||
|
||||
use App\Entities\BoardEntity;
|
||||
|
||||
class BoardModel extends CommonModel
|
||||
class BoardModel extends BaseModel
|
||||
{
|
||||
protected $table = 'tw_board';
|
||||
// protected $primaryKey = 'uid';
|
||||
// protected $useAutoIncrement = true;
|
||||
protected $allowedFields = ['grpno', 'grpord', 'grpdpt', 'board_category', 'user_uid', 'title', 'content', 'passwd', 'view_cnt', 'status', 'updated_at'];
|
||||
protected $allowedFields = ['grpno', 'grporder', 'grpdepth', 'board_category', 'user_uid', 'title', 'content', 'passwd', 'view_cnt', 'status', 'updated_at'];
|
||||
protected $validationRules = [
|
||||
'grpno' => 'if_exist|numeric',
|
||||
'grpord' => 'if_exist|numeric',
|
||||
'grpdpt' => 'if_exist|numeric',
|
||||
'board_category' => 'required|string',
|
||||
'user_uid' => 'if_exist|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]',
|
||||
'title' => 'required|string',
|
||||
'grpno' => 'if_exist|numeric',
|
||||
'grporder' => 'if_exist|numeric',
|
||||
'grpdepth' => 'if_exist|numeric',
|
||||
'board_category' => 'required|string',
|
||||
'user_uid' => 'if_exist|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]',
|
||||
'title' => 'required|string',
|
||||
'content' => 'required|string',
|
||||
'passwd' => 'if_exist|trim|string',
|
||||
'view_cnt' => 'if_exist|numeric',
|
||||
'status' => 'if_exist|string',
|
||||
'updated_at' => 'if_exist|valid_date',
|
||||
'created_at' => 'if_exist|valid_date',
|
||||
'view_cnt' => 'if_exist|numeric',
|
||||
'status' => 'if_exist|string',
|
||||
'updated_at' => 'if_exist|valid_date',
|
||||
'created_at' => 'if_exist|valid_date',
|
||||
];
|
||||
|
||||
public function getEntityByField($field, $value): ?BoardEntity
|
||||
@ -44,35 +44,22 @@ class BoardModel extends CommonModel
|
||||
}
|
||||
return $temps;
|
||||
}
|
||||
private function changeFormData($field, $value)
|
||||
{
|
||||
switch ($field) {
|
||||
case 'passwd':
|
||||
return $value ? password_hash($value, PASSWORD_DEFAULT) : "";
|
||||
break;
|
||||
case 'content':
|
||||
return htmlentities($value);
|
||||
break;
|
||||
case 'status':
|
||||
return $value ?: DEFAULTS['STATUS'];
|
||||
break;
|
||||
default:
|
||||
return $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function create(array $formDatas): BoardEntity
|
||||
{
|
||||
$entity = new BoardEntity($formDatas);
|
||||
//로그인 여부 확인후 필요한 데이터 저장
|
||||
if (session()->get(SESSION_NAMES['ISLOGIN'])) {
|
||||
$auth = session()->get(SESSION_NAMES['AUTH']);
|
||||
$entity->user_uid = $auth['id'];
|
||||
$entity->user_uid = $auth[AUTH_FIELDS['ID']];
|
||||
}
|
||||
foreach ($formDatas as $field => $value) {
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return parent::create_process($entity);
|
||||
$entity = parent::create_process($entity);
|
||||
//계층형
|
||||
$entity = $this->setHierarchyCreate($entity);
|
||||
return $entity;
|
||||
}
|
||||
public function modify(BoardEntity $entity, array $formDatas): BoardEntity
|
||||
{
|
||||
@ -81,6 +68,24 @@ class BoardModel extends CommonModel
|
||||
}
|
||||
return parent::modify_process($entity);
|
||||
}
|
||||
public function reply(BoardEntity $entity, array $formDatas): BoardEntity
|
||||
{
|
||||
$replyEntity = new BoardEntity($formDatas);
|
||||
//로그인 여부 확인후 필요한 데이터 저장
|
||||
if (session()->get(SESSION_NAMES['ISLOGIN'])) {
|
||||
$auth = session()->get(SESSION_NAMES['AUTH']);
|
||||
$replyEntity->user_uid = $auth[AUTH_FIELDS['ID']];
|
||||
}
|
||||
$replyEntity->title = "RE:" . $entity->title;
|
||||
foreach ($formDatas as $field => $value) {
|
||||
$replyEntity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
//계층형
|
||||
$replyEntity = $this->setHierarchyReply($entity, $replyEntity);
|
||||
// echo var_export($replyEntity, true);
|
||||
// exit;
|
||||
return $this->create_process($replyEntity);
|
||||
}
|
||||
|
||||
//Index관련
|
||||
public function setIndexWordFilter(string $word)
|
||||
@ -92,7 +97,7 @@ class BoardModel extends CommonModel
|
||||
public function setIndexOrderBy($field, $order = 'DESC')
|
||||
{
|
||||
$this->orderBy("grpno", "DESC");
|
||||
$this->orderBy("grpord", "ASC");
|
||||
$this->orderBy("grporder", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Entities\HPILOEntity;
|
||||
|
||||
class HPILOModel extends CommonModel
|
||||
class HPILOModel extends BaseModel
|
||||
{
|
||||
protected $table = 'tw_hpilo';
|
||||
// protected $primaryKey = 'uid';
|
||||
|
||||
@ -4,7 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Entities\LoggerEntity;
|
||||
|
||||
class LoggerModel extends CommonModel
|
||||
class LoggerModel extends BaseModel
|
||||
{
|
||||
protected $table = 'tw_logger';
|
||||
// protected $primaryKey = 'uid';
|
||||
@ -45,16 +45,17 @@ class LoggerModel extends CommonModel
|
||||
//로그인 여부 확인후 필요한 데이터 저장
|
||||
if (session()->get(SESSION_NAMES['ISLOGIN'])) {
|
||||
$auth = session()->get(SESSION_NAMES['AUTH']);
|
||||
$entity->user_uid = $auth['id'];
|
||||
$entity->user_uid = $auth[AUTH_FIELDS['ID']];
|
||||
}
|
||||
foreach ($formDatas as $field => $value) {
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return parent::create_process($entity);
|
||||
}
|
||||
public function modify(LoggerEntity $entity, array $formDatas): LoggerEntity
|
||||
{
|
||||
foreach ($formDatas as $field => $value) {
|
||||
if ($entity->$field != $formDatas[$field]) {
|
||||
$entity->$field = $value;
|
||||
}
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return parent::modify_process($entity);
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
|
||||
class UserModel extends CommonModel
|
||||
class UserModel extends BaseModel
|
||||
{
|
||||
protected $table = 'tw_user';
|
||||
// protected $primaryKey = 'uid';
|
||||
@ -45,16 +45,14 @@ class UserModel extends CommonModel
|
||||
{
|
||||
$entity = new UserEntity($formDatas);
|
||||
foreach ($formDatas as $field => $value) {
|
||||
$entity->$field = $field === 'passwd' ? password_hash($value, PASSWORD_DEFAULT) : $value;
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return parent::create_process($entity);
|
||||
}
|
||||
public function modify(UserEntity $entity, array $formDatas): UserEntity
|
||||
{
|
||||
foreach ($formDatas as $field => $value) {
|
||||
if ($entity->$field != $formDatas[$field]) {
|
||||
$entity->$field = $field === 'passwd' ? password_hash($value, PASSWORD_DEFAULT) : $value;
|
||||
}
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return parent::modify_process($entity);
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Entities\UserSNSEntity;
|
||||
|
||||
class UserSNSModel extends CommonModel
|
||||
class UserSNSModel extends BaseModel
|
||||
{
|
||||
protected $table = 'tw_user_sns';
|
||||
// protected $primaryKey = 'uid';
|
||||
@ -41,23 +41,22 @@ class UserSNSModel extends CommonModel
|
||||
}
|
||||
return $temps;
|
||||
}
|
||||
|
||||
public function create(string $site, array $formDatas): UserSNSEntity
|
||||
{
|
||||
$entity = new UserSNSEntity();
|
||||
$entity->site = $site;
|
||||
$entity->id = $formDatas['id'];
|
||||
$entity->name = $formDatas['name'];
|
||||
$entity->email = $formDatas['email'];
|
||||
$entity->detail = json_encode($formDatas);
|
||||
$entity->status = 'standby';
|
||||
foreach ($formDatas as $field => $value) {
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return $this->create_process($entity);
|
||||
}
|
||||
public function modify(UserSNSEntity $entity, array $formDatas): UserSNSEntity
|
||||
{
|
||||
foreach ($formDatas as $field => $value) {
|
||||
if ($entity->$field != $formDatas[$field]) {
|
||||
$entity->$field = $value;
|
||||
}
|
||||
$entity->$field = $this->changeFormData($field, $value);
|
||||
}
|
||||
return $this->modify_process($entity);
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<div class="indexTable_head">
|
||||
<?= form_open(current_url(), array("method" => "get")) ?>
|
||||
<ul class="nav">
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldForm_BoardHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_BoardHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?= $this->include('templates/admin/index_head'); ?>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
@ -35,7 +35,7 @@
|
||||
</table>
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldForm_BoardHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_BoardHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?></li>
|
||||
<li class="nav-item"><?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
|
||||
</ul>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?= $this->include('templates/admin/header'); ?>
|
||||
<?= form_open(current_url(), $forms['attributes'], $forms['hiddens']) ?>
|
||||
<?= form_open_multipart(current_url(), $forms['attributes'], $forms['hiddens']) ?>
|
||||
<table class="table table-bordered table-hover table-striped indexTable ">
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<tr>
|
||||
|
||||
32
app/Views/admin/board/reply.php
Normal file
32
app/Views/admin/board/reply.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?= $this->include('templates/admin/header'); ?>
|
||||
<?= form_open_multipart(current_url(), $forms['attributes'], $forms['hiddens']) ?>
|
||||
<table class="table table-bordered table-hover table-striped indexTable ">
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<tr>
|
||||
<td nowrap style="background-color:#e8ebe9; width:10%; text-align:right; padding-right:20px;">
|
||||
<?= getFieldLabel_BoardHelper($field, $fieldRules) ?>
|
||||
</td>
|
||||
<td style="text-align:left; padding-left:20px;">
|
||||
<?= getFieldForm_BoardHelper($field, is_null(old($field)) ? $entity->$field : old($field), $fieldFormOptions) ?>
|
||||
<?= validation_show_error($field); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td valign="bottom" colspan="2" style="text-align:center;"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?= form_close(); ?>
|
||||
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
|
||||
<script src="<?= base_url() ?>vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<script>
|
||||
tinymce.init({
|
||||
selector: '.editor',
|
||||
theme: 'silver',
|
||||
height: 500
|
||||
});
|
||||
</script>
|
||||
<?= $this->include('templates/admin/footer'); ?>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,7 +1,7 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?= $this->include('templates/admin/header'); ?>
|
||||
<?= form_open(current_url(), $forms['attributes'], $forms['hiddens']) ?>
|
||||
<?= form_open_multipart(current_url(), $forms['attributes'], $forms['hiddens']) ?>
|
||||
<table class="table table-bordered table-hover table-striped indexTable ">
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<tr>
|
||||
|
||||
49
app/Views/admin/boardconfig/index.php
Normal file
49
app/Views/admin/boardconfig/index.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?= $this->include('templates/admin/header'); ?>
|
||||
<div class="indexTable_wrapper">
|
||||
<div class="indexTable_head">
|
||||
<?= form_open(current_url(), array("method" => "get")) ?>
|
||||
<ul class="nav">
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_BoardConfigHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?= $this->include('templates/admin/index_head'); ?>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<div class="indexTable_body">
|
||||
<?= form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
|
||||
<table class="table table-bordered table-hover table-striped indexTable ">
|
||||
<tr>
|
||||
<td>번호</td>
|
||||
<?php foreach ($fields as $field) : ?><td><?= getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_value) ?></td><?php endforeach; ?>
|
||||
<td>작업</td>
|
||||
</tr>
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach ($rows as $row) : ?>
|
||||
<tr id="<?= $row['uid'] ?>" <?= $row['status'] != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
|
||||
<td>
|
||||
<?= form_checkbox(["id" => "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?>
|
||||
<?= anchor(current_url() . '/update/' . $row['uid'], $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
|
||||
</td>
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<td nowrap><?= getFieldIndex_Row_BoardConfigHelper($field, $row, $fieldFilters, $fieldFormOptions) ?></td>
|
||||
<?php endforeach; ?>
|
||||
<td><?= anchor(current_url() . '/delete/' . $row['uid'], ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
|
||||
</tr>
|
||||
<?php $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_BoardConfigHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?></li>
|
||||
<li class="nav-item"><?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<div class="indexTable_tail">
|
||||
<?= $pagination ?>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->include('templates/admin/footer'); ?>
|
||||
<?= $this->endSection() ?>
|
||||
24
app/Views/admin/boardconfig/insert.php
Normal file
24
app/Views/admin/boardconfig/insert.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?= $this->include('templates/admin/header'); ?>
|
||||
<?= form_open(current_url(), $forms['attributes'], $forms['hiddens']) ?>
|
||||
<table class="table table-bordered table-hover table-striped indexTable ">
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<tr>
|
||||
<td nowrap style="background-color:#e8ebe9; width:10%; text-align:right; padding-right:20px;">
|
||||
<?= getFieldLabel_BoardConfigHelper($field, $fieldRules) ?>
|
||||
</td>
|
||||
<td style="text-align:left; padding-left:20px;">
|
||||
<?= getFieldForm_BoardConfigHelper($field, is_null(old($field)) ? DEFAULTS['EMPTY'] : old($field), $fieldFormOptions) ?>
|
||||
<?= validation_show_error($field); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td valign="bottom" colspan="2" style="text-align:center;"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?= form_close(); ?>
|
||||
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
|
||||
<?= $this->include('templates/admin/footer'); ?>
|
||||
<?= $this->endSection() ?>
|
||||
24
app/Views/admin/boardconfig/update.php
Normal file
24
app/Views/admin/boardconfig/update.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?= $this->include('templates/admin/header'); ?>
|
||||
<?= form_open(current_url(), $forms['attributes'], $forms['hiddens']) ?>
|
||||
<table class="table table-bordered table-hover table-striped indexTable ">
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<tr>
|
||||
<td nowrap style="background-color:#e8ebe9; width:10%; text-align:right; padding-right:20px;">
|
||||
<?= getFieldLabel_BoardConfigHelper($field, $fieldRules) ?>
|
||||
</td>
|
||||
<td style="text-align:left; padding-left:20px;">
|
||||
<?= getFieldForm_BoardConfigHelper($field, is_null(old($field)) ? $entity->$field : old($field), $fieldFormOptions) ?>
|
||||
<?= validation_show_error($field); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td valign="bottom" colspan="2" style="text-align:center;"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?= form_close(); ?>
|
||||
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
|
||||
<?= $this->include('templates/admin/footer'); ?>
|
||||
<?= $this->endSection() ?>
|
||||
15
app/Views/admin/boardconfig/view.php
Normal file
15
app/Views/admin/boardconfig/view.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?= $this->include('templates/admin/header'); ?>
|
||||
<table class="table table-bordered table-hover table-striped indexTable ">
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<tr>
|
||||
<td nowrap style="background-color:#e8ebe9; width:10%; text-align:right; padding-right:20px;">
|
||||
<?= getFieldLabel_BoardConfigHelper($field, $fieldRules) ?>
|
||||
</td>
|
||||
<td style="text-align:left; padding-left:20px;"><?= getFieldView_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?= $this->include('templates/admin/footer'); ?>
|
||||
<?= $this->endSection() ?>
|
||||
@ -5,7 +5,7 @@
|
||||
<div class="indexTable_head">
|
||||
<?= form_open(current_url(), array("method" => "get")) ?>
|
||||
<ul class="nav">
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldForm_LoggerHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_LoggerHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?= $this->include('templates/admin/index_head'); ?>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
@ -33,7 +33,7 @@
|
||||
</table>
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldForm_LoggerHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_LoggerHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?></li>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<div class="indexTable_head">
|
||||
<?= form_open(current_url(), array("method" => "get")) ?>
|
||||
<ul class="nav">
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldForm_UserHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_UserHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?= $this->include('templates/admin/index_head'); ?>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
@ -35,7 +35,7 @@
|
||||
</table>
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldForm_UserHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_UserHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?></li>
|
||||
<li class="nav-item"><?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
|
||||
</ul>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<div class="indexTable_head">
|
||||
<?= form_open(current_url(), array("method" => "get")) ?>
|
||||
<ul class="nav">
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldForm_UserSNSHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_UserSNSHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?= $this->include('templates/admin/index_head'); ?>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
@ -35,7 +35,7 @@
|
||||
</table>
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldForm_UserSNSHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_UserSNSHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?></li>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
|
||||
@ -1,3 +1,13 @@
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="panelsStayOpen-heading-Board">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapse-Board" aria-expanded="false" aria-controls="panelsStayOpen-collapse-Board"><b>게시판관리</b></button>
|
||||
</h2>
|
||||
<div id="panelsStayOpen-collapse-Board" class="accordion-collapse collapse show" aria-labelledby="panelsStayOpen-heading-Board">
|
||||
<div class="accordion-item">
|
||||
<h2><a href="/admin/board"><i class="fa fa-share-alt"></i>게시판 관리</a></h2>
|
||||
</div>
|
||||
<h2><a href="/admin/boardconfig"><i class="fa fa-share-alt"></i>설정 관리</a></h2>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<h2><a href="/admin/board"><i class="fa fa-share-alt"></i>게시글 관리</a></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -3,10 +3,10 @@
|
||||
<li class="nav-item dropdown">
|
||||
<?php if (SESSION_NAMES['ISLOGIN']) : ?>
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-id-card"></i> <?= $auth['title'] ?>
|
||||
<i class="fa fa-id-card"></i> <?= $auth[AUTH_FIELDS['TITLE']] ?>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a href="/admin/user/update/<?= $auth['id'] ?>"><i class="fa fa-cog"></i>내정보수정</a></li>
|
||||
<li><a href="/admin/user/update/<?= $auth[AUTH_FIELDS['ID']] ?>"><i class="fa fa-cog"></i>내정보수정</a></li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<link href="/css/admin/top_menu.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<nav class="top_menu navbar navbar-expand-lg bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand col-xs-12" href="/admin">Shoppingmall 관리 Site</a>
|
||||
<a class="navbar-brand col-xs-12" href="/admin">BaseProject 관리 Site</a>
|
||||
<div> </div>
|
||||
<div> </div>
|
||||
<div> </div>
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
<script>
|
||||
function copyToClipboard(element) {
|
||||
var $temp = $("<input>");
|
||||
$("body").append($temp);
|
||||
$temp.val($(element).text()).select();
|
||||
document.execCommand("copy");
|
||||
$temp.remove();
|
||||
element.style.backgroundColor = '#fde9bf';
|
||||
}
|
||||
</script>
|
||||
<div id="cloudflare">
|
||||
<table class="cloudflare">
|
||||
<tr>
|
||||
<td>cloudprime001@idcjp.jp(영,숫자)</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this)">felicity.ns.cloudflare.com</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">tara.ns.cloudflare.com</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cloudjp002@idcjp.jp(ㄱ~ㅅ)</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">aida.ns.cloudflare.com</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">kurt.ns.cloudflare.com</td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr>
|
||||
<td>cloudjp003@idcjp.jp(ㅇ~ㅎ)</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">amir.ns.cloudflare.com</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">becky.ns.cloudflare.com</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td>jpcf003@gmail.com(ㅇ~ㅎ)</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">natasha.ns.cloudflare.com</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">plato.ns.cloudflare.com</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cloudwin001@idcjp.jp(영,숫자)</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">alina.ns.cloudflare.com</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">rick.ns.cloudflare.com</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cloudwin002@idcjp.jp(ㄱ~ㅅ)</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">hope.ns.cloudflare.com</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">piotr.ns.cloudflare.com</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cloudwin003@idcjp.jp(ㅇ~ㅎ)</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">tani.ns.cloudflare.com</td>
|
||||
<td class="dnsname" onclick="copyToClipboard(this);">woz.ns.cloudflare.com</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@ -1,13 +0,0 @@
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" />
|
||||
<!-- Scripts -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
//class select2인 SelectBox용
|
||||
$(".select-field").select2({
|
||||
theme: "bootstrap-5",
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user