servermgrv2 init...
This commit is contained in:
parent
dcaa8a8c96
commit
79985d0282
@ -167,15 +167,6 @@ define('AUTH_ADAPTERS', [
|
||||
'TOKEN_NAME' => getenv('auth.google.client.token_name') ?: "access_token",
|
||||
],
|
||||
]);
|
||||
//등급 관련
|
||||
define('FORM_OPTIONS', [
|
||||
'ROLE' => [
|
||||
'guest' => '비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
|
||||
'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
|
||||
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
|
||||
],
|
||||
'STATUS' => ["use" => "사용", "unuse" => "사용않함",],
|
||||
]);
|
||||
|
||||
//Upload , Download 관련
|
||||
define('PATHS', [
|
||||
@ -205,7 +196,7 @@ define('ICONS', [
|
||||
define('CLASS_ICONS', [
|
||||
'USER' => '<i class="bi bi-person-vcard"></i>',
|
||||
'USERSNS' => '<i class="bi bi-globe"></i>',
|
||||
'BOARD_CONFIG' => '<i class="bi bi-gear"></i>',
|
||||
'BOARDCONFIG' => '<i class="bi bi-gear"></i>',
|
||||
'BOARD' => '<i class="bi bi-pencil-square"></i>',
|
||||
'CATEGORY' => '<i class="bi bi-boxes"></i>',
|
||||
'PRODUCT' => '<i class="bi bi-box2"></i>',
|
||||
|
||||
@ -39,14 +39,14 @@ $routes->get('/login', 'AuthController::login');
|
||||
$routes->post('/signup', 'AuthController::signup/local');
|
||||
$routes->get('/signup/(:alpha)', 'AuthController::signup/$1');
|
||||
$routes->get('/logout', 'AuthController::logout');
|
||||
$routes->group('cart', ['namespace' => 'App\Controllers'], static function ($routes) {
|
||||
$routes->post('addCart', 'CartController::addCart');
|
||||
$routes->get('cancelCart/(:uuid)', 'CartController::cancelCart/$1');
|
||||
$routes->group('ecommerce', ['namespace' => 'App\Controllers'], static function ($routes) {
|
||||
$routes->post('addCart', 'EcommerceController::addCart');
|
||||
$routes->get('cancelCart/(:uuid)', 'EcommerceController::cancelCart/$1');
|
||||
});;
|
||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||
});
|
||||
// authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함
|
||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) {
|
||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], static function ($routes) {
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->group('user', static function ($routes) {
|
||||
$routes->get('', 'UserController::index');
|
||||
@ -93,7 +93,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('toggle/(:num)/(:hash)', 'BoardController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'BoardController::batchjob');
|
||||
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
|
||||
$routes->get('download/(:any)/(:uuid)', 'ProductController::download/$1/$2');
|
||||
});
|
||||
});
|
||||
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {
|
||||
|
||||
@ -61,6 +61,9 @@ abstract class BaseController extends Controller
|
||||
$this->_session = \Config\Services::session();
|
||||
$this->_viewDatas['layout'] = LAYOUTS['empty'];
|
||||
$this->_viewDatas['session'] = $this->_session;
|
||||
$this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
|
||||
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_model->getClassName())];
|
||||
helper($this->_model->getClassName());
|
||||
}
|
||||
|
||||
abstract public function getFields(string $action): array;
|
||||
|
||||
63
app/Controllers/Front/BoardController.php
Normal file
63
app/Controllers/Front/BoardController.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Front;
|
||||
|
||||
use App\Models\BoardModel;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Models\BoardConfigModel;
|
||||
|
||||
class BoardController extends FrontController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
$this->_model = new BoardModel($this->getFields());
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
|
||||
$this->_viewPath .= strtolower($this->_model->getClassName());
|
||||
helper($this->_model->getClassName());
|
||||
}
|
||||
|
||||
public function getFields(string $action = ""): array
|
||||
{
|
||||
$fields = ["board_config_uid", 'title', "board_file", "passwd", "content"];
|
||||
switch ($action) {
|
||||
case "index":
|
||||
case "excel":
|
||||
return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at"];
|
||||
break;
|
||||
case "view":
|
||||
return ["board_config_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at", "content"];
|
||||
break;
|
||||
default:
|
||||
return $fields;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public function getFieldFilters(): array
|
||||
{
|
||||
return ["board_config_uid", "user_uid"];
|
||||
}
|
||||
public function getFieldBatchFilters(): array
|
||||
{
|
||||
return parent::getFieldBatchFilters();
|
||||
}
|
||||
//Field별 Form Datas 처리용
|
||||
protected function getFieldFormData(string $field, $entity = null): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'passwd':
|
||||
$this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
|
||||
$this->_viewDatas['fieldDatas']['confirmpassword'] = $this->request->getVar('confirmpassword');
|
||||
break;
|
||||
case 'board_file':
|
||||
$this->_viewDatas['fieldDatas'][$field] = $this->single_upload_procedure($field, $entity);
|
||||
break;
|
||||
default:
|
||||
return parent::getFieldFormData($field, $entity);
|
||||
break;
|
||||
}
|
||||
return $this->_viewDatas['fieldDatas'];
|
||||
}
|
||||
}
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
use CodeIgniter\Filters\FilterInterface;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Filters\FilterInterface;
|
||||
|
||||
class AuthFilter implements FilterInterface
|
||||
{
|
||||
@ -28,9 +28,8 @@ class AuthFilter implements FilterInterface
|
||||
// 로그인을 했으면
|
||||
if (session()->get(SESSION_NAMES['ISLOGIN'])) {
|
||||
$auth = session()->get(SESSION_NAMES['AUTH']);
|
||||
// dd($auth);
|
||||
// 회원 ROLE이 필요ROLE 목록에 존재하지 않으면(ACL)
|
||||
if (!in_array($auth[AUTH_FIELDS['ROLE']], $arguments)) {
|
||||
// 회원 ROLES이 필요ROLE($arguments[0]) 목록에 존재하지 않으면(ACL)
|
||||
if (!in_array($arguments[0], explode(DEFAULTS['DELIMITER_ROLE'], $auth[AUTH_FIELDS['ROLE']]))) {
|
||||
return redirect()->to('/login')->with(
|
||||
'return_message',
|
||||
sprintf(
|
||||
|
||||
@ -23,16 +23,16 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions,
|
||||
case 'isupload':
|
||||
case 'isdownload':
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||
// return form_multiselect($field, $fieldFormOptions[$field], $value, [...$attributes]);
|
||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label;
|
||||
// }
|
||||
// return implode(" ", $checkboxs);
|
||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
||||
break;
|
||||
case "status":
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
@ -70,7 +70,7 @@ function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, ar
|
||||
return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
|
||||
break;
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
@ -90,6 +90,15 @@ function getFieldFilter_BoardConfigHelper($field, $value, array $fieldFormOption
|
||||
{
|
||||
$value = $value ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case 'isaccess':
|
||||
case 'isread':
|
||||
case 'iswrite':
|
||||
case 'isreply':
|
||||
case 'isupload':
|
||||
case 'isdownload':
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||
break;
|
||||
default:
|
||||
return getFieldForm_BoardConfigHelper($field, $value, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
@ -108,7 +117,7 @@ function getFieldIndex_Row_BoardConfigHelper($field, $entity, array $fieldFilter
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
return getFieldView_BoardConfigHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||
return getFieldView_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -121,7 +130,7 @@ function getFieldIndex_Row_BoardConfigHelper_Admin($field, $entity, array $field
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
|
||||
return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return getFieldIndex_Row_BoardConfigHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||
return getFieldIndex_Row_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -18,11 +18,11 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array
|
||||
case "board_config_uid":
|
||||
case "user_uid":
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||
break;
|
||||
case "status":
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
@ -120,7 +120,7 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $fieldFilters, $fi
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
return getFieldView_BoardHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||
return getFieldView_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -133,7 +133,7 @@ function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $fieldFilter
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
|
||||
return getFieldForm_BoardHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return getFieldIndex_Row_BoardHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||
return getFieldIndex_Row_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -152,3 +152,77 @@ function imageSubmit_CommonHelper(string $src, array $attributes = [])
|
||||
...$attributes,
|
||||
]);
|
||||
}
|
||||
|
||||
// STATUS가 use가 아닐때 option을 disabled되게 하기위함 (override form_dropdown)
|
||||
function form_dropdown_test($data = '', $options = [], $selected = [], $extra = ''): string
|
||||
{
|
||||
$defaults = [];
|
||||
if (is_array($data)) {
|
||||
if (isset($data['selected'])) {
|
||||
$selected = $data['selected'];
|
||||
unset($data['selected']); // select tags don't have a selected attribute
|
||||
}
|
||||
if (isset($data['options'])) {
|
||||
$options = $data['options'];
|
||||
unset($data['options']); // select tags don't use an options attribute
|
||||
}
|
||||
} else {
|
||||
$defaults = ['name' => $data];
|
||||
}
|
||||
|
||||
if (!is_array($selected)) {
|
||||
$selected = [$selected];
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
$options = [$options];
|
||||
}
|
||||
|
||||
// If no selected state was submitted we will attempt to set it automatically
|
||||
if (empty($selected)) {
|
||||
if (is_array($data)) {
|
||||
if (isset($data['name'], $_POST[$data['name']])) {
|
||||
$selected = [$_POST[$data['name']]];
|
||||
}
|
||||
} elseif (isset($_POST[$data])) {
|
||||
$selected = [$_POST[$data]];
|
||||
}
|
||||
}
|
||||
|
||||
// Standardize selected as strings, like the option keys will be
|
||||
foreach ($selected as $key => $item) {
|
||||
$selected[$key] = (string) $item;
|
||||
}
|
||||
|
||||
$extra = stringify_attributes($extra);
|
||||
$multiple = (count($selected) > 1 && stripos($extra, 'multiple') === false) ? ' multiple="multiple"' : '';
|
||||
$form = '<select ' . rtrim(parse_form_attributes($data, $defaults)) . $extra . $multiple . ">\n";
|
||||
|
||||
foreach ($options as $key => $val) {
|
||||
// Keys should always be strings for strict comparison
|
||||
$key = (string) $key;
|
||||
|
||||
if (is_array($val)) {
|
||||
if (empty($val)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$form .= '<optgroup label="' . $key . "\">\n";
|
||||
|
||||
foreach ($val as $optgroupKey => $optgroupVal) {
|
||||
// Keys should always be strings for strict comparison
|
||||
$optgroupKey = (string) $optgroupKey;
|
||||
|
||||
$sel = in_array($optgroupKey, $selected, true) ? ' selected="selected"' : '';
|
||||
$form .= '<option value="' . $optgroupKey . '"' . $sel . '>' . $optgroupVal . "</option>\n";
|
||||
}
|
||||
|
||||
$form .= "</optgroup>\n";
|
||||
} else {
|
||||
$form .= '<option value="' . $key . '"'
|
||||
. (in_array($key, $selected, true) ? ' selected="selected"' : '') . '>'
|
||||
. $val . "</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $form . "</select>\n";
|
||||
}
|
||||
|
||||
@ -18,11 +18,11 @@ function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, arr
|
||||
switch ($field) {
|
||||
case "user_uid":
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||
break;
|
||||
case "status":
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
@ -56,7 +56,7 @@ function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array
|
||||
return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
|
||||
break;
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||
break;
|
||||
case 'content':
|
||||
return html_entity_decode($value);
|
||||
@ -93,7 +93,7 @@ function getFieldIndex_Row_UserSNSHelper($field, $entity, array $fieldFilters, $
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
return getFieldView_UserSNSHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||
return getFieldView_UserSNSHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -106,7 +106,7 @@ function getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, array $fieldFilt
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
|
||||
return getFieldForm_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return getFieldIndex_Row_UserSNSHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||
return getFieldIndex_Row_UserSNSHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -18,16 +18,16 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
// $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
// return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||
// return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||
// return form_multiselect($field, $fieldFormOptions[$field], $value, [...$attributes]);
|
||||
foreach ($fieldFormOptions[$field] as $key => $label) {
|
||||
$checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label;
|
||||
}
|
||||
return implode(" ", $checkboxs);
|
||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
||||
break;
|
||||
case "status":
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
@ -64,14 +64,14 @@ function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fi
|
||||
return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
|
||||
break;
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
return $value ? str_split($value, 10)[0] : "";
|
||||
break;
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||
break;
|
||||
case 'content':
|
||||
return html_entity_decode($value);
|
||||
@ -88,7 +88,7 @@ function getFieldFilter_UserHelper($field, $value, array $fieldFormOptions, arra
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||
break;
|
||||
default:
|
||||
return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes);
|
||||
@ -108,7 +108,7 @@ function getFieldIndex_Row_UserHelper($field, $entity, array $fieldFilters, $fie
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
return getFieldView_UserHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||
return getFieldView_UserHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -121,7 +121,7 @@ function getFieldIndex_Row_UserHelper_Admin($field, $entity, array $fieldFilters
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
|
||||
return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return getFieldIndex_Row_UserHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||
return getFieldIndex_Row_UserHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
@ -18,5 +18,5 @@ return [
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일"
|
||||
],
|
||||
"STATUS" => FORM_OPTIONS['STATUS'],
|
||||
'STATUS' => ['use' => '사용', 'unuse' => '사용않함'],
|
||||
];
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
<?php
|
||||
$roles = [
|
||||
'user' => '일반회원', 'vip' => 'VIP회원',
|
||||
'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
|
||||
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
|
||||
];
|
||||
return [
|
||||
'title' => "게시판설정 정보",
|
||||
'label' => [
|
||||
@ -16,11 +21,12 @@ return [
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일"
|
||||
],
|
||||
"ISACCESS" => FORM_OPTIONS['ROLE'],
|
||||
"ISREAD" => FORM_OPTIONS['ROLE'],
|
||||
"ISWRITE" => FORM_OPTIONS['ROLE'],
|
||||
"ISREPLY" => FORM_OPTIONS['ROLE'],
|
||||
"ISUPLOAD" => FORM_OPTIONS['ROLE'],
|
||||
"ISDOWNLOAD" => FORM_OPTIONS['ROLE'],
|
||||
"STATUS" => FORM_OPTIONS['STATUS'],
|
||||
"ISACCESS" => $roles,
|
||||
"ISREAD" => $roles,
|
||||
"ISWRITE" => $roles,
|
||||
"ISREPLY" => $roles,
|
||||
"ISUPLOAD" => $roles,
|
||||
"ISDOWNLOAD" => $roles,
|
||||
"STATUS" => $roles,
|
||||
'STATUS' => ['use' => '사용', 'unuse' => '사용않함'],
|
||||
];
|
||||
|
||||
@ -13,6 +13,10 @@ return [
|
||||
'updated_at' => '수정일',
|
||||
'created_at' => '작성일'
|
||||
],
|
||||
'ROLE' => FORM_OPTIONS['ROLE'],
|
||||
'STATUS' => FORM_OPTIONS['STATUS'],
|
||||
'ROLE' => [
|
||||
'user' => '일반회원', 'vip' => 'VIP회원',
|
||||
'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
|
||||
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
|
||||
],
|
||||
'STATUS' => ['use' => '사용', 'unuse' => '사용않함'],
|
||||
];
|
||||
|
||||
@ -142,7 +142,7 @@ abstract class BaseModel extends Model
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
if (is_null($this->_user_options)) {
|
||||
$userModel = new UserModel([$this->getPrimaryKey(), $this->getTitleField()]);
|
||||
$userModel = new UserModel();
|
||||
$this->_user_options = $userModel->getOptions();
|
||||
}
|
||||
$options = $this->_user_options;
|
||||
|
||||
@ -42,6 +42,7 @@ class BoardConfigModel extends BaseModel
|
||||
case "isdownload":
|
||||
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
||||
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user,guest]";
|
||||
//아래 Rule은 checkbox를 사용시에는 required만 우선 써야 수정시 validate문제없음
|
||||
$rules[$field] = "required";
|
||||
break;
|
||||
default:
|
||||
@ -50,11 +51,21 @@ class BoardConfigModel extends BaseModel
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
public function getEntity($conditions): BoardConfigEntity
|
||||
//Form 선택용 Options Data용
|
||||
public function getOptions_TEST(array $conditions = array(), $options = array()): array
|
||||
{
|
||||
return parent::getEntity($conditions);
|
||||
foreach ($this->getEntitys($conditions) as $entity) {
|
||||
// STATUS가 use가 아닐때 option을 disabled되게 하기위함
|
||||
if ($entity->getStatus() != DEFAULTS['STATUS']) {
|
||||
$options[$entity->getPrimaryKey() . "\" disabled=\"disabled"] = $entity->getTitle();
|
||||
} else {
|
||||
$options[$entity->getPrimaryKey()] = $entity->getTitle();
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
//Field별 Form Option용
|
||||
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
|
||||
{
|
||||
switch ($field) {
|
||||
@ -81,6 +92,11 @@ class BoardConfigModel extends BaseModel
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
public function getEntity($conditions): BoardConfigEntity
|
||||
{
|
||||
return parent::getEntity($conditions);
|
||||
}
|
||||
public function create(array $formDatas): BoardConfigEntity
|
||||
{
|
||||
return $this->create_process(new BoardConfigEntity(), $formDatas);
|
||||
|
||||
@ -56,7 +56,7 @@ class BoardModel extends BaseHierarchyModel
|
||||
switch ($field) {
|
||||
case 'board_config_uid':
|
||||
if (is_null($this->_boardconfig_options)) {
|
||||
$boardConfigModel = new BoardConfigModel([$this->getPrimaryKey(), $this->getTitleField()]);
|
||||
$boardConfigModel = new BoardConfigModel();
|
||||
$this->_boardconfig_options = $boardConfigModel->getOptions();
|
||||
}
|
||||
$options = $this->_boardconfig_options;
|
||||
|
||||
@ -45,6 +45,7 @@ class UserModel extends BaseModel
|
||||
case "role":
|
||||
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
||||
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user]";
|
||||
//아래 Rule은 checkbox를 사용시에는 required만 우선 써야 수정시 validate문제없음
|
||||
$rules[$field] = "required";
|
||||
break;
|
||||
default:
|
||||
@ -53,10 +54,25 @@ class UserModel extends BaseModel
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
//Form 선택용 Options Data용
|
||||
public function getOptions_TEST(array $conditions = array(), $options = array()): array
|
||||
{
|
||||
foreach ($this->getEntitys($conditions) as $entity) {
|
||||
// STATUS가 use가 아닐때 option을 disabled되게 하기위함
|
||||
if ($entity->getStatus() != DEFAULTS['STATUS']) {
|
||||
$options[$entity->getPrimaryKey() . "\" disabled=\"disabled"] = $entity->getTitle();
|
||||
} else {
|
||||
$options[$entity->getPrimaryKey()] = $entity->getTitle();
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function getEntity($conditions): UserEntity
|
||||
{
|
||||
return parent::getEntity($conditions);
|
||||
}
|
||||
|
||||
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
|
||||
{
|
||||
switch ($field) {
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<td nowrap><?= getFieldView_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
|
||||
<td nowrap><?= getFieldIndex_Row_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php $i++; ?>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
</h2>
|
||||
<div id="flush-heading-Board" class="accordion-collapse collapse show" aria-labelledby="flush-heading-Board">
|
||||
<div class="accordion-item">
|
||||
<h2><a href="/admin/boardconfig"><?= CLASS_ICONS['BOARD_CONFIG'] ?>설정 관리</a></h2>
|
||||
<h2><a href="/admin/boardconfig"><?= CLASS_ICONS['BOARDCONFIG'] ?>설정 관리</a></h2>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<h2><a href="/admin/board"><?= CLASS_ICONS['BOARD'] ?>게시글 관리</a></h2>
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<div class="header">
|
||||
<h4><i class="bi bi-cast"></i><?= $title ?></h4>
|
||||
<h4><?= $class_icon ?></i><?= $title ?></h4>
|
||||
</div>
|
||||
@ -1,3 +1,3 @@
|
||||
<div class="header">
|
||||
<h4><i class="bi bi-cast"></i><?= $title ?></h4>
|
||||
<h4><?= $class_icon ?></i><?= $title ?></h4>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user