diff --git a/app/Config/Constants.php b/app/Config/Constants.php
index 6ce8761..b10f32b 100644
--- a/app/Config/Constants.php
+++ b/app/Config/Constants.php
@@ -114,6 +114,7 @@ define('LAYOUTS', [
'',
'',
'',
+ '',
'',
],
'javascripts' => [
@@ -132,7 +133,6 @@ define('LAYOUTS', [
'',
'',
'',
- '',
'',
],
'javascripts' => [
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index a47bd6c..4e79d54 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -98,9 +98,9 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$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) {
- $routes->get('update', 'UserController::update_form');
- $routes->post('update', 'UserController::update');
- $routes->get('view', 'UserController::view');
+ $routes->get('update/(:uuid)', 'UserController::update_form/$1');
+ $routes->post('update/(:uuid)', 'UserController::update/R1');
+ $routes->get('view/(:uuid)', 'UserController::view/$1');
});
$routes->group('board', static function ($routes) {
$routes->get('', 'BoardController::index');
diff --git a/app/Controllers/Front/UserController.php b/app/Controllers/Front/UserController.php
new file mode 100644
index 0000000..17f52fa
--- /dev/null
+++ b/app/Controllers/Front/UserController.php
@@ -0,0 +1,84 @@
+_model = new UserModel();
+ parent::initController($request, $response, $logger);
+ $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
+ $this->_viewPath .= strtolower($this->_model->getClassName());
+ helper($this->_model->getClassName());
+ }
+
+ //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;
+ default:
+ return parent::getFieldFormData($field, $entity);
+ break;
+ }
+ return $this->_viewDatas['fieldDatas'];
+ }
+
+ public function getFields(string $action = ""): array
+ {
+ $fields = ["id", "passwd", 'name', "email", "role", "status"];
+ switch ($action) {
+ case "index":
+ case "excel":
+ return ["id", 'name', "email", "role", "status", 'created_at'];
+ break;
+ case "view":
+ return ["id", 'name', "email", "role", "status", 'updated_at', 'created_at'];
+ break;
+ default:
+ return $fields;
+ break;
+ }
+ }
+ public function getFieldFilters(): array
+ {
+ return ["role", "status"];
+ }
+ public function getFieldBatchFilters(): array
+ {
+ 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);
+ }
+ }
+}
diff --git a/app/Views/front/user/index.php b/app/Views/front/user/index.php
new file mode 100644
index 0000000..57e6a6a
--- /dev/null
+++ b/app/Views/front/user/index.php
@@ -0,0 +1,45 @@
+= $this->extend('layouts/admin') ?>
+= $this->section('content') ?>
+
+
+ = form_open(current_url(), array("method" => "get")) ?>
+
+ 조건검색:- = getFieldFilter_UserHelper($field, $$field, $fieldFormOptions) ?>
+ = $this->include('templates/admin/index_head'); ?>
+
+ = form_close(); ?>
+
+ = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
+
+
+ | 번호 |
+ = getFieldIndex_Column_UserHelper($field, $order_field, $order_value) ?> |
+ 작업 |
+
+
+
+ getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
+ |
+ = form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
+ = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
+ |
+
+ = getFieldIndex_Row_UserHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?> |
+
+ = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
+
+
+
+
+
+
+ - = form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
+ - = getFieldFilter_UserHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?>
+ - = form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?>
+ - = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
+
+ = $pagination ?>
+
+ = form_close(); ?>
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/front/user/update.php b/app/Views/front/user/update.php
new file mode 100644
index 0000000..f83e3b3
--- /dev/null
+++ b/app/Views/front/user/update.php
@@ -0,0 +1,21 @@
+= $this->extend('layouts/admin') ?>
+= $this->section('content') ?>
+
+ = form_open_multipart(current_url(), $forms['attributes'], $forms['hiddens']) ?>
+
+
+= form_close(); ?>
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/front/user/view.php b/app/Views/front/user/view.php
new file mode 100644
index 0000000..a812e5d
--- /dev/null
+++ b/app/Views/front/user/view.php
@@ -0,0 +1,16 @@
+= $this->extend('layouts/admin') ?>
+= $this->section('content') ?>
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/layouts/front.php b/app/Views/layouts/front.php
index 3e24c52..79a35e9 100644
--- a/app/Views/layouts/front.php
+++ b/app/Views/layouts/front.php
@@ -12,8 +12,8 @@
= $javascript ?>
-
-
+
+