shoppingmallv2 init...
This commit is contained in:
parent
e95cfa73fa
commit
7f2127326d
@ -224,7 +224,8 @@ define('DEFAULTS', [
|
||||
'EMPTY' => getenv('default.empty') ?: "",
|
||||
'PERPAGE' => getenv('default.perpage') ?: 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초기갑 정의
|
||||
|
||||
@ -39,9 +39,9 @@ $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('ecommerce', ['namespace' => 'App\Controllers'], static function ($routes) {
|
||||
$routes->post('addCart', 'EcommerceController::addCart');
|
||||
$routes->get('cancelCart/(:uuid)', 'EcommerceController::cancelCart/$1');
|
||||
$routes->group('cart', ['namespace' => 'App\Controllers'], static function ($routes) {
|
||||
$routes->post('addCart', 'CartController::addCart');
|
||||
$routes->get('cancelCart/(:uuid)', 'CartController::cancelCart/$1');
|
||||
});;
|
||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||
});
|
||||
@ -95,39 +95,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob', 'BoardController::batchjob');
|
||||
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
|
||||
});
|
||||
$routes->group('category', static function ($routes) {
|
||||
$routes->get('', 'CategoryController::index');
|
||||
$routes->get('excel', 'CategoryController::excel/$1');
|
||||
$routes->get('insert', 'CategoryController::insert_form');
|
||||
$routes->post('insert', 'CategoryController::insert');
|
||||
$routes->get('update/(:num)', 'CategoryController::update_form/$1');
|
||||
$routes->post('update/(:num)', 'CategoryController::update/$1');
|
||||
$routes->get('view/(:num)', 'CategoryController::view/$1');
|
||||
$routes->get('reply/(:num)', 'CategoryController::reply_form/$1');
|
||||
$routes->post('reply/(:num)', 'CategoryController::reply/$1');
|
||||
$routes->get('delete/(:num)', 'CategoryController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('toggle/(:num)/(:hash)', 'CategoryController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'CategoryController::batchjob');
|
||||
});
|
||||
$routes->group('product', static function ($routes) {
|
||||
$routes->get('', 'ProductController::index');
|
||||
$routes->get('excel', 'ProductController::excel/$1');
|
||||
$routes->get('insert', 'ProductController::insert_form');
|
||||
$routes->post('insert', 'ProductController::insert');
|
||||
$routes->get('update/(:uuid)', 'ProductController::update_form/$1');
|
||||
$routes->post('update/(:uuid)', 'ProductController::update/$1');
|
||||
$routes->get('view/(:uuid)', 'ProductController::view/$1');
|
||||
$routes->get('delete/(:uuid)', 'ProductController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('toggle/(:uuid)/(:hash)', 'ProductController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ProductController::batchjob');
|
||||
});
|
||||
$routes->group('order', static function ($routes) {
|
||||
$routes->get('', 'OrderController::index');
|
||||
$routes->get('view/(:uuid)', 'OrderController::view/$1');
|
||||
$routes->get('delete/(:uuid)', 'OrderController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('toggle/(:uuid)/(:hash)', 'OrderController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'OrderController::batchjob`');
|
||||
});
|
||||
});
|
||||
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {
|
||||
$routes->group('user', ['namespace' => 'App\Controllers\Front', 'filter' => 'authFilter:master,director,cloudflare,manager,gold,silver,brone,vip,user'], static function ($routes) {
|
||||
@ -148,15 +115,6 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
|
||||
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
|
||||
});
|
||||
$routes->group('product', static function ($routes) {
|
||||
$routes->get('', 'ProductController::index');
|
||||
$routes->get('excel', 'ProductController::excel/$1');
|
||||
$routes->get('view/(:uuid)', 'ProductController::view/$1');
|
||||
});
|
||||
$routes->group('order', static function ($routes) {
|
||||
$routes->get('', 'OrderController::index');
|
||||
$routes->get('view/(:uuid)', 'OrderController::view/$1');
|
||||
});;
|
||||
});
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
|
||||
@ -22,10 +22,6 @@ class UserController extends AdminController
|
||||
protected function getFieldFormData(string $field, $entity = null): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
$roles = $this->request->getVar($field);
|
||||
$this->_viewDatas['fieldDatas'][$field] = is_array($roles) ? implode(",", $roles) : $roles;
|
||||
break;
|
||||
case 'passwd':
|
||||
$this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
|
||||
$this->_viewDatas['fieldDatas']['confirmpassword'] = $this->request->getVar('confirmpassword');
|
||||
@ -61,4 +57,28 @@ class UserController extends AdminController
|
||||
{
|
||||
return parent::getFieldBatchFilters();
|
||||
}
|
||||
|
||||
protected function insert_validate()
|
||||
{
|
||||
$rules = [];
|
||||
foreach ($this->_viewDatas['fieldRules'] as $field => $rule) {
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
$rules[$field . '.*'] = $rule;
|
||||
break;
|
||||
default:
|
||||
$rules[$field] = $rule;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//fieldData Rule 검사
|
||||
if (!$this->validate($rules)) {
|
||||
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
|
||||
}
|
||||
//fieldData 적용
|
||||
$this->_viewDatas['fieldDatas'] = array();
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,6 @@ abstract class BaseController extends Controller
|
||||
*/
|
||||
protected $_model = null;
|
||||
protected $_session = null;
|
||||
protected $_validation = null;
|
||||
protected $_viewPath = '';
|
||||
protected $_viewDatas = array();
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -60,7 +59,6 @@ abstract class BaseController extends Controller
|
||||
// Preload any models, libraries, etc, here.
|
||||
// E.g.: $this->session = \Config\Services::session();
|
||||
$this->_session = \Config\Services::session();
|
||||
$this->_validation = \Config\Services::validation();
|
||||
$this->_viewDatas['layout'] = LAYOUTS['empty'];
|
||||
$this->_viewDatas['session'] = $this->_session;
|
||||
}
|
||||
@ -90,7 +88,7 @@ abstract class BaseController extends Controller
|
||||
$originName = $upfile->getName();
|
||||
$upfile->move(WRITEPATH . PATHS['UPLOAD'], $upfile->getRandomName());
|
||||
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
||||
$fileName = $originName . DEFAULTS['FILE_DLIMITER'] . $upfile->getName();
|
||||
$fileName = $originName . DEFAULTS['DELIMITER_FILE'] . $upfile->getName();
|
||||
}
|
||||
return $fileName;
|
||||
}
|
||||
@ -151,6 +149,12 @@ abstract class BaseController extends Controller
|
||||
}
|
||||
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 검사
|
||||
if (!$this->validate($this->_viewDatas['fieldRules'])) {
|
||||
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
|
||||
@ -569,7 +573,7 @@ abstract class BaseController extends Controller
|
||||
if (!$entity->$field) {
|
||||
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)) {
|
||||
throw new \Exception("파일이 확인되지 않습니다.");
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions,
|
||||
$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"]);
|
||||
// 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 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":
|
||||
$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"]);
|
||||
// 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;
|
||||
case "status":
|
||||
$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":
|
||||
$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"]);
|
||||
// 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;
|
||||
case "status":
|
||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||
|
||||
@ -17,12 +17,12 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array
|
||||
$value = $value ?: DEFAULTS['EMPTY'];
|
||||
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"]);
|
||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
||||
// }
|
||||
// return implode(" ", $checkboxs);
|
||||
// $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"]);
|
||||
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":
|
||||
@ -89,11 +89,6 @@ function getFieldFilter_UserHelper($field, $value, array $fieldFormOptions, arra
|
||||
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"]);
|
||||
// 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;
|
||||
default:
|
||||
return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes);
|
||||
@ -124,7 +119,7 @@ function getFieldIndex_Row_UserHelper_Admin($field, $entity, 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(), $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);
|
||||
break;
|
||||
|
||||
@ -40,6 +40,8 @@ class BoardConfigModel extends BaseModel
|
||||
case "isreply":
|
||||
case "isupload":
|
||||
case "isdownload":
|
||||
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
||||
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user,guest]";
|
||||
$rules[$field] = "required";
|
||||
break;
|
||||
default:
|
||||
@ -64,7 +66,7 @@ class BoardConfigModel extends BaseModel
|
||||
case "isdownload":
|
||||
case "isaccess":
|
||||
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":
|
||||
|
||||
@ -43,7 +43,9 @@ class UserModel extends BaseModel
|
||||
$rules[$field] = "required|trim|valid_email";
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
$rules = parent::getFieldRule($field, $rules, $action);
|
||||
@ -55,13 +57,18 @@ class UserModel extends BaseModel
|
||||
{
|
||||
return parent::getEntity($conditions);
|
||||
}
|
||||
|
||||
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
|
||||
{
|
||||
switch ($field) {
|
||||
case "role":
|
||||
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;
|
||||
default:
|
||||
|
||||
@ -5,6 +5,5 @@
|
||||
<div class="accordion accordion-flush">
|
||||
<?= $this->include($layout['path'] . '/left_menu/base'); ?>
|
||||
<?= $this->include($layout['path'] . '/left_menu/board'); ?>
|
||||
<?= $this->include($layout['path'] . '/left_menu/shoppingmall'); ?>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user