Compare commits

...

2 Commits

Author SHA1 Message Date
최준흠git config git config --helpgit config --global user.name 최준흠
9c64f0dcb8 servermgrv2 init... 2023-07-21 23:32:26 +09:00
최준흠git config git config --helpgit config --global user.name 최준흠
ce698d7d75 servermgrv2 init... 2023-07-21 23:29:42 +09:00
36 changed files with 625 additions and 106 deletions

View File

@ -158,7 +158,11 @@ define('AUTH_ADAPTERS', [
]);
//등급 관련
define('ROLES', [
<<<<<<< HEAD
'guest' => '비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
=======
'user' => '일반회원', 'vip' => 'VIP회원',
>>>>>>> e0f7632966d765518a4f99c56c4a05c032ec5946
'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
]);

View File

@ -74,9 +74,21 @@ $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');

View 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();
}
}

View File

@ -1,3 +1,22 @@
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 '&nbsp;' COMMENT '게시판 위 내용',
tail text NOT NULL DEFAULT '&nbsp;' 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 grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno
@ -10,7 +29,11 @@ CREATE TABLE tw_board (
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씩 추가필요',
<<<<<<< HEAD
board_category_uid varchar(36) NOT NULL COMMENT '게시판구분',
=======
board_category varchar(10) NOT NULL COMMENT '게시판구분',
>>>>>>> e0f7632966d765518a4f99c56c4a05c032ec5946
user_uid varchar(36) NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',
@ -20,6 +43,7 @@ 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 ='게시판 정보';

View 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();

View 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'];
}
}

View File

@ -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'];

View File

@ -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'];

View File

@ -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'];
}
}

View File

@ -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'];

View File

@ -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'];

View 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;
}
} //

View File

@ -56,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}");
@ -82,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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View 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],
];

View File

@ -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

View 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);
}
}

View File

@ -4,25 +4,34 @@ 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', 'grporder', 'grpdepth', 'board_category', 'user_uid', 'title', 'content', 'passwd', 'view_cnt', 'status', 'updated_at'];
protected $validationRules = [
<<<<<<< HEAD
'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',
=======
'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',
>>>>>>> e0f7632966d765518a4f99c56c4a05c032ec5946
'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

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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>

View 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() ?>

View 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() ?>

View 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() ?>

View 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() ?>

View File

@ -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(); ?>

View File

@ -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>

View File

@ -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(); ?>

View File

@ -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>

View File

@ -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>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>

View File

@ -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>

View File

@ -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>