diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index bb655f0..1f05cb0 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -95,23 +95,27 @@ $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('hpilo', static function ($routes) {
- $routes->get('', 'HPILOController::index');
- $routes->get('excel', 'HPILOController::excel');
- $routes->get('insert', 'HPILOController::insert_form');
- $routes->post('insert', 'HPILOController::insert');
- $routes->get('update/(:num)', 'HPILOController::update_form/$1');
- $routes->post('update/(:num)', 'HPILOController::update/$1');
- $routes->get('view/(:num)', 'HPILOController::view/$1');
- $routes->get('delete/(:num)', 'HPILOController::delete/$1', ['filter' => 'authFilter:master']);
- $routes->get('toggle/(:num)/(:hash)', 'HPILOController::toggle/$1/$2');
- $routes->post('batchjob', 'HPILOController::batchjob');
- $routes->get('console/(:num)', 'HPILOController::console/$1');
- $routes->get('reset/(:num)/(:alpha)', 'HPILOController::reset/$1/$2');
- $routes->get('reload/(:num)', 'HPILOController::reload/$1');
+});
+$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->group('board', static function ($routes) {
+ $routes->get('', 'BoardController::index');
+ $routes->get('excel', 'BoardController::excel/$1');
+ $routes->get('insert', 'BoardController::insert_form');
+ $routes->post('insert', 'BoardController::insert');
+ $routes->get('update/(:num)', 'BoardController::update_form/$1');
+ $routes->post('update/(:num)', 'BoardController::update/$1');
+ $routes->get('view/(:num)', 'BoardController::view/$1');
+ $routes->get('reply/(:num)', 'BoardController::reply_form/$1');
+ $routes->post('reply/(:num)', 'BoardController::reply/$1');
+ $routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
+ $routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
});
});
-
/*
* --------------------------------------------------------------------
* Additional Routing
diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php
index 8b5a6fe..87f01db 100644
--- a/app/Controllers/Admin/UserController.php
+++ b/app/Controllers/Admin/UserController.php
@@ -22,6 +22,10 @@ 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');
diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php
index df390e0..552d2c0 100644
--- a/app/Controllers/BaseController.php
+++ b/app/Controllers/BaseController.php
@@ -70,6 +70,23 @@ 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
{
@@ -127,9 +144,9 @@ abstract class BaseController extends Controller
break;
}
$this->_viewDatas['fields'] = $fields ?: $this->getFields($action);
+ $this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], $action);
$this->_viewDatas['fieldFilters'] = $this->getFieldFilters();
$this->_viewDatas['batchjobFilters'] = $this->getFieldBatchFilters();
- $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], $action);
$this->_viewDatas['fieldFormOptions'] = $this->_model->getFieldFormOptions($this->_viewDatas['fieldFilters']);
return $this->_viewDatas;
}
@@ -189,7 +206,7 @@ abstract class BaseController extends Controller
$this->_viewDatas = $this->init(__FUNCTION__);
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
helper(['form']);
- $$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
+ $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
$this->_viewDatas['entity'] = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
return view($this->_viewPath . '/update', $this->_viewDatas);
} catch (\Exception $e) {
diff --git a/app/Helpers/User_helper.php b/app/Helpers/User_helper.php
index 17ff344..8206f7b 100644
--- a/app/Helpers/User_helper.php
+++ b/app/Helpers/User_helper.php
@@ -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] : [$value]), $attributes) . $label;
+ }
+ return implode(" ", $checkboxs);
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
break;
case "status":
@@ -86,6 +86,15 @@ function getFieldFilter_UserHelper($field, $value, array $fieldFormOptions, arra
{
$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);
+ // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
+ break;
default:
return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes);
break;
diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php
index f57d605..c2fe284 100644
--- a/app/Models/BaseModel.php
+++ b/app/Models/BaseModel.php
@@ -106,14 +106,6 @@ 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 0e4ec9b..4737b03 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 3e28890..8168605 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/user/index.php b/app/Views/admin/user/index.php
index 57e6a6a..67f1860 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 b4a08b9..4294d44 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
new file mode 100644
index 0000000..5637821
--- /dev/null
+++ b/app/Views/front/board/index.php
@@ -0,0 +1,38 @@
+= $this->extend('layouts/front') ?>
+= $this->section('content') ?>
+
+
+ = form_open(current_url(), array("method" => "get")) ?>
+
+ 조건검색:- = getFieldFilter_BoardHelper($field, $$field, $fieldFormOptions) ?>
+ = $this->include('templates/front/index_head'); ?>
+
+ = form_close(); ?>
+
+
+
+ | 번호 |
+ = getFieldIndex_Column_BoardHelper($field, $order_field, $order_value) ?> |
+
+
+
+ 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"]) ?>
+
+ = $total_count - (($page - 1) * $per_page + $i) ?>
+
+ |
+
+ = getFieldView_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?> |
+
+
+
+
+
+
+ = $pagination ?>
+
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/front/board/insert.php b/app/Views/front/board/insert.php
new file mode 100644
index 0000000..8295a29
--- /dev/null
+++ b/app/Views/front/board/insert.php
@@ -0,0 +1,21 @@
+= $this->extend('layouts/front') ?>
+= $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/board/reply.php b/app/Views/front/board/reply.php
new file mode 100644
index 0000000..1d55f40
--- /dev/null
+++ b/app/Views/front/board/reply.php
@@ -0,0 +1,21 @@
+= $this->extend('layouts/front') ?>
+= $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/board/update.php b/app/Views/front/board/update.php
new file mode 100644
index 0000000..45d1ec7
--- /dev/null
+++ b/app/Views/front/board/update.php
@@ -0,0 +1,21 @@
+= $this->extend('layouts/front') ?>
+= $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/board/view.php b/app/Views/front/board/view.php
new file mode 100644
index 0000000..8b7bb8c
--- /dev/null
+++ b/app/Views/front/board/view.php
@@ -0,0 +1,16 @@
+= $this->extend('layouts/front') ?>
+= $this->section('content') ?>
+
+= $this->endSection() ?>
\ No newline at end of file