cfmgrv4 init...3
This commit is contained in:
parent
d8fe875eec
commit
75fefc4502
@ -71,6 +71,7 @@ $routes->group('admin/cloudflare', ['namespace' => 'App\Controllers\Admin\Cloudf
|
|||||||
$routes->get('create', 'AuthController::create_form');
|
$routes->get('create', 'AuthController::create_form');
|
||||||
$routes->post('create', 'AuthController::create');
|
$routes->post('create', 'AuthController::create');
|
||||||
$routes->get('modify/(:num)', 'AuthController::modify_form/$1');
|
$routes->get('modify/(:num)', 'AuthController::modify_form/$1');
|
||||||
|
$routes->post('modify/(:num)', 'AuthController::modify/$1');
|
||||||
$routes->get('view/(:num)', 'AuthController::view/$1');
|
$routes->get('view/(:num)', 'AuthController::view/$1');
|
||||||
$routes->get('delete/(:num)', 'AuthController::delete/$1');
|
$routes->get('delete/(:num)', 'AuthController::delete/$1');
|
||||||
$routes->get('toggle/(:num)/(:any)', 'AuthController::toggle/$1/$2');
|
$routes->get('toggle/(:num)/(:any)', 'AuthController::toggle/$1/$2');
|
||||||
@ -80,8 +81,9 @@ $routes->group('admin/cloudflare', ['namespace' => 'App\Controllers\Admin\Cloudf
|
|||||||
});
|
});
|
||||||
$routes->group('account', function ($routes) {
|
$routes->group('account', function ($routes) {
|
||||||
$routes->get('/', 'AccountController::index');
|
$routes->get('/', 'AccountController::index');
|
||||||
|
$routes->get('view/(:alphanum)', 'AccountController::view/$1');
|
||||||
$routes->get('reload/(:num)', 'AccountController::reload/$1');
|
$routes->get('reload/(:num)', 'AccountController::reload/$1');
|
||||||
$routes->get('download/(:alpha)', 'AccountController::download/$1');
|
$routes->get('download/(:alphanum)', 'AccountController::download/$1');
|
||||||
});
|
});
|
||||||
$routes->group('zone', function ($routes) {
|
$routes->group('zone', function ($routes) {
|
||||||
$routes->get('/', 'ZoneController::index');
|
$routes->get('/', 'ZoneController::index');
|
||||||
|
|||||||
@ -13,7 +13,6 @@ use Psr\Log\LoggerInterface;
|
|||||||
|
|
||||||
class AccountController extends CloudflareController
|
class AccountController extends CloudflareController
|
||||||
{
|
{
|
||||||
private $_model = null;
|
|
||||||
private $_auth_entity = null;
|
private $_auth_entity = null;
|
||||||
private $_myLibrays = [];
|
private $_myLibrays = [];
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
@ -26,10 +25,10 @@ class AccountController extends CloudflareController
|
|||||||
}
|
}
|
||||||
final protected function getModel(): AccountModel
|
final protected function getModel(): AccountModel
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
if ($this->model === null) {
|
||||||
$this->_model = new AccountModel();
|
$this->model = new AccountModel();
|
||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->model;
|
||||||
}
|
}
|
||||||
final protected function getMyLibrary(): Account
|
final protected function getMyLibrary(): Account
|
||||||
{
|
{
|
||||||
@ -53,26 +52,31 @@ class AccountController extends CloudflareController
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
// 리스트
|
private function init(string $action, array $fields = []): void
|
||||||
public function index(): string
|
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->action = $action;
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'status', 'updated_at', 'created_at'];
|
$this->fields = count($fields) ? $fields : [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'status', 'updated_at', 'created_at'];
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'status'];
|
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'status'];
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
$this->batchjob_fields = [];
|
$this->batchjob_fields = [];
|
||||||
|
}
|
||||||
|
//View
|
||||||
|
public function view(string $uid): RedirectResponse|string
|
||||||
|
{
|
||||||
|
$this->init(__FUNCTION__);
|
||||||
|
return $this->view_procedure($uid);
|
||||||
|
}
|
||||||
|
// 리스트
|
||||||
|
public function index(): string
|
||||||
|
{
|
||||||
|
$this->init(__FUNCTION__);
|
||||||
return $this->list_procedure();
|
return $this->list_procedure();
|
||||||
}
|
}
|
||||||
// Download
|
// Download
|
||||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'status', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['type', 'status'];
|
|
||||||
return $this->download_procedure($output_type, $uid);
|
return $this->download_procedure($output_type, $uid);
|
||||||
}
|
}
|
||||||
//reload Account By Auth
|
//reload Account By Auth
|
||||||
|
|||||||
@ -12,7 +12,6 @@ use Psr\Log\LoggerInterface;
|
|||||||
|
|
||||||
class AuthController extends CloudflareController
|
class AuthController extends CloudflareController
|
||||||
{
|
{
|
||||||
private $_model = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -23,47 +22,46 @@ class AuthController extends CloudflareController
|
|||||||
}
|
}
|
||||||
final protected function getModel(): AuthModel
|
final protected function getModel(): AuthModel
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
if ($this->model === null) {
|
||||||
$this->_model = new AuthModel();
|
$this->model = new AuthModel();
|
||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->model;
|
||||||
}
|
}
|
||||||
private function init(string $action): void
|
private function init(string $action, array $fields = []): void
|
||||||
{
|
{
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
$this->fields = [$this->getModel()::TITLE, 'authkey', 'status'];
|
$this->fields = count($fields) ? $fields : [$this->getModel()::TITLE, 'authkey', 'status', 'updated_at', 'created_at'];
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
$this->filter_fields = ['status'];
|
$this->filter_fields = ['status'];
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
|
$this->batchjob_fields = ['status'];
|
||||||
}
|
}
|
||||||
//생성
|
//생성
|
||||||
public function create_form(): RedirectResponse|string
|
public function create_form(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('create');
|
$this->init('create', [$this->getModel()::TITLE, 'authkey', 'status']);
|
||||||
return $this->create_form_procedure();
|
return $this->create_form_procedure();
|
||||||
}
|
}
|
||||||
public function create(): RedirectResponse|string
|
public function create(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'authkey', 'status']);
|
||||||
return $this->create_procedure();
|
return $this->create_procedure();
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
public function modify_form(int $uid): RedirectResponse|string
|
public function modify_form(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('modify');
|
$this->init('modify', [$this->getModel()::TITLE, 'authkey', 'status']);
|
||||||
return $this->modify_form_procedure($uid);
|
return $this->modify_form_procedure($uid);
|
||||||
}
|
}
|
||||||
public function modify(int $uid): RedirectResponse|string
|
public function modify(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'authkey', 'status']);
|
||||||
return $this->modify_procedure($uid);
|
return $this->modify_procedure($uid);
|
||||||
}
|
}
|
||||||
//일괄처리작업
|
//일괄처리작업
|
||||||
public function batcjob(): RedirectResponse
|
public function batcjob(): RedirectResponse
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = ['status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
return $this->batcjob_procedure();
|
return $this->batcjob_procedure();
|
||||||
}
|
}
|
||||||
//View
|
//View
|
||||||
@ -75,23 +73,13 @@ class AuthController extends CloudflareController
|
|||||||
// 리스트
|
// 리스트
|
||||||
public function index(): string
|
public function index(): string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::TITLE, 'oldkey', 'status', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = ['status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['status'];
|
|
||||||
return $this->list_procedure();
|
return $this->list_procedure();
|
||||||
}
|
}
|
||||||
// Download
|
// Download
|
||||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::TITLE, 'oldkey', 'status', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = ['status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['status'];
|
|
||||||
return $this->download_procedure($output_type, $uid);
|
return $this->download_procedure($output_type, $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,10 +26,10 @@ class RecordController extends CloudflareController
|
|||||||
}
|
}
|
||||||
final protected function getModel(): RecordModel
|
final protected function getModel(): RecordModel
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
if ($this->model === null) {
|
||||||
$this->_model = new RecordModel();
|
$this->model = new RecordModel();
|
||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->model;
|
||||||
}
|
}
|
||||||
final protected function getMyLibrary(): Record
|
final protected function getMyLibrary(): Record
|
||||||
{
|
{
|
||||||
@ -69,18 +69,21 @@ class RecordController extends CloudflareController
|
|||||||
}
|
}
|
||||||
return $formDatas;
|
return $formDatas;
|
||||||
}
|
}
|
||||||
private function init(string $action): void
|
private function init(string $action, array $fields = []): void
|
||||||
{
|
{
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
$this->fields = [$this->getModel()::PARENT, 'hosts', 'type', 'content', 'proxied'];
|
$this->fields = count($fields) ? $fields : [$this->getModel()::PARENT, 'host', 'type', 'content', 'proxied', 'updated_at', 'created_at', 'created_at'];
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
|
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied', 'fixed'];
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
|
$this->batchjob_fields = ['type', 'content', 'proxied'];
|
||||||
}
|
}
|
||||||
//생성
|
//생성
|
||||||
public function create_form(): RedirectResponse|string
|
public function create_form(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('create');
|
$this->init('create', [$this->getModel()::PARENT, 'hosts', 'type', 'content', 'proxied']);
|
||||||
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
|
//부모데이터 정의
|
||||||
$parent_field = $this->getModel()::PARENT;
|
$parent_field = $this->getModel()::PARENT;
|
||||||
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
|
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
|
||||||
return $this->create_form_procedure();
|
return $this->create_form_procedure();
|
||||||
@ -132,15 +135,13 @@ class RecordController extends CloudflareController
|
|||||||
}
|
}
|
||||||
protected function create_process_result(): RedirectResponse|string
|
protected function create_process_result(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'];
|
$this->init(__FUNCTION__);
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
return $this->view_process_result();
|
return $this->view_process_result();
|
||||||
}
|
}
|
||||||
public function create(): RedirectResponse|string
|
public function create(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, [$this->getModel()::PARENT, 'hosts', 'type', 'content', 'proxied']);
|
||||||
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
return $this->create_procedure();
|
return $this->create_procedure();
|
||||||
}
|
}
|
||||||
//수정 (modify,toggle,batchjob사용)
|
//수정 (modify,toggle,batchjob사용)
|
||||||
@ -170,16 +171,7 @@ class RecordController extends CloudflareController
|
|||||||
//일괄처리작업
|
//일괄처리작업
|
||||||
public function batcjob(): RedirectResponse
|
public function batcjob(): RedirectResponse
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
//데이터가 있는경우 Field만 처리하기위해
|
|
||||||
$fields = [];
|
|
||||||
foreach (['type', 'content', 'proxied'] as $field) {
|
|
||||||
if ($this->request->getVar($field)) {
|
|
||||||
$fields[$field] = $field;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->fields = $fields;
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
return $this->batcjob_procedure();
|
return $this->batcjob_procedure();
|
||||||
}
|
}
|
||||||
//View
|
//View
|
||||||
@ -200,11 +192,7 @@ class RecordController extends CloudflareController
|
|||||||
}
|
}
|
||||||
public function view(string $uid): RedirectResponse|string
|
public function view(string $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied', 'fixed'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
return $this->view_procedure($uid);
|
return $this->view_procedure($uid);
|
||||||
}
|
}
|
||||||
//삭제
|
//삭제
|
||||||
@ -253,23 +241,13 @@ class RecordController extends CloudflareController
|
|||||||
}
|
}
|
||||||
public function index(): string
|
public function index(): string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied', 'fixed'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['type', 'content', 'proxied'];
|
|
||||||
return $this->list_procedure();
|
return $this->list_procedure();
|
||||||
}
|
}
|
||||||
// Download
|
// Download
|
||||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['proxied'];
|
|
||||||
return $this->download_procedure($output_type, $uid);
|
return $this->download_procedure($output_type, $uid);
|
||||||
}
|
}
|
||||||
//Sync작업
|
//Sync작업
|
||||||
|
|||||||
@ -17,7 +17,6 @@ class ZoneController extends CloudflareController
|
|||||||
{
|
{
|
||||||
private $_account_entity = null;
|
private $_account_entity = null;
|
||||||
private $_myLibrays = [];
|
private $_myLibrays = [];
|
||||||
private $_model = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -28,10 +27,10 @@ class ZoneController extends CloudflareController
|
|||||||
}
|
}
|
||||||
final protected function getModel(): ZoneModel
|
final protected function getModel(): ZoneModel
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
if ($this->model === null) {
|
||||||
$this->_model = new ZoneModel();
|
$this->model = new ZoneModel();
|
||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->model;
|
||||||
}
|
}
|
||||||
final protected function getMyLibrary(): Zone
|
final protected function getMyLibrary(): Zone
|
||||||
{
|
{
|
||||||
@ -80,18 +79,23 @@ class ZoneController extends CloudflareController
|
|||||||
}
|
}
|
||||||
return $formDatas;
|
return $formDatas;
|
||||||
}
|
}
|
||||||
private function init(string $action): void
|
private function init(string $action, array $fields = []): void
|
||||||
{
|
{
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
$this->fields = [$this->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied'];
|
$this->fields = count($fields) ? $fields : [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'];
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
|
$this->filter_fields = [$this->getModel()::PARENT, 'plan', 'development_mode', 'ipv6', 'security_level'];
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
|
$this->batchjob_fields = ['development_mode', 'ipv6', 'security_level'];
|
||||||
}
|
}
|
||||||
//생성
|
//생성
|
||||||
public function create_form(): RedirectResponse|string
|
public function create_form(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('create');
|
$this->init('create', [$this->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied']);
|
||||||
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
|
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
|
||||||
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
|
//부모데이터 정의
|
||||||
$parent_field = $this->getModel()::PARENT;
|
$parent_field = $this->getModel()::PARENT;
|
||||||
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
|
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
|
||||||
return $this->create_form_procedure();
|
return $this->create_form_procedure();
|
||||||
@ -171,15 +175,15 @@ class ZoneController extends CloudflareController
|
|||||||
}
|
}
|
||||||
protected function create_process_result(): RedirectResponse|string
|
protected function create_process_result(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'];
|
$this->init(__FUNCTION__);
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
return $this->view_process_result();
|
return $this->view_process_result();
|
||||||
}
|
}
|
||||||
public function create(): RedirectResponse|string
|
public function create(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, [$this->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied']);
|
||||||
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
|
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
|
||||||
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
return $this->create_procedure();
|
return $this->create_procedure();
|
||||||
}
|
}
|
||||||
//수정 (modify,toggle,batchjob사용)
|
//수정 (modify,toggle,batchjob사용)
|
||||||
@ -201,16 +205,7 @@ class ZoneController extends CloudflareController
|
|||||||
//일괄처리작업
|
//일괄처리작업
|
||||||
public function batcjob(): RedirectResponse
|
public function batcjob(): RedirectResponse
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
//데이터가 있는경우 Field만 처리하기위해
|
|
||||||
$fields = [];
|
|
||||||
foreach (['development_mode', 'ipv6', 'security_level'] as $field) {
|
|
||||||
if ($this->request->getVar($field)) {
|
|
||||||
$fields[$field] = $field;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->fields = $fields;
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
return $this->batcjob_procedure();
|
return $this->batcjob_procedure();
|
||||||
}
|
}
|
||||||
//View
|
//View
|
||||||
@ -236,11 +231,7 @@ class ZoneController extends CloudflareController
|
|||||||
}
|
}
|
||||||
public function view(string $uid): RedirectResponse|string
|
public function view(string $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
return $this->view_procedure($uid);
|
return $this->view_procedure($uid);
|
||||||
}
|
}
|
||||||
//삭제
|
//삭제
|
||||||
@ -295,23 +286,13 @@ class ZoneController extends CloudflareController
|
|||||||
}
|
}
|
||||||
public function index(): string
|
public function index(): string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'plan', 'development_mode', 'ipv6', 'security_level'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['development_mode', 'ipv6', 'security_level'];
|
|
||||||
return $this->list_procedure();
|
return $this->list_procedure();
|
||||||
}
|
}
|
||||||
// Download
|
// Download
|
||||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'plan', 'development_mode', 'ipv6', 'security_level'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['development_mode', 'ipv6', 'security_level'];
|
|
||||||
return $this->download_procedure($output_type, $uid);
|
return $this->download_procedure($output_type, $uid);
|
||||||
}
|
}
|
||||||
//Sync작업
|
//Sync작업
|
||||||
|
|||||||
@ -13,7 +13,6 @@ use Psr\Log\LoggerInterface;
|
|||||||
|
|
||||||
class MapurlController extends AdminController
|
class MapurlController extends AdminController
|
||||||
{
|
{
|
||||||
private $_model = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -24,36 +23,19 @@ class MapurlController extends AdminController
|
|||||||
}
|
}
|
||||||
protected function getModel(): MapurlModel
|
protected function getModel(): MapurlModel
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
if ($this->model === null) {
|
||||||
$this->_model = new MapurlModel();
|
$this->model = new MapurlModel();
|
||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->model;
|
||||||
}
|
}
|
||||||
protected function getFormFieldOption(string $field, array $options = []): array
|
private function init(string $action, array $fields = []): void
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
$options = parent::getFormFieldOption($field, $options);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $options;
|
|
||||||
}
|
|
||||||
protected function getFormData(string $field, array $formDatas): array
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
$formDatas = parent::getFormData($field, $formDatas);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $formDatas;
|
|
||||||
}
|
|
||||||
private function init(string $action): void
|
|
||||||
{
|
{
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
$this->fields = [$this->getModel()::TITLE, 'newurl', 'status'];
|
$this->fields = count($fields) ? $fields : [$this->getModel()::TITLE, 'newurl', 'status', 'updated_at', 'created_at'];
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
$this->filter_fields = ['status'];
|
$this->filter_fields = ['status'];
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
|
$this->batchjob_fields = ['status'];
|
||||||
}
|
}
|
||||||
private function remaping_process(): void
|
private function remaping_process(): void
|
||||||
{
|
{
|
||||||
@ -75,7 +57,7 @@ class MapurlController extends AdminController
|
|||||||
//생성
|
//생성
|
||||||
public function create_form(): RedirectResponse|string
|
public function create_form(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('create');
|
$this->init('create', [$this->getModel()::TITLE, 'newurl', 'status']);
|
||||||
return $this->create_form_procedure();
|
return $this->create_form_procedure();
|
||||||
}
|
}
|
||||||
protected function create_process(): void
|
protected function create_process(): void
|
||||||
@ -85,13 +67,13 @@ class MapurlController extends AdminController
|
|||||||
}
|
}
|
||||||
public function create(): RedirectResponse|string
|
public function create(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'newurl', 'status']);
|
||||||
return $this->create_procedure();
|
return $this->create_procedure();
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
public function modify_form(int $uid): RedirectResponse|string
|
public function modify_form(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('modify');
|
$this->init('modify', [$this->getModel()::TITLE, 'newurl', 'status']);
|
||||||
return $this->modify_form_procedure($uid);
|
return $this->modify_form_procedure($uid);
|
||||||
}
|
}
|
||||||
//(modify,toggle,batchjob사용)
|
//(modify,toggle,batchjob사용)
|
||||||
@ -102,15 +84,13 @@ class MapurlController extends AdminController
|
|||||||
}
|
}
|
||||||
public function modify(int $uid): RedirectResponse|string
|
public function modify(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'newurl', 'status']);
|
||||||
return $this->modify_procedure($uid);
|
return $this->modify_procedure($uid);
|
||||||
}
|
}
|
||||||
//일괄처리작업
|
//일괄처리작업
|
||||||
public function batcjob(): RedirectResponse
|
public function batcjob(): RedirectResponse
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = ['status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
return $this->batcjob_procedure();
|
return $this->batcjob_procedure();
|
||||||
}
|
}
|
||||||
//View
|
//View
|
||||||
@ -128,24 +108,14 @@ class MapurlController extends AdminController
|
|||||||
// 리스트
|
// 리스트
|
||||||
public function index(): string
|
public function index(): string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::TITLE, 'newurl', 'status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = ['status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['status'];
|
|
||||||
return $this->list_procedure();
|
return $this->list_procedure();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download
|
// Download
|
||||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::TITLE, 'newurl', 'status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = ['status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['status'];
|
|
||||||
return $this->download_procedure($output_type, $uid);
|
return $this->download_procedure($output_type, $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,6 @@ use Psr\Log\LoggerInterface;
|
|||||||
|
|
||||||
class UserController extends AdminController
|
class UserController extends AdminController
|
||||||
{
|
{
|
||||||
private $_model = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -25,12 +24,12 @@ class UserController extends AdminController
|
|||||||
}
|
}
|
||||||
protected function getModel(): UserModel
|
protected function getModel(): UserModel
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
if ($this->model === null) {
|
||||||
$this->_model = new UserModel();
|
$this->model = new UserModel();
|
||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->model;
|
||||||
}
|
}
|
||||||
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
protected function setValidationRule($field, Validation $validation, string $action): Validation
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'role':
|
case 'role':
|
||||||
@ -38,20 +37,11 @@ class UserController extends AdminController
|
|||||||
$validation->setRule($field . ".*", $field, $this->getModel()->getFieldRule($action, $field));
|
$validation->setRule($field . ".*", $field, $this->getModel()->getFieldRule($action, $field));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$validation = parent::setFormFieldRule($field, $validation, $action);
|
$validation = parent::setValidationRule($field, $validation, $action);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $validation;
|
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
|
protected function getFormData(string $field, array $formDatas): array
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
@ -80,42 +70,40 @@ class UserController extends AdminController
|
|||||||
}
|
}
|
||||||
return $formDatas;
|
return $formDatas;
|
||||||
}
|
}
|
||||||
private function init(string $action): void
|
private function init(string $action, array $fields = []): void
|
||||||
{
|
{
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
$this->fields = ['id', 'passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role'];
|
$this->fields = count($fields) ? $fields : ['id', $this->getModel()::TITLE, 'email', 'mobile', 'role', 'updated_at', 'created_at'];
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = ['role', 'status'];
|
$this->filter_fields = ['role', 'status'];
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
|
$this->batchjob_fields = ['status'];
|
||||||
}
|
}
|
||||||
//생성
|
//생성
|
||||||
public function create_form(): RedirectResponse|string
|
public function create_form(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('create');
|
$this->init('create', ['id', 'passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role']);
|
||||||
return $this->create_form_procedure();
|
return $this->create_form_procedure();
|
||||||
}
|
}
|
||||||
public function create(): RedirectResponse|string
|
public function create(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, ['id', 'passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role']);
|
||||||
return $this->create_procedure();
|
return $this->create_procedure();
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
public function modify_form(int $uid): RedirectResponse|string
|
public function modify_form(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('modify');
|
$this->init('modify', ['passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role']);
|
||||||
return $this->modify_form_procedure($uid);
|
return $this->modify_form_procedure($uid);
|
||||||
}
|
}
|
||||||
public function modify(int $uid): RedirectResponse|string
|
public function modify(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, ['passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role']);
|
||||||
return $this->modify_procedure($uid);
|
return $this->modify_procedure($uid);
|
||||||
}
|
}
|
||||||
//일괄작업
|
//일괄작업
|
||||||
public function batcjob(): RedirectResponse
|
public function batcjob(): RedirectResponse
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = ['status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
return $this->batcjob_procedure();
|
return $this->batcjob_procedure();
|
||||||
}
|
}
|
||||||
//View
|
//View
|
||||||
@ -127,23 +115,13 @@ class UserController extends AdminController
|
|||||||
// 리스트
|
// 리스트
|
||||||
public function index(): string
|
public function index(): string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = ['id', $this->getModel()::TITLE, 'email', 'mobile', 'role', 'status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = ['role', 'status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['status'];
|
|
||||||
return $this->list_procedure();
|
return $this->list_procedure();
|
||||||
}
|
}
|
||||||
// Download
|
// Download
|
||||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = ['id', $this->getModel()::TITLE, 'email', 'mobile', 'role', 'status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = ['role', 'status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = ['status'];
|
|
||||||
return $this->download_procedure($output_type, $uid);
|
return $this->download_procedure($output_type, $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,6 @@ use Psr\Log\LoggerInterface;
|
|||||||
|
|
||||||
class UserSNSController extends AdminController
|
class UserSNSController extends AdminController
|
||||||
{
|
{
|
||||||
private $_model = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -26,19 +25,10 @@ class UserSNSController extends AdminController
|
|||||||
}
|
}
|
||||||
protected function getModel(): UserSNSModel
|
protected function getModel(): UserSNSModel
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
if ($this->model === null) {
|
||||||
$this->_model = new UserSNSModel();
|
$this->model = new UserSNSModel();
|
||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->model;
|
||||||
}
|
|
||||||
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
$validation = parent::setFormFieldRule($field, $validation, $action);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $validation;
|
|
||||||
}
|
}
|
||||||
protected function getFormFieldOption(string $field, array $options = []): array
|
protected function getFormFieldOption(string $field, array $options = []): array
|
||||||
{
|
{
|
||||||
@ -56,62 +46,42 @@ class UserSNSController extends AdminController
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
protected function getFormData(string $field, array $formDatas): array
|
private function init(string $action, array $fields = []): void
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
$formDatas = parent::getFormData($field, $formDatas);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $formDatas;
|
|
||||||
}
|
|
||||||
private function init(string $action): void
|
|
||||||
{
|
{
|
||||||
$this->action = $action;
|
$this->action = $action;
|
||||||
$this->fields = [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email'];
|
$this->fields = count($fields) ? $fields : [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email', 'updated_at', 'created_at'];
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'status'];
|
$this->filter_fields = [$this->getModel()::PARENT, 'status'];
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
|
$this->batchjob_fields = [];
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
public function modify_form(int $uid): RedirectResponse|string
|
public function modify_form(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('modify');
|
$this->init('modify', [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email']);
|
||||||
return $this->modify_form_procedure($uid);
|
return $this->modify_form_procedure($uid);
|
||||||
}
|
}
|
||||||
public function modify(int $uid): RedirectResponse|string
|
public function modify(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init(__FUNCTION__);
|
$this->init(__FUNCTION__, [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email']);
|
||||||
return $this->modify_procedure($uid);
|
return $this->modify_procedure($uid);
|
||||||
}
|
}
|
||||||
//일괄작업
|
//일괄작업
|
||||||
public function batcjob(): RedirectResponse
|
public function batcjob(): RedirectResponse
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = ['status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
return $this->batcjob_procedure();
|
return $this->batcjob_procedure();
|
||||||
}
|
}
|
||||||
// 리스트
|
// 리스트
|
||||||
public function index(): string
|
public function index(): string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email', 'status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = [];
|
|
||||||
return $this->list_procedure();
|
return $this->list_procedure();
|
||||||
}
|
}
|
||||||
// Download
|
// Download
|
||||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||||
{
|
{
|
||||||
$this->action = __FUNCTION__;
|
$this->init(__FUNCTION__);
|
||||||
$this->fields = [$this->getModel()::PARENT, 'site', 'id', $this->getModel()::TITLE, 'email', 'status'];
|
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
$this->filter_fields = [$this->getModel()::PARENT, 'status'];
|
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
|
||||||
$this->batchjob_fields = [];
|
|
||||||
return $this->download_procedure($output_type, $uid);
|
return $this->download_procedure($output_type, $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ abstract class MVController extends CommonController
|
|||||||
}
|
}
|
||||||
abstract protected function getModel(): mixed;
|
abstract protected function getModel(): mixed;
|
||||||
//Field별 Form Rule용
|
//Field별 Form Rule용
|
||||||
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
protected function setValidationRule($field, Validation $validation, string $action): Validation
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
default:
|
default:
|
||||||
@ -30,10 +30,10 @@ abstract class MVController extends CommonController
|
|||||||
}
|
}
|
||||||
return $validation;
|
return $validation;
|
||||||
}
|
}
|
||||||
final protected function setFormFieldRules(array $fields, Validation $validation, string $action): Validation
|
final protected function getValidation(array $fields, Validation $validation, string $action): Validation
|
||||||
{
|
{
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$validation = $this->setFormFieldRule($field, $validation, $action);
|
$validation = $this->setValidationRule($field, $validation, $action);
|
||||||
}
|
}
|
||||||
return $validation;
|
return $validation;
|
||||||
}
|
}
|
||||||
@ -96,11 +96,11 @@ abstract class MVController extends CommonController
|
|||||||
protected function create_validate(string $action, array $fields): void
|
protected function create_validate(string $action, array $fields): void
|
||||||
{
|
{
|
||||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
|
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
|
||||||
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
$validation = $this->getValidation($fields, service('validation'), $action);
|
||||||
if (!$this->validation->withRequest($this->request)->run()) {
|
if (!$validation->withRequest($this->request)->run()) {
|
||||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
||||||
"\n",
|
"\n",
|
||||||
$this->validation->getErrors()
|
$validation->getErrors()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ abstract class MVController extends CommonController
|
|||||||
}
|
}
|
||||||
protected function create_process_result(): RedirectResponse|string
|
protected function create_process_result(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$url = strtolower(base_url() . $this->uri_path . "/" . $this->class_path . "/view/" . $this->entity->getPK());
|
$url = strtolower(base_url() . $this->uri_path . $this->class_name) . "/view/" . $this->entity->getPK();
|
||||||
return redirect()->to($url)->with('error', $this->message);
|
return redirect()->to($url)->with('error', $this->message);
|
||||||
}
|
}
|
||||||
final protected function create_procedure(): RedirectResponse|string
|
final protected function create_procedure(): RedirectResponse|string
|
||||||
@ -156,14 +156,14 @@ abstract class MVController extends CommonController
|
|||||||
return redirect()->back()->with('error', $e->getMessage());
|
return redirect()->back()->with('error', $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected function modify_validate(string $action, array $fields): void
|
final protected function modify_validate(string $action, array $fields): void
|
||||||
{
|
{
|
||||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
||||||
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
$validation = $this->getValidation($fields, service('validation'), $action);
|
||||||
if (!$this->validation->withRequest($this->request)->run()) {
|
if (!$validation->withRequest($this->request)->run()) {
|
||||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
||||||
"\n",
|
"\n",
|
||||||
$this->validation->getErrors()
|
$validation->getErrors()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ abstract class MVController extends CommonController
|
|||||||
}
|
}
|
||||||
protected function modify_process_result(): RedirectResponse|string
|
protected function modify_process_result(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$url = strtolower(base_url() . $this->uri_path . "/" . $this->class_path . "/view/" . $this->entity->getPK());
|
$url = strtolower(base_url() . $this->uri_path . $this->class_name) . "/view/" . $this->entity->getPK();
|
||||||
return redirect()->to($url)->with('error', $this->message);
|
return redirect()->to($url)->with('error', $this->message);
|
||||||
}
|
}
|
||||||
final protected function modify_procedure(mixed $uid): RedirectResponse|string
|
final protected function modify_procedure(mixed $uid): RedirectResponse|string
|
||||||
@ -207,6 +207,14 @@ abstract class MVController extends CommonController
|
|||||||
//Transaction Start
|
//Transaction Start
|
||||||
$this->getModel()->transStart();
|
$this->getModel()->transStart();
|
||||||
try {
|
try {
|
||||||
|
//데이터가 있는경우 Field만 처리하기위해
|
||||||
|
$fields = [];
|
||||||
|
foreach ($this->batchjob_fields as $field) {
|
||||||
|
if ($this->request->getVar($field)) {
|
||||||
|
$fields[$field] = $field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->fields = $fields;
|
||||||
//변경할 UIDS
|
//변경할 UIDS
|
||||||
$uids = $this->request->getVar('batchjob_uids');
|
$uids = $this->request->getVar('batchjob_uids');
|
||||||
if (!$uids) {
|
if (!$uids) {
|
||||||
|
|||||||
@ -11,12 +11,10 @@ use CodeIgniter\HTTP\RedirectResponse;
|
|||||||
|
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use CodeIgniter\Validation\Validation;
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class UserController extends FrontController
|
class UserController extends FrontController
|
||||||
{
|
{
|
||||||
private $_model = null;
|
|
||||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
@ -27,61 +25,21 @@ class UserController extends FrontController
|
|||||||
}
|
}
|
||||||
protected function getModel(): UserModel
|
protected function getModel(): UserModel
|
||||||
{
|
{
|
||||||
if ($this->_model === null) {
|
if ($this->model === null) {
|
||||||
$this->_model = new UserModel();
|
$this->model = new UserModel();
|
||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->model;
|
||||||
}
|
}
|
||||||
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
private function init(string $action, array $fields = []): void
|
||||||
{
|
|
||||||
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->action = $action;
|
||||||
$this->fields = ['id', 'passwd'];
|
$this->fields = count($fields) ? $fields : ['id', 'passwd'];
|
||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
|
||||||
}
|
}
|
||||||
//로그인화면
|
//로그인화면
|
||||||
public function login_form(): RedirectResponse|string
|
public function login_form(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('login');
|
|
||||||
try {
|
try {
|
||||||
|
$this->init('login');
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
//구글 로그인 BUTTON용
|
//구글 로그인 BUTTON용
|
||||||
$google_socket = new GoogleSocket();
|
$google_socket = new GoogleSocket();
|
||||||
@ -99,8 +57,8 @@ class UserController extends FrontController
|
|||||||
//로그인처리
|
//로그인처리
|
||||||
public function login(): RedirectResponse|string
|
public function login(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('login');
|
|
||||||
try {
|
try {
|
||||||
|
$this->init('login');
|
||||||
$this->create_validate($this->action, $this->fields);
|
$this->create_validate($this->action, $this->fields);
|
||||||
$this->formDatas = $this->getFormDatas();
|
$this->formDatas = $this->getFormDatas();
|
||||||
$auth = new LocalAuth();
|
$auth = new LocalAuth();
|
||||||
@ -116,7 +74,6 @@ class UserController extends FrontController
|
|||||||
}
|
}
|
||||||
public function google_login(): RedirectResponse|string
|
public function google_login(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('login');
|
|
||||||
try {
|
try {
|
||||||
$access_code = $this->request->getVar('code');
|
$access_code = $this->request->getVar('code');
|
||||||
if (!$access_code) {
|
if (!$access_code) {
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Cloudflare;
|
namespace App\Helpers\Cloudflare;
|
||||||
|
|
||||||
use App\Helpers\CommonHelper;
|
use App\Helpers\MVCHelper;
|
||||||
use App\Models\Cloudflare\AccountModel;
|
use App\Models\Cloudflare\AccountModel;
|
||||||
|
|
||||||
class AccountHelper extends CommonHelper
|
class AccountHelper extends MVCHelper
|
||||||
{
|
{
|
||||||
public $old_parent = "";
|
public $old_parent = "";
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -14,6 +14,9 @@ class AccountHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||||
|
$extras = (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||||
|
}
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case AccountModel::PARENT:
|
case AccountModel::PARENT:
|
||||||
@ -77,7 +80,7 @@ class AccountHelper extends CommonHelper
|
|||||||
"class" => "btn btn-sm btn-primary btn-circle",
|
"class" => "btn btn-sm btn-primary btn-circle",
|
||||||
"target" => "_self",
|
"target" => "_self",
|
||||||
]
|
]
|
||||||
) . " <span class=\"label_Accounts\">{$value}</span>";
|
) . " " . parent::getFieldView($field, $viewDatas, $extras);
|
||||||
break;
|
break;
|
||||||
case 'type':
|
case 'type':
|
||||||
case 'status':
|
case 'status':
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Cloudflare;
|
namespace App\Helpers\Cloudflare;
|
||||||
|
|
||||||
use App\Helpers\CommonHelper;
|
use App\Helpers\MVCHelper;
|
||||||
use App\Models\Cloudflare\AuthModel;
|
use App\Models\Cloudflare\AuthModel;
|
||||||
|
|
||||||
class AuthHelper extends CommonHelper
|
class AuthHelper extends MVCHelper
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -13,6 +13,9 @@ class AuthHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||||
|
$extras = (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||||
|
}
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case AuthModel::TITLE:
|
case AuthModel::TITLE:
|
||||||
@ -44,7 +47,7 @@ class AuthHelper extends CommonHelper
|
|||||||
"class" => "btn btn-sm btn-primary btn-circle",
|
"class" => "btn btn-sm btn-primary btn-circle",
|
||||||
"target" => "_self"
|
"target" => "_self"
|
||||||
]
|
]
|
||||||
) . " <span class=\"label_Auths\">{$value}</span>";
|
) . " " . parent::getFieldView($field, $viewDatas, $extras);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Cloudflare;
|
namespace App\Helpers\Cloudflare;
|
||||||
|
|
||||||
use App\Helpers\CommonHelper;
|
use App\Helpers\MVCHelper;
|
||||||
use App\Models\Cloudflare\RecordModel;
|
use App\Models\Cloudflare\RecordModel;
|
||||||
|
|
||||||
class RecordHelper extends CommonHelper
|
class RecordHelper extends MVCHelper
|
||||||
{
|
{
|
||||||
public $old_parent = "";
|
public $old_parent = "";
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -27,6 +27,9 @@ class RecordHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||||
|
$extras = (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||||
|
}
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case RecordModel::PARENT:
|
case RecordModel::PARENT:
|
||||||
@ -80,15 +83,22 @@ class RecordHelper extends CommonHelper
|
|||||||
"class" => "btn btn-sm btn-primary btn-circle",
|
"class" => "btn btn-sm btn-primary btn-circle",
|
||||||
"target" => "_self",
|
"target" => "_self",
|
||||||
]
|
]
|
||||||
) . " " . "<span class=\"label_zones\">{$viewDatas['field_options'][$field][$value]}</span>";
|
) . " " . form_label(
|
||||||
|
$viewDatas['field_options'][$field][$value],
|
||||||
|
'label_zones',
|
||||||
|
$extras
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->old_parent = $viewDatas['entity']->getParent();
|
$this->old_parent = $viewDatas['entity']->getParent();
|
||||||
break;
|
break;
|
||||||
case RecordModel::TITLE:
|
case RecordModel::TITLE:
|
||||||
$url = sprintf("%s/toggle/%s/fixed?fixed=%s", current_url(), $viewDatas['entity']->getPK(), $viewDatas['entity']->fixed == 'on' ? "off" : "on");
|
$value = parent::getFieldView($field, $viewDatas, ['class' => "label_hosts", ...$extras]);
|
||||||
$fixed = $viewDatas['entity']->fixed == 'on' ? "<span class=\"text-danger\">" . ICONS['LOCK'] . "</span>" : "";
|
$fixed = anchor(
|
||||||
$value = sprintf("%s<span class=\"label_hosts\" style=\"font-weight:bold;\">%s</span>", $fixed, $value);
|
sprintf("%s/toggle/%s/fixed?fixed=%s", current_url(), $viewDatas['entity']->getPK(), $viewDatas['entity']->fixed == 'on' ? "off" : "on"),
|
||||||
$value = anchor($url, $value, ["target" => "_self"]);
|
$viewDatas['entity']->fixed == 'on' ? "<span class=\"text-danger\">" . ICONS['LOCK'] . "</span>" : ICONS['UNLOCK'],
|
||||||
|
["class" => "ext-danger", "style" => "float:right;", ...$extras]
|
||||||
|
);
|
||||||
|
$value = $fixed . " " . $value;
|
||||||
break;
|
break;
|
||||||
case 'content':
|
case 'content':
|
||||||
// 값이 40자 이상인 경우 자르고 '...' 추가
|
// 값이 40자 이상인 경우 자르고 '...' 추가
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Cloudflare;
|
namespace App\Helpers\Cloudflare;
|
||||||
|
|
||||||
use App\Helpers\CommonHelper;
|
use App\Helpers\MVCHelper;
|
||||||
use App\Models\Cloudflare\ZoneModel;
|
use App\Models\Cloudflare\ZoneModel;
|
||||||
|
|
||||||
class ZoneHelper extends CommonHelper
|
class ZoneHelper extends MVCHelper
|
||||||
{
|
{
|
||||||
public $old_parent = "";
|
public $old_parent = "";
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -14,6 +14,9 @@ class ZoneHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||||
|
$extras = (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||||
|
}
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case ZoneModel::PARENT:
|
case ZoneModel::PARENT:
|
||||||
@ -98,7 +101,7 @@ class ZoneHelper extends CommonHelper
|
|||||||
"class" => "btn btn-sm btn-primary btn-circle",
|
"class" => "btn btn-sm btn-primary btn-circle",
|
||||||
"target" => "_self"
|
"target" => "_self"
|
||||||
]
|
]
|
||||||
) . " <span class=\"label_zones\" style=\"font-weight:bold;\"><b>{$value}</b></span>";
|
) . " " . parent::getFieldView($field, $viewDatas, ['class' => "label_zones", ...$extras]);
|
||||||
break;
|
break;
|
||||||
case 'name_servers':
|
case 'name_servers':
|
||||||
case 'original_name_servers':
|
case 'original_name_servers':
|
||||||
|
|||||||
@ -128,154 +128,4 @@ class CommonHelper
|
|||||||
}
|
}
|
||||||
return "<script type=\"text/javascript\">{$msg}</script>";
|
return "<script type=\"text/javascript\">{$msg}</script>";
|
||||||
} //
|
} //
|
||||||
|
|
||||||
public function getFieldLabel(string $field, array $viewDatas, array $extras = []): string
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
if (strpos($viewDatas['field_rules'][$field], 'required') !== false) {
|
|
||||||
$extras = ["class" => "text-danger ", ...$extras];
|
|
||||||
}
|
|
||||||
$label = form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $label;
|
|
||||||
}
|
|
||||||
//header.php에서 getFieldForm_Helper사용
|
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
|
||||||
{
|
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
|
||||||
switch ($field) {
|
|
||||||
case 'status':
|
|
||||||
$form = form_dropdown($field, [
|
|
||||||
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
|
|
||||||
] + $viewDatas['field_options'][$field], $value, $extras);
|
|
||||||
break;
|
|
||||||
case 'updated_at':
|
|
||||||
case 'created_at':
|
|
||||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
|
||||||
$form = form_input($field, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$form = form_input($field, $value, ["autocomplete" => $field, ...$extras]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $form;
|
|
||||||
} //
|
|
||||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
|
||||||
{
|
|
||||||
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
|
|
||||||
switch ($field) {
|
|
||||||
case 'category_uid':
|
|
||||||
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) {
|
|
||||||
foreach ($category_2depths as $key => $depth) {
|
|
||||||
if ($key == $depth) {
|
|
||||||
$value = $depth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'updated_at':
|
|
||||||
case 'created_at':
|
|
||||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (in_array($field, $viewDatas['filter_fields'])) {
|
|
||||||
$extras["onChange"] = sprintf(
|
|
||||||
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
|
|
||||||
current_url(),
|
|
||||||
$viewDatas['entity']->getPK(),
|
|
||||||
$field,
|
|
||||||
$field
|
|
||||||
);
|
|
||||||
$value = $this->getFieldForm($field, $viewDatas['entity']->$field, $viewDatas, $extras);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
} //
|
|
||||||
public function getListRowColor($entity): string
|
|
||||||
{
|
|
||||||
return $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger"' : "";
|
|
||||||
}
|
|
||||||
public function getListLabel(string $field, array $viewDatas, array $extras = []): string
|
|
||||||
{
|
|
||||||
switch ($field) {
|
|
||||||
default:
|
|
||||||
$label = $this->getFieldLabel($field, $viewDatas, $extras);
|
|
||||||
if (isset($viewDatas['order_field']) && $viewDatas['order_field'] == $field) {
|
|
||||||
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
|
|
||||||
}
|
|
||||||
$query = $viewDatas['uri']->getQuery(['except' => ['order_field', 'order_value']]);
|
|
||||||
$query .= empty($query) ? "" : "&";
|
|
||||||
$query .= "order_field={$field}&order_value=";
|
|
||||||
$query .= isset($viewDatas['order_value']) && $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
|
|
||||||
$label = anchor(current_url() . "?" . $query, $label);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $label;
|
|
||||||
}
|
|
||||||
public function getListButton(string $action, array $viewDatas, array $extras = []): string
|
|
||||||
{
|
|
||||||
switch ($action) {
|
|
||||||
case 'create':
|
|
||||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
|
||||||
$action = form_label(
|
|
||||||
'입력',
|
|
||||||
$action,
|
|
||||||
[
|
|
||||||
"data-src" => current_url() . '/' . $action,
|
|
||||||
"data-bs-toggle" => "modal",
|
|
||||||
"data-bs-target" => "#index_action_form",
|
|
||||||
...$extras
|
|
||||||
]
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'modify':
|
|
||||||
$pk = $viewDatas['entity']->getPK();
|
|
||||||
$oldBatchJobUids = old("batchjob_uids", null);
|
|
||||||
$oldBatchJobUids = is_array($oldBatchJobUids) ? $oldBatchJobUids : [$oldBatchJobUids];
|
|
||||||
$checkbox = form_checkbox([
|
|
||||||
"id" => "checkbox_uid_{$pk}",
|
|
||||||
"name" => "batchjob_uids[]",
|
|
||||||
"value" => $pk,
|
|
||||||
"class" => "batchjobuids_checkboxs",
|
|
||||||
"checked" => in_array($pk, $oldBatchJobUids)
|
|
||||||
]);
|
|
||||||
$action = $checkbox . form_label(
|
|
||||||
$viewDatas['cnt'],
|
|
||||||
$action,
|
|
||||||
[
|
|
||||||
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
|
|
||||||
"data-bs-toggle" => "modal",
|
|
||||||
"data-bs-target" => "#index_action_form",
|
|
||||||
...$extras
|
|
||||||
]
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'delete':
|
|
||||||
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
|
|
||||||
$action = anchor(
|
|
||||||
current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
|
|
||||||
ICONS['DELETE'],
|
|
||||||
$extras
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'batchjob':
|
|
||||||
$action = form_submit("batchjob_submit", '일괄처리', [
|
|
||||||
"formaction" => current_url() . '/batchjob',
|
|
||||||
"class" => "btn btn-outline btn-warning",
|
|
||||||
"onclick" => "return submitBatchJob()"
|
|
||||||
]);
|
|
||||||
break;
|
|
||||||
case 'batchjob_delete':
|
|
||||||
$action = form_submit("batchjob_submit", '일괄삭제', [
|
|
||||||
"formaction" => current_url() . '/batchjob_delete',
|
|
||||||
"class" => "btn btn-outline btn-danger",
|
|
||||||
"onclick" => "return submitBatchJobDelete()"
|
|
||||||
]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return $action;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
176
app/Helpers/MVCHelper.php
Normal file
176
app/Helpers/MVCHelper.php
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
abstract class MVCHelper extends CommonHelper
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function getFieldLabel(string $field, array $viewDatas, array $extras = []): string
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
default:
|
||||||
|
if (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) {
|
||||||
|
$extras = ["class" => "text-danger ", ...$extras];
|
||||||
|
}
|
||||||
|
$label = form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $label;
|
||||||
|
}
|
||||||
|
//header.php에서 getFieldForm_Helper사용
|
||||||
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
|
{
|
||||||
|
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||||
|
$extras = (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||||
|
}
|
||||||
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
|
switch ($field) {
|
||||||
|
case 'status':
|
||||||
|
$form = form_dropdown($field, [
|
||||||
|
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
|
||||||
|
] + $viewDatas['field_options'][$field], $value, $extras);
|
||||||
|
break;
|
||||||
|
case 'updated_at':
|
||||||
|
case 'created_at':
|
||||||
|
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
||||||
|
$form = form_input($field, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$form = form_input($field, $value, ["autocomplete" => $field, ...$extras]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $form;
|
||||||
|
} //
|
||||||
|
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||||
|
{
|
||||||
|
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
|
||||||
|
switch ($field) {
|
||||||
|
case $viewDatas['model']::TITLE:
|
||||||
|
$value = form_label(
|
||||||
|
$value,
|
||||||
|
'view',
|
||||||
|
[
|
||||||
|
"data-src" => current_url() . '/view/' . $viewDatas['entity']->getPK(),
|
||||||
|
"data-bs-toggle" => "modal",
|
||||||
|
"data-bs-target" => "#index_action_form",
|
||||||
|
"style" => "color: blue; cursor: pointer; font-weight:bold;",
|
||||||
|
...$extras,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'category_uid':
|
||||||
|
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) {
|
||||||
|
foreach ($category_2depths as $key => $depth) {
|
||||||
|
if ($key == $depth) {
|
||||||
|
$value = $depth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'updated_at':
|
||||||
|
case 'created_at':
|
||||||
|
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (in_array($field, $viewDatas['filter_fields'])) {
|
||||||
|
$extras["onChange"] = sprintf(
|
||||||
|
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
|
||||||
|
current_url(),
|
||||||
|
$viewDatas['entity']->getPK(),
|
||||||
|
$field,
|
||||||
|
$field
|
||||||
|
);
|
||||||
|
$value = $this->getFieldForm($field, $viewDatas['entity']->$field, $viewDatas, $extras);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
} //
|
||||||
|
public function getListRowColor($entity): string
|
||||||
|
{
|
||||||
|
return $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger"' : "";
|
||||||
|
}
|
||||||
|
public function getListLabel(string $field, array $viewDatas, array $extras = []): string
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
default:
|
||||||
|
$label = $this->getFieldLabel($field, $viewDatas, $extras);
|
||||||
|
if (isset($viewDatas['order_field']) && $viewDatas['order_field'] == $field) {
|
||||||
|
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
|
||||||
|
}
|
||||||
|
$query = $viewDatas['uri']->getQuery(['except' => ['order_field', 'order_value']]);
|
||||||
|
$query .= empty($query) ? "" : "&";
|
||||||
|
$query .= "order_field={$field}&order_value=";
|
||||||
|
$query .= isset($viewDatas['order_value']) && $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
|
||||||
|
$label = anchor(current_url() . "?" . $query, $label);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $label;
|
||||||
|
}
|
||||||
|
public function getListButton(string $action, array $viewDatas, array $extras = []): string
|
||||||
|
{
|
||||||
|
switch ($action) {
|
||||||
|
case 'create':
|
||||||
|
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||||
|
$action = form_label(
|
||||||
|
'입력',
|
||||||
|
$action,
|
||||||
|
[
|
||||||
|
"data-src" => current_url() . '/' . $action,
|
||||||
|
"data-bs-toggle" => "modal",
|
||||||
|
"data-bs-target" => "#index_action_form",
|
||||||
|
...$extras
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'modify':
|
||||||
|
$pk = $viewDatas['entity']->getPK();
|
||||||
|
$oldBatchJobUids = old("batchjob_uids", null);
|
||||||
|
$oldBatchJobUids = is_array($oldBatchJobUids) ? $oldBatchJobUids : [$oldBatchJobUids];
|
||||||
|
$checkbox = form_checkbox([
|
||||||
|
"id" => "checkbox_uid_{$pk}",
|
||||||
|
"name" => "batchjob_uids[]",
|
||||||
|
"value" => $pk,
|
||||||
|
"class" => "batchjobuids_checkboxs",
|
||||||
|
"checked" => in_array($pk, $oldBatchJobUids)
|
||||||
|
]);
|
||||||
|
$action = $checkbox . form_label(
|
||||||
|
$viewDatas['cnt'],
|
||||||
|
$action,
|
||||||
|
[
|
||||||
|
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
|
||||||
|
"data-bs-toggle" => "modal",
|
||||||
|
"data-bs-target" => "#index_action_form",
|
||||||
|
...$extras
|
||||||
|
]
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
|
||||||
|
$action = anchor(
|
||||||
|
current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
|
||||||
|
ICONS['DELETE'],
|
||||||
|
$extras
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'batchjob':
|
||||||
|
$action = form_submit("batchjob_submit", '일괄처리', [
|
||||||
|
"formaction" => current_url() . '/batchjob',
|
||||||
|
"class" => "btn btn-outline btn-warning",
|
||||||
|
"onclick" => "return submitBatchJob()"
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
case 'batchjob_delete':
|
||||||
|
$action = form_submit("batchjob_submit", '일괄삭제', [
|
||||||
|
"formaction" => current_url() . '/batchjob_delete',
|
||||||
|
"class" => "btn btn-outline btn-danger",
|
||||||
|
"onclick" => "return submitBatchJobDelete()"
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $action;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,7 +4,7 @@ namespace App\Helpers;
|
|||||||
|
|
||||||
use App\Models\MapurlModel;
|
use App\Models\MapurlModel;
|
||||||
|
|
||||||
class MapurlHelper extends CommonHelper
|
class MapurlHelper extends MVCHelper
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -12,6 +12,9 @@ class MapurlHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||||
|
$extras = (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||||
|
}
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case MapurlModel::TITLE:
|
case MapurlModel::TITLE:
|
||||||
|
|||||||
@ -4,7 +4,7 @@ namespace App\Helpers;
|
|||||||
|
|
||||||
use App\Models\UserModel;
|
use App\Models\UserModel;
|
||||||
|
|
||||||
class UserHelper extends CommonHelper
|
class UserHelper extends MVCHelper
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -12,6 +12,9 @@ class UserHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||||
|
$extras = (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||||
|
}
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'id':
|
case 'id':
|
||||||
|
|||||||
@ -4,7 +4,7 @@ namespace App\Helpers;
|
|||||||
|
|
||||||
use App\Models\UserSNSModel;
|
use App\Models\UserSNSModel;
|
||||||
|
|
||||||
class UserSNSHelper extends CommonHelper
|
class UserSNSHelper extends MVCHelper
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -12,6 +12,9 @@ class UserSNSHelper extends CommonHelper
|
|||||||
}
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
|
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||||
|
$extras = (strpos($viewDatas['model']->getFieldRule($viewDatas['action'], $field), 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||||
|
}
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case UserSNSModel::PARENT:
|
case UserSNSModel::PARENT:
|
||||||
|
|||||||
@ -10,8 +10,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||||
<td nowrap class="text-start">
|
<td nowrap class="text-start">
|
||||||
<?php $extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => ""] : ["class" => "form-control"]; ?>
|
<?= $viewDatas['helper']->getFieldForm($field, old($field), $viewDatas) ?>
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field), $viewDatas, $extras) ?>
|
|
||||||
<div><?= validation_show_error($field); ?></div>
|
<div><?= validation_show_error($field); ?></div>
|
||||||
</td>
|
</td>
|
||||||
<?php $cnt++ ?>
|
<?php $cnt++ ?>
|
||||||
|
|||||||
@ -17,14 +17,12 @@
|
|||||||
<link href="/css/<?= $viewDatas['layout'] ?>/resizeTable.css" media="screen" rel="stylesheet" type="text/css" />
|
<link href="/css/<?= $viewDatas['layout'] ?>/resizeTable.css" media="screen" rel="stylesheet" type="text/css" />
|
||||||
<div class="index_body">
|
<div class="index_body">
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
|
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
|
||||||
<table class="index_table data table table-bordered table-hover table-striped"
|
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||||
data-rtc-resizable-table="reisze_table">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="index_head_short_column">번호</th>
|
<th class="index_head_short_column">번호</th>
|
||||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?>
|
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?></th>
|
||||||
</th>
|
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<th class="index_head_short_column">작업</th>
|
<th class="index_head_short_column">작업</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -35,23 +33,19 @@
|
|||||||
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
|
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
|
||||||
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
|
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
|
||||||
<?php $viewDatas['entity'] = $entity; ?>
|
<?php $viewDatas['entity'] = $entity; ?>
|
||||||
<td>
|
<th><?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?></th>
|
||||||
<?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?>
|
|
||||||
</td>
|
|
||||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||||
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
|
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<td>
|
<th><?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?></th>
|
||||||
<?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php $cnt++ ?>
|
<?php $cnt++ ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_batchjob"); ?>
|
<?= $this->include("templates/{$viewDatas['layout']}/index_content_batchjob"); ?>
|
||||||
|
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
|
||||||
<div class="index_bottom"><?= $this->include("templates/common/modal_fetch"); ?></div>
|
<div class="index_bottom"><?= $this->include("templates/common/modal_fetch"); ?></div>
|
||||||
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/resizeTable.js"></script>
|
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/resizeTable.js"></script>
|
||||||
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
|
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
|
||||||
|
|||||||
@ -10,8 +10,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||||
<td nowrap class="text-start">
|
<td nowrap class="text-start">
|
||||||
<?php $extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => ""] : ["class" => "form-control"]; ?>
|
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field, $viewDatas) ?>
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field, $viewDatas, $extras) ?>
|
|
||||||
<div><?= validation_show_error($field); ?></div>
|
<div><?= validation_show_error($field); ?></div>
|
||||||
</td>
|
</td>
|
||||||
<?php $cnt++ ?>
|
<?php $cnt++ ?>
|
||||||
|
|||||||
@ -93,6 +93,11 @@ table.index_table thead th:active {
|
|||||||
cursor: grabbing;
|
cursor: grabbing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.index_table tbody th {
|
||||||
|
text-align: center;
|
||||||
|
/* border:1px solid silver; */
|
||||||
|
}
|
||||||
|
|
||||||
div.index_batchjob {
|
div.index_batchjob {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@ -93,12 +93,22 @@ table.index_table thead th:active {
|
|||||||
cursor: grabbing;
|
cursor: grabbing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.index_table tbody th {
|
||||||
|
text-align: center;
|
||||||
|
/* border:1px solid silver; */
|
||||||
|
}
|
||||||
|
|
||||||
div.index_batchjob {
|
div.index_batchjob {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
/* border: 1px solid red; */
|
/* border: 1px solid red; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.index_batchjob ul.nav li.nav-item {
|
||||||
|
margin-left: 10px;
|
||||||
|
/* border: 1px solid red; */
|
||||||
|
}
|
||||||
|
|
||||||
div.index_pagination {
|
div.index_pagination {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
/* border: 1px solid red; */
|
/* border: 1px solid red; */
|
||||||
@ -115,7 +125,8 @@ div.index_pagination ul.pagination {
|
|||||||
/* 기본 점 스타일 제거 (옵션) */
|
/* 기본 점 스타일 제거 (옵션) */
|
||||||
}
|
}
|
||||||
|
|
||||||
div.index_pagination ul.pagination li {
|
/* pager의 template가 default_full일경우 사용 */
|
||||||
|
/* div.index_pagination ul.pagination li {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +144,7 @@ div.index_pagination ul.pagination li a:hover {
|
|||||||
div.index_pagination ul.pagination li.active a {
|
div.index_pagination ul.pagination li.active a {
|
||||||
color: black;
|
color: black;
|
||||||
border: 1px solid #808080;
|
border: 1px solid #808080;
|
||||||
}
|
} */
|
||||||
|
|
||||||
div.index_bottom {
|
div.index_bottom {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user