diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 9a142d2..1f05cb0 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -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');
- });;
});
/*
* --------------------------------------------------------------------
diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php
index 87f01db..e15d814 100644
--- a/app/Controllers/Admin/UserController.php
+++ b/app/Controllers/Admin/UserController.php
@@ -61,4 +61,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['role.*'] = $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/Controllers/BaseController.php b/app/Controllers/BaseController.php
index 552d2c0..36cb928 100644
--- a/app/Controllers/BaseController.php
+++ b/app/Controllers/BaseController.php
@@ -3,7 +3,6 @@
namespace App\Controllers;
-use App\Models\UserModel;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\Files\UploadedFile;
@@ -70,23 +69,6 @@ abstract class BaseController extends Controller
{
return $this->getFieldFilters();
}
- protected function getFieldRule(string $field, array $rules, string $action = ""): array
- {
- switch ($field) {
- default:
- $rules = $this->_model->getFieldRule($field, $rules, $action);
- break;
- }
- return $rules;
- }
- final public function getFieldRules(array $fields, string $action = ""): array
- {
- $rules = array();
- foreach ($fields as $field) {
- $rules = $this->getFieldRule($field, $rules, $action);
- }
- return $rules;
- }
//Field별 Form Datas 처리용
protected function getFieldFormData(string $field, $entity = null): array
{
@@ -144,7 +126,7 @@ abstract class BaseController extends Controller
break;
}
$this->_viewDatas['fields'] = $fields ?: $this->getFields($action);
- $this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], $action);
+ $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], $action);
$this->_viewDatas['fieldFilters'] = $this->getFieldFilters();
$this->_viewDatas['batchjobFilters'] = $this->getFieldBatchFilters();
$this->_viewDatas['fieldFormOptions'] = $this->_model->getFieldFormOptions($this->_viewDatas['fieldFilters']);
diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php
index c2fe284..f57d605 100644
--- a/app/Models/BaseModel.php
+++ b/app/Models/BaseModel.php
@@ -106,6 +106,14 @@ abstract class BaseModel extends Model
}
return $rules;
}
+ final public function getFieldRules(array $fields, string $action = ""): array
+ {
+ $rules = array();
+ foreach ($fields as $field) {
+ $rules = $this->getFieldRule($field, $rules, $action);
+ }
+ return $rules;
+ }
//Field별 Form Option용
public function getOptions(array $conditions = array(), $options = array()): array
{
diff --git a/app/Views/admin/board/index.php b/app/Views/admin/board/index.php
index 4737b03..0e4ec9b 100644
--- a/app/Views/admin/board/index.php
+++ b/app/Views/admin/board/index.php
@@ -9,7 +9,7 @@
= form_close(); ?>
- = form_open(current_url() . 'batchjob', $forms['attributes'], $forms['hiddens']) ?>
+ = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
| 번호 |
@@ -21,12 +21,12 @@
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"]) ?>
+ = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
|
= getFieldIndex_Row_BoardHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?> |
- = anchor(current_url() . 'delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
+ = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
@@ -36,7 +36,7 @@
= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
= getFieldFilter_BoardHelper($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"]) ?>
+ = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
= $pagination ?>
diff --git a/app/Views/admin/boardconfig/index.php b/app/Views/admin/boardconfig/index.php
index 8168605..3e28890 100644
--- a/app/Views/admin/boardconfig/index.php
+++ b/app/Views/admin/boardconfig/index.php
@@ -9,7 +9,7 @@
= form_close(); ?>
- = form_open(current_url() . 'batchjob', $forms['attributes'], $forms['hiddens']) ?>
+ = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
| 번호 |
@@ -21,12 +21,12 @@
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"]) ?>
+ = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
|
= getFieldIndex_Row_BoardConfigHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?> |
- = anchor(current_url() . 'delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
+ = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
@@ -36,7 +36,7 @@
= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
= getFieldFilter_BoardConfigHelper($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"]) ?>
+ = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
= $pagination ?>
diff --git a/app/Views/admin/category/index.php b/app/Views/admin/category/index.php
index 08b5334..9f35470 100644
--- a/app/Views/admin/category/index.php
+++ b/app/Views/admin/category/index.php
@@ -9,7 +9,7 @@
= form_close(); ?>
- = form_open(current_url() . 'batchjob', $forms['attributes'], $forms['hiddens']) ?>
+ = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
| 번호 |
@@ -21,12 +21,12 @@
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"]) ?>
+ = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
|
= getFieldIndex_Row_CategoryHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?> |
- = anchor(current_url() . 'delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
+ = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
@@ -36,7 +36,7 @@
= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
= getFieldFilter_CategoryHelper($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"]) ?>
+ = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
= $pagination ?>
diff --git a/app/Views/admin/order/index.php b/app/Views/admin/order/index.php
index a196f32..020703d 100644
--- a/app/Views/admin/order/index.php
+++ b/app/Views/admin/order/index.php
@@ -9,7 +9,7 @@
= form_close(); ?>
- = form_open(current_url() . 'batchjob', $forms['attributes'], $forms['hiddens']) ?>
+ = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
| 번호 |
diff --git a/app/Views/admin/product/index.php b/app/Views/admin/product/index.php
index c0aa53b..f4cc3d1 100644
--- a/app/Views/admin/product/index.php
+++ b/app/Views/admin/product/index.php
@@ -9,7 +9,7 @@
= form_close(); ?>
- = form_open(current_url() . 'batchjob', $forms['attributes'], $forms['hiddens']) ?>
+ = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
| 번호 |
@@ -21,12 +21,12 @@
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"]) ?>
+ = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
|
= getFieldIndex_Row_ProductHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?> |
- = anchor(current_url() . 'delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
+ = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
@@ -36,7 +36,7 @@
= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
= getFieldFilter_ProductHelper($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"]) ?>
+ = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
= $pagination ?>
diff --git a/app/Views/admin/user/index.php b/app/Views/admin/user/index.php
index 67f1860..57e6a6a 100644
--- a/app/Views/admin/user/index.php
+++ b/app/Views/admin/user/index.php
@@ -9,7 +9,7 @@
= form_close(); ?>
- = form_open(current_url() . 'batchjob', $forms['attributes'], $forms['hiddens']) ?>
+ = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
| 번호 |
@@ -21,12 +21,12 @@
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"]) ?>
+ = 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"]) ?> |
+ = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
@@ -36,7 +36,7 @@
= 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"]) ?>
+ = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
= $pagination ?>
diff --git a/app/Views/admin/usersns/index.php b/app/Views/admin/usersns/index.php
index 4294d44..b4a08b9 100644
--- a/app/Views/admin/usersns/index.php
+++ b/app/Views/admin/usersns/index.php
@@ -9,7 +9,7 @@
= form_close(); ?>
- = form_open(current_url() . 'batchjob', $forms['attributes'], $forms['hiddens']) ?>
+ = form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
| 번호 |
@@ -21,12 +21,12 @@
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"]) ?>
+ = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
|
= getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?> |
- = anchor(current_url() . 'delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
+ = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> |
@@ -36,7 +36,7 @@
= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
= getFieldFilter_UserSNSHelper($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"]) ?>
+ = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
= $pagination ?>
diff --git a/app/Views/front/board/index.php b/app/Views/front/board/index.php
index cc70ffd..5637821 100644
--- a/app/Views/front/board/index.php
+++ b/app/Views/front/board/index.php
@@ -19,7 +19,7 @@
getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
|
get(SESSION_NAMES['ISLOGIN']) && $entity->getUser_Uid() == $session->get(SESSION_NAMES['AUTH'])[AUTH_FIELDS['ID']]) : ?>
- = anchor(current_url() . 'update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
+ = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
= $total_count - (($page - 1) * $per_page + $i) ?>
diff --git a/app/Views/layouts/front/top_menu.php b/app/Views/layouts/front/top_menu.php
new file mode 100644
index 0000000..cac30be
--- /dev/null
+++ b/app/Views/layouts/front/top_menu.php
@@ -0,0 +1,14 @@
+
\ No newline at end of file
|