servermgrv2 init...

This commit is contained in:
최준흠git config git config --helpgit config --global user.name 최준흠 2023-07-22 06:12:35 +09:00
parent 04ba0c2b37
commit de0b53f4f6
18 changed files with 168 additions and 62 deletions

View File

@ -65,12 +65,12 @@ class BoardConfigController extends \App\Controllers\Admin\AdminController
],
'index' => [
'fields' => ['name', 'isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'],
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status', 'created_at'],
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'],
'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'],
'fieldFilters' => ['isaccess', 'isread', 'iswrite', 'isreply', 'isupload', 'isdownload', 'status'],
],
];
helper($this->_className);

View File

@ -66,29 +66,6 @@ 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
@ -103,10 +80,7 @@ class BoardController extends \App\Controllers\Admin\AdminController
case 'user_uid':
if (is_null($this->_user_uids)) {
//모든 필요한 FormOption등 조기화작업 필요
$this->_user_uids = $this->getUserModel()->getFieldFormOptions(
['status' => 'use'],
[DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택']
);
$this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']);
}
return $this->_user_uids;
default:

View File

@ -51,10 +51,7 @@ class LoggerController extends \App\Controllers\Admin\AdminController
case 'user_uid':
if (is_null($this->_user_uids)) {
//모든 필요한 FormOption등 조기화작업 필요
$this->_user_uids = $this->getUserModel()->getFieldFormOptions(
['status' => 'use'],
[DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택']
);
$this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']);
}
return $this->_user_uids;
break;

View File

@ -51,10 +51,7 @@ class UserSNSController extends \App\Controllers\Admin\AdminController
case 'user_uid':
if (is_null($this->_user_uids)) {
//모든 필요한 FormOption등 조기화작업 필요
$this->_user_uids = $this->getUserModel()->getFieldFormOptions(
['status' => 'use'],
[DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택']
);
$this->_user_uids = $this->getUserModel()->getFieldFormOptions(['status' => 'use']);
}
return $this->_user_uids;
break;

View File

@ -79,14 +79,11 @@ abstract class BaseController extends Controller
{
switch ($field) {
default:
$fieldFormOptionDatas = (array)lang($this->_className . '.' . strtoupper($field));
$fieldFormOptionDatas = lang($this->_className . '.' . strtoupper($field));
if (!is_array($fieldFormOptionDatas)) {
throw new \Exception(__FUNCTION__ . "에서 {$field}의 데이터가 array가 아닙니다.\n" . var_export($fieldFormOptionDatas, true));
}
return [
DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택',
...$fieldFormOptionDatas
];
return $fieldFormOptionDatas;
break;
}
}

View File

@ -14,7 +14,7 @@ function getFieldLabel_BoardConfigHelper($field, array $fieldRules, array $attri
//header.php에서 getFieldForm_Helper사용
function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'isaccess':
case 'isread':
@ -22,8 +22,14 @@ function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, arra
case 'isreply':
case 'isupload':
case 'isdownload':
foreach ($formOptions[$field] as $key => $label) {
$checkboxs[] = form_checkbox("{$field}[]", $key, $key != 'guest' || $key == $value, $attributes) . $label;
}
return implode(" ", $checkboxs);
break;
case 'status':
return form_multiselect($field, $formOptions[$field], explode('|', $value), [...$attributes, 'row' => 10]);
$formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$formOptions[$field]];
return form_dropdown($field, $formOptions[$field], $value, $attributes);
break;
case 'updated_at':
case 'created_at':
@ -46,18 +52,22 @@ function getFieldForm_BoardConfigHelper($field, $value, array $formOptions, arra
function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{
switch ($field) {
case 'head':
case 'tail':
return html_entity_decode($entity->$field);
break;
default:
if (in_array($field, $fieldFilters)) {
return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return $entity->$field;
return $entity->$field ?: DEFAULTS['EMPTY'];
break;
}
} //
function getFieldFilter_BoardConfigHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'isaccess':
case 'isread':
@ -65,8 +75,8 @@ function getFieldFilter_BoardConfigHelper($field, $value, array $formOptions, ar
case 'isreply':
case 'isupload':
case 'isdownload':
case 'status':
return form_dropdown($field, $formOptions[$field], explode('|', $value), [...$attributes, 'row' => 10]);
$formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$formOptions[$field]];
return form_dropdown($field, $formOptions[$field], $value, $attributes);
break;
default:
return getFieldForm_BoardConfigHelper($field, $value, $formOptions, $attributes);

View File

@ -14,11 +14,12 @@ function getFieldLabel_BoardHelper($field, array $fieldRules, array $attributes
//header.php에서 getFieldForm_Helper사용
function getFieldForm_BoardHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'board_category':
case 'user_uid':
case 'status':
$formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$formOptions[$field]];
return form_dropdown($field, $formOptions[$field], $value, $attributes);
break;
case 'updated_at':
@ -51,14 +52,14 @@ function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $f
if (in_array($field, $fieldFilters)) {
return getFieldForm_BoardHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return $entity->$field;
return $entity->$field ?: DEFAULTS['EMPTY'];
break;
}
} //
function getFieldFilter_BoardHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
default:
return getFieldForm_BoardHelper($field, $value, $formOptions, $attributes);

View File

@ -14,10 +14,11 @@ function getFieldLabel_LoggerHelper($field, array $fieldRules, array $attributes
//header.php에서 getFieldForm_Helper사용
function getFieldForm_LoggerHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'user_uid':
case 'status':
$formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Logger.label.{$field}") . " 선택", ...$formOptions[$field]];
return form_dropdown($field, $formOptions[$field], $value, $attributes);
break;
case 'updated_at':
@ -40,15 +41,14 @@ function getFieldView_LoggerHelper($field, $entity, array $fieldFilters, array $
if (in_array($field, $fieldFilters)) {
return getFieldForm_LoggerHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return !isset($entity->$field) ? "{$field}:{$entity->uid}" : $entity->$field;
return $entity->$field;
return $entity->$field ?: DEFAULTS['EMPTY'];
break;
}
} //
function getFieldFilter_LoggerHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
default:
return getFieldForm_LoggerHelper($field, $value, $formOptions, $attributes);

View File

@ -14,10 +14,11 @@ function getFieldLabel_UserSNSHelper($field, array $fieldRules, array $attribute
//header.php에서 getFieldForm_Helper사용
function getFieldForm_UserSNSHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'user_uid':
case 'status':
$formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/UserSNS.label.{$field}") . " 선택", ...$formOptions[$field]];
return form_dropdown($field, $formOptions[$field], $value, $attributes);
break;
case 'updated_at':
@ -37,15 +38,14 @@ function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array
if (in_array($field, $fieldFilters)) {
return getFieldForm_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return !isset($entity->$field) ? "{$field}:{$entity->uid}" : $entity->$field;
return $entity->$field;
return $entity->$field ?: DEFAULTS['EMPTY'];
break;
}
} //
function getFieldFilter_UserSNSHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
default:
return getFieldForm_UserSNSHelper($field, $value, $formOptions, $attributes);

View File

@ -14,10 +14,11 @@ function getFieldLabel_UserHelper($field, array $fieldRules, array $attributes =
//header.php에서 getFieldForm_Helper사용
function getFieldForm_UserHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'role':
case 'status':
$formOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$formOptions[$field]];
return form_dropdown($field, $formOptions[$field], $value, $attributes);
break;
case 'updated_at':
@ -41,14 +42,14 @@ function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fi
if (in_array($field, $fieldFilters)) {
return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return $entity->$field;
return $entity->$field ?: DEFAULTS['EMPTY'];
break;
}
} //
function getFieldFilter_UserHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
default:
return getFieldForm_UserHelper($field, $value, $formOptions, $attributes);

View File

@ -0,0 +1,29 @@
<?php
return [
'title' => "게시판 정보",
'label' => [
'uid' => "번호",
'grpno' => "그룹번호",
'grpord' => "부모번호",
'grpdpt' => "그룸Depth",
'board_category' => "게시판구분",
'user_uid' => "작성자",
'title' => "제목",
'content' => "내용",
'passwd' => "암호",
'confirmpassword' => "암호확인",
'view_cnt' => "조회수",
'upload_file' => "UploadFile",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일"
],
"BOARD_CATEGORY" => [
'notice' => '공지사항',
'faq' => 'FAQ',
'qna' => '1:1문의',
'data' => '자료실'
],
"USER_UID" => [],
"STATUS" => [...STATUS],
];

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

@ -0,0 +1,18 @@
<?php
return [
'title' => "Logger 정보",
'label' => [
'uid' => "번호",
'user_uid' => "사용자명",
'title' => "제목",
'content' => "내용",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일"
],
"USER_UID" => [],
"STATUS" => [
"use" => "정상",
"unuse" => "오류",
]
];

View File

@ -0,0 +1,18 @@
<?php
return [
'title' => "회원 정보",
'label' => [
'uid' => "번호",
'id' => "계정",
'passwd' => "암호",
'confirmpassword' => "암호확인",
'email' => "메일",
'role' => "권한",
'name' => "이름",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일"
],
"ROLE" => [...ROLES],
"STATUS" => [...STATUS],
];

View File

@ -0,0 +1,18 @@
<?php
return [
'title' => "SNS 계정정보",
'label' => [
'uid' => "인증번호",
'user_uid' => "사용자",
'site' => "SNS명",
'id' => "SNS ID",
'name' => "SNS 이름",
'email' => "SNS 메일",
'detail' => "SNS 정보",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일"
],
"USER_UID" => [],
"STATUS" => [...STATUS, "standby" => "승인대기"],
];

View File

@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];

View File

@ -20,5 +20,13 @@
</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() ?>

View File

@ -20,5 +20,13 @@
</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() ?>