diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 25eaa95..9995dbc 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -11,16 +11,23 @@ $routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}
//authFilter는 추가적인 작업이 필요
//1. app/Filters/AuthFilter.php
//2. Config/Filters.php -> $aliases = ['authFilter' => AuthFilter::class]
-$routes->get('/', 'Home::index');
+$routes->group('', ['namespace' => 'App\Controllers'], function ($routes) {
+ $routes->get('/', 'Home::index');
+ $routes->group('user', function ($routes) {
+ $routes->get('login', 'UserController::create_form');
+ $routes->get('signup', 'UserController::create');
+ $routes->get('logout', 'UserController::logout', ['filter' => 'authFilter:user']);
+ });
+});
$routes->group('cli', ['namespace' => 'App\CLI'], function ($routes) {
$routes->group('cloudflare', ['namespace' => 'App\CLI\Cloudflare'], function ($routes) {
$routes->cli('reload', 'Cloudflare::reload');
});
});
// $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {
-$routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
+$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {
$routes->get('/', 'Home::index');
- $routes->group('user', function ($routes) {
+ $routes->group('user', ['filter' => 'authFilter:master'], function ($routes) {
$routes->get('/', 'UserController::index');
$routes->get('create', 'UserController::create_form');
$routes->post('create', 'UserController::create');
@@ -42,7 +49,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
$routes->post('batchjob', 'MapurlController::batcjob');
$routes->get('download/(:alpha)', 'MapurlController::download/$1');
});
- $routes->group('cloudflare', ['namespace' => 'App\Controllers\Admin\Cloudflare'], function ($routes) {
+ $routes->group('cloudflare', ['namespace' => 'App\Controllers\Admin\Cloudflare', 'filter' => 'authFilter:cloudflare'], function ($routes) {
$routes->group('auth', function ($routes) {
$routes->get('/', 'AuthController::index');
$routes->get('create', 'AuthController::create_form');
@@ -55,7 +62,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
});
$routes->group('account', function ($routes) {
$routes->get('/', 'AccountController::index');
- $routes->post('create/(:uuid)', 'AccountController::create');
$routes->get('reload/(:num)', 'AccountController::reload/$1');
$routes->get('download/(:alpha)', 'AccountController::download/$1');
});
@@ -73,7 +79,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
$routes->group('record', function ($routes) {
$routes->get('/', 'RecordController::index');
$routes->get('create', 'RecordController::create_form');
- $routes->post('create)', 'RecordController::create');
+ $routes->post('create', 'RecordController::create');
$routes->get('delete/(:alphanum)', 'RecordController::delete/$1');
$routes->get('sync/(:alphanum)', 'RecordController::sync/$1');
$routes->get('toggle/(:alphanum)/(:any)', 'RecordController::toggle/$1/$2');
diff --git a/app/Controllers/Admin/AdminController.php b/app/Controllers/Admin/AdminController.php
index 7b63115..54a5d1e 100644
--- a/app/Controllers/Admin/AdminController.php
+++ b/app/Controllers/Admin/AdminController.php
@@ -7,17 +7,13 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
-use App\Traits\AuthTrait;
-
abstract class AdminController extends MVController
{
- use AuthTrait;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
- $this->root = "Admin/";
$this->layout = "admin";
- $this->session = $this->session_AuthTrait();
+ $this->view_root .= "admin/";
$this->action_form = FORMS['MODAL'];
}
}
diff --git a/app/Controllers/Admin/Cloudflare/AccountController.php b/app/Controllers/Admin/Cloudflare/AccountController.php
index cf19b9f..10fefe6 100644
--- a/app/Controllers/Admin/Cloudflare/AccountController.php
+++ b/app/Controllers/Admin/Cloudflare/AccountController.php
@@ -19,7 +19,8 @@ class AccountController extends CloudflareController
{
parent::initController($request, $response, $logger);
$this->class_name = "Account";
- $this->class_path = $this->root . $this->class_name;
+ $this->class_path .= $this->class_name;
+ $this->view_path = strtolower($this->view_root . $this->class_name);
$this->title = lang("{$this->class_path}.title");
helper($this->class_path);
}
diff --git a/app/Controllers/Admin/Cloudflare/AuthController.php b/app/Controllers/Admin/Cloudflare/AuthController.php
index fdbbc4d..9534728 100644
--- a/app/Controllers/Admin/Cloudflare/AuthController.php
+++ b/app/Controllers/Admin/Cloudflare/AuthController.php
@@ -15,8 +15,9 @@ class AuthController extends CloudflareController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
- $this->class_name = "Auth";
- $this->class_path = $this->root . $this->class_name;
+ $this->class_name .= "Auth";
+ $this->class_path .= $this->class_name;
+ $this->view_path = strtolower($this->view_root . $this->class_name);
$this->title = lang("{$this->class_path}.title");
helper($this->class_path);
}
diff --git a/app/Controllers/Admin/Cloudflare/CloudflareController.php b/app/Controllers/Admin/Cloudflare/CloudflareController.php
index 7ac0786..b46bfe2 100644
--- a/app/Controllers/Admin/Cloudflare/CloudflareController.php
+++ b/app/Controllers/Admin/Cloudflare/CloudflareController.php
@@ -21,7 +21,8 @@ abstract class CloudflareController extends AdminController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
- $this->root .= "Cloudflare/";
+ $this->class_path .= "Cloudflare/";
+ $this->view_root .= strtolower($this->class_path);
}
final protected function getAuthModel(): AuthModel
{
diff --git a/app/Controllers/Admin/Cloudflare/RecordController.php b/app/Controllers/Admin/Cloudflare/RecordController.php
index af4b2a2..2bd3598 100644
--- a/app/Controllers/Admin/Cloudflare/RecordController.php
+++ b/app/Controllers/Admin/Cloudflare/RecordController.php
@@ -17,8 +17,9 @@ class RecordController extends CloudflareController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
- $this->class_name = "Record";
- $this->class_path = $this->root . $this->class_name;
+ $this->class_name .= "Record";
+ $this->class_path .= $this->class_name;
+ $this->view_path = strtolower($this->view_root . $this->class_name);
$this->title = lang("{$this->class_path}.title");
helper($this->class_path);
}
diff --git a/app/Controllers/Admin/Cloudflare/ZoneController.php b/app/Controllers/Admin/Cloudflare/ZoneController.php
index d9392fb..098024b 100644
--- a/app/Controllers/Admin/Cloudflare/ZoneController.php
+++ b/app/Controllers/Admin/Cloudflare/ZoneController.php
@@ -19,8 +19,9 @@ class ZoneController extends CloudflareController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
- $this->class_name = "Zone";
- $this->class_path = $this->root . $this->class_name;
+ $this->class_name .= "Zone";
+ $this->class_path .= $this->class_name;
+ $this->view_path = strtolower($this->view_root . $this->class_name);
$this->title = lang("{$this->class_path}.title");
helper($this->class_path);
}
diff --git a/app/Controllers/Admin/MapurlController.php b/app/Controllers/Admin/MapurlController.php
index ff734b8..8953b0a 100644
--- a/app/Controllers/Admin/MapurlController.php
+++ b/app/Controllers/Admin/MapurlController.php
@@ -16,8 +16,9 @@ class MapurlController extends AdminController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
- $this->class_name = "Mapurl";
- $this->class_path = $this->root . $this->class_name;
+ $this->class_name .= "Mapurl";
+ $this->class_path .= $this->class_name;
+ $this->view_path = strtolower($this->view_root . $this->class_name);
$this->title = lang("{$this->class_path}.title");
helper($this->class_path);
}
diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php
index a08a52f..05c2273 100644
--- a/app/Controllers/Admin/UserController.php
+++ b/app/Controllers/Admin/UserController.php
@@ -17,8 +17,9 @@ class UserController extends AdminController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
- $this->class_name = "User";
- $this->class_path = $this->root . $this->class_name;
+ $this->class_name .= "User";
+ $this->class_path .= $this->class_name;
+ $this->view_path = strtolower($this->view_root . $this->class_name);
$this->title = lang("{$this->class_path}.title");
helper($this->class_path);
}
diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php
deleted file mode 100644
index 9ff2907..0000000
--- a/app/Controllers/AuthController.php
+++ /dev/null
@@ -1,58 +0,0 @@
- LAYOUTS['empty'],
- 'title' => '로그인',
- 'forms' => [
- 'attributes' => ['action' => 'post', 'class' => 'row g-3'],
- 'hiddens' => [SESSION_NAMES['RETURN_URL'] => session()->get(SESSION_NAMES['RETURN_URL'])],
- ]
- ];
- return view('auth/login', $viewDatas);
- }
-
- public function signin()
- {
- $id = $this->request->getVar('id');
- $passwd = $this->request->getVar('passwd');
- $model = new UserModel();
- $user = $model->asObject(UserEntity::class)->where('id', $id)->first();
- if (is_null($user) || !isset($user->passwd)) {
- session()->setFlashdata('error', "사용자ID: {$id}가 존재하지 않습니다.");
- return redirect()->back()->withInput();
- }
- if (password_verify($passwd, $user->passwd)) {
- //Session에 Login 정보전달
- $authData = [
- 'uid' => $user->uid,
- 'name' => $user->name,
- 'email' => $user->email,
- 'role' => $user->role,
- SESSION_NAMES['ISLOGIN'] => true
- ];
- session()->set($authData);
- return redirect()->to($this->request->getVar(SESSION_NAMES['RETURN_URL']) ? $this->request->getVar(SESSION_NAMES['RETURN_URL']) : "/");
- } else {
- session()->setFlashdata('error', '암호가 맞지 않습니다.');
- return redirect()->back()->withInput();
- }
- }
-
- public function logout()
- {
- //Session에 Login 정보 삭제
- session()->set([SESSION_NAMES['ISLOGIN'] => false]);
- session_destroy();
- return redirect()->route('/');
- }
-}
diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php
index 282d288..70e4b4d 100644
--- a/app/Controllers/CommonController.php
+++ b/app/Controllers/CommonController.php
@@ -6,9 +6,11 @@ use App\Controllers\BaseController;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
+use App\Traits\AuthTrait;
abstract class CommonController extends BaseController
{
+ use AuthTrait;
private $_viewDatas = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
diff --git a/app/Controllers/MVController.php b/app/Controllers/MVController.php
index 8e890c5..b4e2c2f 100644
--- a/app/Controllers/MVController.php
+++ b/app/Controllers/MVController.php
@@ -14,10 +14,15 @@ use Psr\Log\LoggerInterface;
abstract class MVController extends CommonController
{
+ protected $class_name = "";
+ protected $class_path = "";
+ protected $view_root = "";
+ protected $view_path = "";
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
helper('common');
+ $this->session = $this->session_AuthTrait();
}
abstract protected function getModel(): mixed;
//Field별 Form Rule용
@@ -97,7 +102,7 @@ abstract class MVController extends CommonController
$this->session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return view(
- strtolower(string: $this->class_path) . "/create",
+ $this->view_path . "/create",
data: ['viewDatas' => $this->getViewDatas()]
);
} catch (\Exception $e) {
@@ -169,7 +174,7 @@ abstract class MVController extends CommonController
$this->session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return view(
- strtolower($this->class_path) . "/modify",
+ $this->view_path . "/modify",
data: ['viewDatas' => $this->getViewDatas()]
);
} catch (\Exception $e) {
@@ -377,7 +382,7 @@ abstract class MVController extends CommonController
//setting return_url to session flashdata
$this->session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->uri->getQuery() ?: "");
return view(
- strtolower($this->class_path) . "/index",
+ $this->view_path . "/index",
['viewDatas' => $this->getViewDatas()]
);
} catch (\Exception $e) {
diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php
new file mode 100644
index 0000000..e5940e2
--- /dev/null
+++ b/app/Controllers/UserController.php
@@ -0,0 +1,127 @@
+class_name .= "User";
+ $this->class_path .= $this->class_name;
+ $this->view_path = strtolower($this->view_root . $this->class_name);
+ $this->title = lang("{$this->class_path}.title");
+ helper($this->class_path);
+ }
+ protected function getModel(): UserModel
+ {
+ if ($this->_model === null) {
+ $this->_model = new UserModel();
+ }
+ return $this->_model;
+ }
+ protected function setFormFieldRule($field, Validation $validation, string $action): Validation
+ {
+ switch ($field) {
+ case 'role':
+ //아래 Rule Array는 필드명.* checkbox를 사용
+ $validation->setRule($field . ".*", $field, $this->getModel()->getFieldRule($action, $field));
+ break;
+ default:
+ $validation = parent::setFormFieldRule($field, $validation, $action);
+ break;
+ }
+ return $validation;
+ }
+ protected function getFormFieldOption(string $field, array $options = []): array
+ {
+ switch ($field) {
+ default:
+ $options = parent::getFormFieldOption($field, $options);
+ break;
+ }
+ return $options;
+ }
+ protected function getFormData(string $field, array $formDatas): array
+ {
+ switch ($field) {
+ case 'role':
+ $roles = $this->request->getVar($field) ?? [];
+ if (!count($roles)) {
+ throw new \Exception("권한이 지정되지 않았습니다.");
+ }
+ $formDatas[$field] = implode(DEFAULTS["DELIMITER_ROLE"], $roles);
+ break;
+ default:
+ $formDatas = parent::getFormData($field, $formDatas);
+ break;
+ }
+ return $formDatas;
+ }
+ private function init(string $action): void
+ {
+ $this->action = $action;
+ $this->fields = ['id', 'passwd'];
+ $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
+ }
+ //로그인화면
+ public function create_form(): RedirectResponse|string
+ {
+ $this->init('create');
+ return $this->create_form_procedure();
+ }
+ //로그인처리
+ public function create(): RedirectResponse|string
+ {
+ $this->init(__FUNCTION__);
+ $this->formDatas = $this->getFormDatas();
+ $id = $this->request->getVar('id');
+ $passwd = $this->request->getVar('passwd');
+ if (!$id) {
+ session()->setFlashdata('error', "사용자ID를 입력해주세요!");
+ return redirect()->back()->withInput();
+ }
+ if (!$passwd) {
+ session()->setFlashdata('error', "암호를 입력해주세요!");
+ return redirect()->back()->withInput();
+ }
+ $entity = $this->getModel()->getEntityByID($id);
+ if (is_null($entity) || !isset($entity->passwd)) {
+ session()->setFlashdata('error', "사용자ID: {$id}가 존재하지 않습니다.");
+ return redirect()->back()->withInput();
+ }
+ if (password_verify($passwd, $entity->passwd)) {
+ //Session에 Login 정보전달
+ $authData = [
+ 'uid' => $entity->getPK(),
+ 'name' => $entity->getTitle(),
+ 'email' => $entity->email,
+ 'role' => $entity->role,
+ SESSION_NAMES['ISLOGIN'] => true
+ ];
+ session()->set($authData);
+ return redirect()->to($this->request->getVar(SESSION_NAMES['RETURN_URL']) ? $this->request->getVar(SESSION_NAMES['RETURN_URL']) : "/");
+ } else {
+ session()->setFlashdata('error', '암호가 맞지 않습니다.');
+ return redirect()->back()->withInput();
+ }
+ }
+ //로그아웃
+ public function logout(): RedirectResponse
+ {
+ //Session에 Login 정보 삭제
+ session()->set([SESSION_NAMES['ISLOGIN'] => false]);
+ session_destroy();
+ return redirect()->route('/');
+ }
+}
diff --git a/app/Filters/AuthFilter.php b/app/Filters/AuthFilter.php
index 0058d92..93639ee 100644
--- a/app/Filters/AuthFilter.php
+++ b/app/Filters/AuthFilter.php
@@ -26,22 +26,22 @@ class AuthFilter implements FilterInterface
public function before(RequestInterface $request, $arguments = null)
{
// 로그인을 했으면
- if (session()->get(SESSION['NAMES']['ISLOGIN'])) {
- $auth = session()->get(SESSION['NAMES']['AUTH']);
+ if (session()->get(SESSION_NAMES['ISLOGIN'])) {
+ $auth = session()->get(SESSION_NAMES['AUTH']);
// 회원 ROLES이 필요ROLE($arguments[0]) 목록에 존재하지 않으면(ACL)
- if (!in_array($arguments[0], explode(DEFAULTS['DELIMITER_ROLE'], $auth[AUTH['FIELDS']['ROLE']]))) {
+ if (!in_array($arguments[0], explode(DEFAULTS['DELIMITER_ROLE'], $auth[AUTH_FIELDS['ROLE']]))) {
return redirect()->to(URLS['LOGIN'])->with(
'return_message',
sprintf(
"%s,%s회원님은 접속에 필요한 권한[%s]이 없습니다. ",
- $auth[AUTH['FIELDS']['ROLE']],
- $auth[AUTH['FIELDS']['TITLE']],
+ $auth[AUTH_FIELDS['ROLE']],
+ $auth[AUTH_FIELDS['TITLE']],
implode(",", $arguments)
)
);
}
} else {
- session()->setFlashdata(SESSION['NAMES']['RETURN_URL'], $request->getUri()->getPath() . '?' . $request->getUri()->getQuery());
+ session()->setFlashdata(SESSION_NAMES['RETURN_URL'], $request->getUri()->getPath() . '?' . $request->getUri()->getQuery());
return redirect()->to(URLS['LOGIN'])->with('return_message', '로그인을하셔야합니다.');
}
}
diff --git a/app/Helpers/Admin/Cloudflare/Account_helper.php b/app/Helpers/Cloudflare/Account_helper.php
similarity index 82%
rename from app/Helpers/Admin/Cloudflare/Account_helper.php
rename to app/Helpers/Cloudflare/Account_helper.php
index 95e024e..58667aa 100644
--- a/app/Helpers/Admin/Cloudflare/Account_helper.php
+++ b/app/Helpers/Cloudflare/Account_helper.php
@@ -75,7 +75,7 @@ function getFieldView_AccountHelper(string $field, array $viewDatas, array $extr
break;
case AccountModel::TITLE:
$value = anchor(
- base_url() . strtolower($viewDatas['root']) . 'zone/reload/' . $viewDatas['entity']->getPK(),
+ base_url() . $viewDatas['view_root'] . 'zone/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@@ -83,7 +83,7 @@ function getFieldView_AccountHelper(string $field, array $viewDatas, array $extr
]
) . " " .
anchor(
- base_url() . strtolower($viewDatas['root']) . "zone?account_uid=" . $viewDatas['entity']->getPK(),
+ base_url() . $viewDatas['view_root'] . "zone?account_uid=" . $viewDatas['entity']->getPK(),
ICONS["FLAG"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@@ -122,16 +122,12 @@ function getFieldView_AccountHelper(string $field, array $viewDatas, array $extr
function getListLabel_AccountHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_AccountHelper($field, $viewDatas, $extras);
- if ($field == $viewDatas['order_field']) {
+ if (isset($viewDatas['order_field']) && $field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
- }
- $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
- $viewDatas['uri']->addQuery('order_field', $field);
- $viewDatas['uri']->addQuery('order_value', $order_value);
- $label = anchor((string)$viewDatas['uri'], $label);
- switch ($field) {
- case AccountModel::TITLE:
- break;
+ $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
+ $viewDatas['uri']->addQuery('order_field', $field);
+ $viewDatas['uri']->addQuery('order_value', $order_value);
+ $label = anchor((string)$viewDatas['uri'], $label);
}
return sprintf("
%s | ", implode(" ", $extras), $label);
}
@@ -175,20 +171,9 @@ function getListButton_AccountHelper(string $action, array $viewDatas, array $ex
$action = getListButtonLabel_AccountHelper($action, '입력', $viewDatas, $extras);
break;
case 'sync':
- // $checkbox = form_checkbox([
- // "id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
- // "name" => "batchjob_uids[]",
- // "value" => $viewDatas['entity']->getPK(),
- // "class" => "batchjobuids_checkboxs"
- // ]);
- // $viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
- // $action = $checkbox . getListButtonLabel_AccountHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
$action = $viewDatas['cnt'];
break;
case 'delete':
- // $viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
- // $extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
- // $action = anchor($viewDatas['list_action_url'], ICONS['DELETE'], $extras);
$action = "";
break;
}
diff --git a/app/Helpers/Admin/Cloudflare/Auth_helper.php b/app/Helpers/Cloudflare/Auth_helper.php
similarity index 87%
rename from app/Helpers/Admin/Cloudflare/Auth_helper.php
rename to app/Helpers/Cloudflare/Auth_helper.php
index 3e1e44a..2e7c5f1 100644
--- a/app/Helpers/Admin/Cloudflare/Auth_helper.php
+++ b/app/Helpers/Cloudflare/Auth_helper.php
@@ -43,7 +43,7 @@ function getFieldView_AuthHelper(string $field, array $viewDatas, array $extras
switch ($field) {
case AuthModel::TITLE:
$value = anchor(
- base_url() . strtolower($viewDatas['root']) . 'account/reload/' . $viewDatas['entity']->getPK(),
+ base_url() . $viewDatas['view_root'] . 'account/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@@ -51,7 +51,7 @@ function getFieldView_AuthHelper(string $field, array $viewDatas, array $extras
]
) . " " .
anchor(
- base_url() . strtolower($viewDatas['root']) . "account?auth_uid=" . $viewDatas['entity']->getPK(),
+ base_url() . $viewDatas['view_root'] . "account?auth_uid=" . $viewDatas['entity']->getPK(),
ICONS["FLAG"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@@ -90,16 +90,12 @@ function getFieldView_AuthHelper(string $field, array $viewDatas, array $extras
function getListLabel_AuthHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_AuthHelper($field, $viewDatas, $extras);
- if ($field == $viewDatas['order_field']) {
+ if (isset($viewDatas['order_field']) && $field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
- }
- $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
- $viewDatas['uri']->addQuery('order_field', $field);
- $viewDatas['uri']->addQuery('order_value', $order_value);
- $label = anchor((string)$viewDatas['uri'], $label);
- switch ($field) {
- case AuthModel::TITLE:
- break;
+ $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
+ $viewDatas['uri']->addQuery('order_field', $field);
+ $viewDatas['uri']->addQuery('order_value', $order_value);
+ $label = anchor((string)$viewDatas['uri'], $label);
}
return sprintf("%s | ", implode(" ", $extras), $label);
}
@@ -143,11 +139,13 @@ function getListButton_AuthHelper(string $action, array $viewDatas, array $extra
$action = getListButtonLabel_AuthHelper($action, '입력', $viewDatas, $extras);
break;
case 'modify':
+ $pk = $viewDatas['entity']->getPK();
$checkbox = form_checkbox([
- "id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
+ "id" => "checkbox_uid_{$pk}",
"name" => "batchjob_uids[]",
- "value" => $viewDatas['entity']->getPK(),
- "class" => "batchjobuids_checkboxs"
+ "value" => $pk,
+ "class" => "batchjobuids_checkboxs",
+ "checked" => in_array($pk, old("batchjob_uids", []))
]);
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$action = $checkbox . getListButtonLabel_AuthHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
diff --git a/app/Helpers/Admin/Cloudflare/Record_helper.php b/app/Helpers/Cloudflare/Record_helper.php
similarity index 93%
rename from app/Helpers/Admin/Cloudflare/Record_helper.php
rename to app/Helpers/Cloudflare/Record_helper.php
index 8fb13e4..ed6e8cf 100644
--- a/app/Helpers/Admin/Cloudflare/Record_helper.php
+++ b/app/Helpers/Cloudflare/Record_helper.php
@@ -120,13 +120,13 @@ function getFieldView_RecordHelper(string $field, array $viewDatas, array $extra
function getListLabel_RecordHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_RecordHelper($field, $viewDatas, $extras);
- if ($field == $viewDatas['order_field']) {
+ if (isset($viewDatas['order_field']) && $field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
+ $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
+ $viewDatas['uri']->addQuery('order_field', $field);
+ $viewDatas['uri']->addQuery('order_value', $order_value);
+ $label = anchor((string)$viewDatas['uri'], $label);
}
- $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
- $viewDatas['uri']->addQuery('order_field', $field);
- $viewDatas['uri']->addQuery('order_value', $order_value);
- $label = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case RecordModel::PARENT:
$label .= "