servermgrv2 init...
This commit is contained in:
parent
cefb0b6a3f
commit
4b917834ef
@ -224,7 +224,8 @@ define('DEFAULTS', [
|
|||||||
'EMPTY' => getenv('default.empty') ?: "",
|
'EMPTY' => getenv('default.empty') ?: "",
|
||||||
'PERPAGE' => getenv('default.perpage') ?: 20,
|
'PERPAGE' => getenv('default.perpage') ?: 20,
|
||||||
'HIERARCHY_GRPDEPTH' => getenv('default.hierarchy_grpdepth') ?: 20,
|
'HIERARCHY_GRPDEPTH' => getenv('default.hierarchy_grpdepth') ?: 20,
|
||||||
'FILE_DLIMITER' => getenv('default.file_delimiter') ?: "||",
|
'DELIMITER_FILE' => getenv('default.delimiter.file') ?: "||",
|
||||||
|
'DELIMITER_ROLE' => getenv('default.delimiter.role') ?: ",",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//API Adapter초기갑 정의
|
//API Adapter초기갑 정의
|
||||||
|
|||||||
@ -22,10 +22,6 @@ class UserController extends AdminController
|
|||||||
protected function getFieldFormData(string $field, $entity = null): array
|
protected function getFieldFormData(string $field, $entity = null): array
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'role':
|
|
||||||
$roles = $this->request->getVar($field);
|
|
||||||
$this->_viewDatas['fieldDatas'][$field] = is_array($roles) ? implode(",", $roles) : $roles;
|
|
||||||
break;
|
|
||||||
case 'passwd':
|
case 'passwd':
|
||||||
$this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
|
$this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
|
||||||
$this->_viewDatas['fieldDatas']['confirmpassword'] = $this->request->getVar('confirmpassword');
|
$this->_viewDatas['fieldDatas']['confirmpassword'] = $this->request->getVar('confirmpassword');
|
||||||
|
|||||||
@ -50,7 +50,6 @@ abstract class BaseController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected $_model = null;
|
protected $_model = null;
|
||||||
protected $_session = null;
|
protected $_session = null;
|
||||||
protected $_validation = null;
|
|
||||||
protected $_viewPath = '';
|
protected $_viewPath = '';
|
||||||
protected $_viewDatas = array();
|
protected $_viewDatas = array();
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
@ -60,7 +59,6 @@ abstract class BaseController extends Controller
|
|||||||
// Preload any models, libraries, etc, here.
|
// Preload any models, libraries, etc, here.
|
||||||
// E.g.: $this->session = \Config\Services::session();
|
// E.g.: $this->session = \Config\Services::session();
|
||||||
$this->_session = \Config\Services::session();
|
$this->_session = \Config\Services::session();
|
||||||
$this->_validation = \Config\Services::validation();
|
|
||||||
$this->_viewDatas['layout'] = LAYOUTS['empty'];
|
$this->_viewDatas['layout'] = LAYOUTS['empty'];
|
||||||
$this->_viewDatas['session'] = $this->_session;
|
$this->_viewDatas['session'] = $this->_session;
|
||||||
}
|
}
|
||||||
@ -90,7 +88,7 @@ abstract class BaseController extends Controller
|
|||||||
$originName = $upfile->getName();
|
$originName = $upfile->getName();
|
||||||
$upfile->move(WRITEPATH . PATHS['UPLOAD'], $upfile->getRandomName());
|
$upfile->move(WRITEPATH . PATHS['UPLOAD'], $upfile->getRandomName());
|
||||||
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
||||||
$fileName = $originName . DEFAULTS['FILE_DLIMITER'] . $upfile->getName();
|
$fileName = $originName . DEFAULTS['DELIMITER_FILE'] . $upfile->getName();
|
||||||
}
|
}
|
||||||
return $fileName;
|
return $fileName;
|
||||||
}
|
}
|
||||||
@ -151,6 +149,12 @@ abstract class BaseController extends Controller
|
|||||||
}
|
}
|
||||||
protected function insert_validate()
|
protected function insert_validate()
|
||||||
{
|
{
|
||||||
|
//fieldData Rule 검사
|
||||||
|
//추후 VersionUP용
|
||||||
|
// $this->_model->getValidation($this->getFields());
|
||||||
|
// if (! $this->_validation->run($user)) {
|
||||||
|
// throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
|
||||||
|
// }
|
||||||
//fieldData Rule 검사
|
//fieldData Rule 검사
|
||||||
if (!$this->validate($this->_viewDatas['fieldRules'])) {
|
if (!$this->validate($this->_viewDatas['fieldRules'])) {
|
||||||
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
|
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
|
||||||
@ -569,7 +573,7 @@ abstract class BaseController extends Controller
|
|||||||
if (!$entity->$field) {
|
if (!$entity->$field) {
|
||||||
throw new \Exception("첨부파일이 확인되지 않습니다.");
|
throw new \Exception("첨부파일이 확인되지 않습니다.");
|
||||||
}
|
}
|
||||||
list($origin_filename, $filename) = explode(DEFAULTS['FILE_DLIMITER'], $entity->$field);
|
list($origin_filename, $filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
|
||||||
if (is_file(WRITEPATH . PATHS['UPLOAD'] . "/" . $origin_filename)) {
|
if (is_file(WRITEPATH . PATHS['UPLOAD'] . "/" . $origin_filename)) {
|
||||||
throw new \Exception("파일이 확인되지 않습니다.");
|
throw new \Exception("파일이 확인되지 않습니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions,
|
|||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$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], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
||||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label;
|
||||||
// }
|
// }
|
||||||
// return implode(" ", $checkboxs);
|
// return implode(" ", $checkboxs);
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
||||||
|
|||||||
@ -19,11 +19,6 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array
|
|||||||
case "user_uid":
|
case "user_uid":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$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], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
|
||||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
|
||||||
// }
|
|
||||||
// return implode(" ", $checkboxs);
|
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
|
|||||||
@ -19,11 +19,6 @@ function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, arr
|
|||||||
case "user_uid":
|
case "user_uid":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$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], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
|
||||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
|
||||||
// }
|
|
||||||
// return implode(" ", $checkboxs);
|
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
|
|||||||
@ -20,7 +20,7 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array
|
|||||||
// $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
// $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], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||||
foreach ($fieldFormOptions[$field] as $key => $label) {
|
foreach ($fieldFormOptions[$field] as $key => $label) {
|
||||||
$checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
$checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label;
|
||||||
}
|
}
|
||||||
return implode(" ", $checkboxs);
|
return implode(" ", $checkboxs);
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
||||||
@ -89,11 +89,6 @@ function getFieldFilter_UserHelper($field, $value, array $fieldFormOptions, arra
|
|||||||
case 'role':
|
case 'role':
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$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], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
||||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
|
||||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
|
||||||
// }
|
|
||||||
// return implode(" ", $checkboxs);
|
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes);
|
return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes);
|
||||||
@ -124,7 +119,7 @@ function getFieldIndex_Row_UserHelper_Admin($field, $entity, array $fieldFilters
|
|||||||
default:
|
default:
|
||||||
if (in_array($field, $fieldFilters)) {
|
if (in_array($field, $fieldFilters)) {
|
||||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
|
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
|
||||||
return getFieldFilter_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||||
}
|
}
|
||||||
return getFieldIndex_Row_UserHelper($field, $entity, $fieldFormOptions, $attributes);
|
return getFieldIndex_Row_UserHelper($field, $entity, $fieldFormOptions, $attributes);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -40,6 +40,8 @@ class BoardConfigModel extends BaseModel
|
|||||||
case "isreply":
|
case "isreply":
|
||||||
case "isupload":
|
case "isupload":
|
||||||
case "isdownload":
|
case "isdownload":
|
||||||
|
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
||||||
|
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user,guest]";
|
||||||
$rules[$field] = "required";
|
$rules[$field] = "required";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -64,7 +66,7 @@ class BoardConfigModel extends BaseModel
|
|||||||
case "isdownload":
|
case "isdownload":
|
||||||
case "isaccess":
|
case "isaccess":
|
||||||
if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
|
if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
|
||||||
$entity->$field = is_array($formDatas[$field]) ? implode("|", $formDatas[$field]) : $formDatas[$field];
|
$entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "head":
|
case "head":
|
||||||
|
|||||||
@ -43,7 +43,9 @@ class UserModel extends BaseModel
|
|||||||
$rules[$field] = "required|trim|valid_email";
|
$rules[$field] = "required|trim|valid_email";
|
||||||
break;
|
break;
|
||||||
case "role":
|
case "role":
|
||||||
$rules[$field] = "required|string";
|
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
||||||
|
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user]";
|
||||||
|
$rules[$field] = "required";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$rules = parent::getFieldRule($field, $rules, $action);
|
$rules = parent::getFieldRule($field, $rules, $action);
|
||||||
@ -55,13 +57,18 @@ class UserModel extends BaseModel
|
|||||||
{
|
{
|
||||||
return parent::getEntity($conditions);
|
return parent::getEntity($conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
|
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case "role":
|
case "role":
|
||||||
if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
|
if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
|
||||||
$entity->$field = is_array($formDatas[$field]) ? implode("|", $formDatas[$field]) : $formDatas[$field];
|
$entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "head":
|
||||||
|
case "tail":
|
||||||
|
if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) {
|
||||||
|
$entity->$field = htmlentities($formDatas[$field]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user