cfmgrv4 init...4

This commit is contained in:
최준흠 2024-09-30 19:25:19 +09:00
parent 356b10231c
commit 6dd668629d
36 changed files with 486 additions and 371 deletions

View File

@ -161,9 +161,9 @@ define('ICONS', [
'LOGOUT' => '<i class="bi bi-sign-stop-fill"></i>', 'LOGOUT' => '<i class="bi bi-sign-stop-fill"></i>',
'HOME' => '<i class="bi bi-house"></i>', 'HOME' => '<i class="bi bi-house"></i>',
'MENU' => '<i class="bi bi-menu-button"></i>', 'MENU' => '<i class="bi bi-menu-button"></i>',
'LOCK' => '<i class="bi bi-shield-lock"></i>',
'NEW' => '<i class="bi bi-database-add"></i>', 'NEW' => '<i class="bi bi-database-add"></i>',
'REPLY' => '<i class="bi bi-arrow-return-right"></i>', 'REPLY' => '<i class="bi bi-arrow-return-right"></i>',
'DATABASE' => '<i class="bi bi-database"></i>',
'DELETE' => '<i class="bi bi-trash"></i>', 'DELETE' => '<i class="bi bi-trash"></i>',
'REBOOT' => '<i class="bi bi-repeat"></i>', 'REBOOT' => '<i class="bi bi-repeat"></i>',
'RELOAD' => '<i class="bi bi-bootstrap-reboot"></i>', 'RELOAD' => '<i class="bi bi-bootstrap-reboot"></i>',
@ -184,7 +184,10 @@ define('ICONS', [
'GOOGLE' => '<i class="bi bi-google"></i>', 'GOOGLE' => '<i class="bi bi-google"></i>',
'CLOUD' => '<i class="bi bi-cloud"></i>', 'CLOUD' => '<i class="bi bi-cloud"></i>',
'SIGNPOST' => '<i class="bi bi-signpost"></i>', 'SIGNPOST' => '<i class="bi bi-signpost"></i>',
'SIGNPOST2' => '<i class="bi bi-signpost-2"></i>', 'LOCK' => '<i class="bi bi-lock"></i>',
'UNLOCK' => '<i class="bi bi-unlock"></i>',
'BOX' => '<i class="bi bi-box"></i>',
'BOXS' => '<i class="bi bi-boxes"></i>',
]); ]);
//배너관련 //배너관련
define('TOP_BANNER', [ define('TOP_BANNER', [

View File

@ -34,10 +34,12 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
}); });
$routes->group('zone', function ($routes) { $routes->group('zone', function ($routes) {
$routes->get('/', 'ZoneController::index'); $routes->get('/', 'ZoneController::index');
$routes->get('create', 'ZoneController::create_form');
$routes->post('create/(:uuid)', 'ZoneController::create/$1'); $routes->post('create/(:uuid)', 'ZoneController::create/$1');
}); });
$routes->group('record', function ($routes) { $routes->group('record', function ($routes) {
$routes->get('/', 'RecordController::index'); $routes->get('/', 'RecordController::index');
$routes->get('create', 'RecordController::create_form');
$routes->post('create/(:uuid)', 'RecordController::create/$1'); $routes->post('create/(:uuid)', 'RecordController::create/$1');
}); });
}); });

View File

@ -8,13 +8,14 @@ use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Traits\AuthTrait; use App\Traits\AuthTrait;
abstract class AdminController extends MVController abstract class AdminController extends MVController
{ {
use AuthTrait; use AuthTrait;
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);
$this->class_path = "Admin/"; $this->root = "Admin/";
$this->layout = "admin"; $this->layout = "admin";
$this->session = $this->session_AuthTrait(); $this->session = $this->session_AuthTrait();
} }

View File

@ -19,7 +19,7 @@ class AccountController extends CloudflareController
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->class_name = "Account"; $this->class_name = "Account";
$this->class_path .= $this->class_name; $this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title"); $this->title = lang("{$this->class_path}.title");
helper($this->class_path); helper($this->class_path);
} }
@ -37,13 +37,32 @@ class AccountController extends CloudflareController
} }
return $this->_mySocket; return $this->_mySocket;
} }
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case $this->getModel()::PARENT:
$this->getAuthModel()->where('status', DEFAULTS['STATUS']);
$options[$field] = [
DEFAULTS['EMPTY'] => lang($this->class_path . '.label.' . $field) . ' 선택',
...$this->getAuthModel()->getFormFieldOption($field, $options),
];
// echo $this->getAuthModel()->getLastQuery();
// dd($options);
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
// 리스트 // 리스트
public function index(): string public function index(): string
{ {
$this->fields = [$this->getModel()::TITLE, 'oldkey', 'type', 'status', 'updated_at', 'created_at']; $this->action = __FUNCTION__;
$this->field_rules = $this->getModel()->getFieldRules(__FUNCTION__, $this->fields); $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'status', 'updated_at', 'created_at'];
$this->filter_fields = ['type', 'status']; $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->batchjob_fields = ['status']; $this->filter_fields = [$this->getModel()::PARENT, 'type', 'status'];
$this->batchjob_fields = ['typep', 'status'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields); $this->field_options = $this->getFormFieldOptions($this->filter_fields);
return $this->list_procedure(); return $this->list_procedure();
} }

View File

@ -16,7 +16,7 @@ class AuthController extends CloudflareController
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->class_name = "Auth"; $this->class_name = "Auth";
$this->class_path .= $this->class_name; $this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title"); $this->title = lang("{$this->class_path}.title");
helper($this->class_path); helper($this->class_path);
} }
@ -29,8 +29,9 @@ class AuthController extends CloudflareController
} }
private function init(string $action): void private function init(string $action): void
{ {
$this->fields = [$this->getModel()::TITLE, 'authkey', 'status']; $this->action = $action;
$this->field_rules = $this->getModel()->getFieldRules($action, $this->fields); $this->fields = [$this->getModel()::TITLE, 'authkey'];
$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);
} }
@ -42,43 +43,52 @@ class AuthController extends CloudflareController
} }
protected function create_process(): void protected function create_process(): void
{ {
$this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
parent::create_process(); parent::create_process();
$entity = $this->getModel()->create($this->formDatas); $this->entity = $this->getModel()->create($this->formDatas);
} }
public function create(): RedirectResponse public function create(): RedirectResponse
{ {
$this->init(__FUNCTION__); $this->init(__FUNCTION__);
$this->create_validate($this->_fields);
$this->formDatas = $this->getFormDatas();
return $this->create_procedure(); return $this->create_procedure();
} }
//수정 //수정
public function modify_form(): RedirectResponse|string protected function modify_form_process(string $uid): void
{
$this->entity = $this->getModel()->getEntityByPK(intval($uid));
if ($this->entity === null) {
throw new \Exception("해당 정보를 찾을수 없습니다.");
}
parent::modify_form_process($uid);
}
public function modify_form(string $uid): RedirectResponse|string
{ {
$this->init('modify'); $this->init('modify');
return $this->create_form_procedure(); return $this->modify_form_procedure($uid);
} }
protected function modify_process(): void protected function modify_process(string $uid): void
{ {
parent::modify_process(); $this->entity = $this->getModel()->getEntityByPK(intval($uid));
if ($this->entity === null) {
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
}
$this->modify_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
parent::modify_process($uid);
$this->entity = $this->getModel()->modify($this->entity, $this->formDatas); $this->entity = $this->getModel()->modify($this->entity, $this->formDatas);
} }
public function modify(string $uid): RedirectResponse public function modify(string $uid): RedirectResponse
{ {
$this->entity = $this->getModel()->getEntityByPK($uid); $this->init(__FUNCTION__);
if ($this->entity === null) { return $this->modify_procedure($uid);
throw new \Exception("해당 정보를 찾을수 없습니다.");
}
$this->init(__FUNCTION__);;
$this->modify_validate($this->_fields);
$this->formDatas = $this->getFormDatas();
return $this->create_procedure();
} }
// 리스트 // 리스트
public function index(): string public function index(): string
{ {
$this->action = __FUNCTION__;
$this->fields = [$this->getModel()::TITLE, 'oldkey', 'status', 'updated_at', 'created_at']; $this->fields = [$this->getModel()::TITLE, 'oldkey', 'status', 'updated_at', 'created_at'];
$this->field_rules = $this->getModel()->getFieldRules(__FUNCTION__, $this->fields); $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->filter_fields = ['status']; $this->filter_fields = ['status'];
$this->batchjob_fields = ['status']; $this->batchjob_fields = ['status'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields); $this->field_options = $this->getFormFieldOptions($this->filter_fields);

View File

@ -21,7 +21,7 @@ abstract class CloudflareController extends AdminController
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);
$this->class_path .= "Cloudflare/"; $this->root .= "Cloudflare/";
} }
final protected function getAuthModel(): AuthModel final protected function getAuthModel(): AuthModel
{ {

View File

@ -16,7 +16,7 @@ class RecordController extends CloudflareController
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->class_name = "Record"; $this->class_name = "Record";
$this->class_path .= $this->class_name; $this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title"); $this->title = lang("{$this->class_path}.title");
helper($this->class_path); helper($this->class_path);
} }
@ -70,16 +70,22 @@ class RecordController extends CloudflareController
} }
private function init(string $action): void private function init(string $action): void
{ {
$this->action = $action;
$this->fields = [$this->getModel()::PARENT, 'type', 'content', 'proxied', 'hosts']; $this->fields = [$this->getModel()::PARENT, 'type', 'content', 'proxied', 'hosts'];
$this->field_rules = $this->getModel()->getFieldRules($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'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields); $this->field_options = $this->getFormFieldOptions($this->filter_fields);
} }
//생성 //생성
protected function create_validate(array $fields): void public function create_form(): RedirectResponse|string
{
$this->init('create');
return $this->create_form_procedure();
}
protected function create_validate(string $action, array $fields): void
{ {
//hosts를 제외한 fields Valid처리 //hosts를 제외한 fields Valid처리
parent::create_validate(array_diff($fields, ['hosts'])); parent::create_validate($action, array_diff($fields, ['hosts']));
} }
protected function create_process(): void protected function create_process(): void
{ {
@ -95,7 +101,7 @@ class RecordController extends CloudflareController
public function create(): RedirectResponse public function create(): RedirectResponse
{ {
$this->init(__FUNCTION__); $this->init(__FUNCTION__);
$this->create_validate($this->fields); $this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas(); $this->formDatas = $this->getFormDatas();
//부모데이터 정의 //부모데이터 정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]); $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
@ -113,9 +119,10 @@ class RecordController extends CloudflareController
// 리스트 // 리스트
public function index(): string public function index(): string
{ {
$this->action = __FUNCTION__;
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at']; $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at'];
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied']; $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
$this->field_rules = $this->getModel()->getFieldRules(__FUNCTION__, $this->fields); $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->batchjob_fields = ['proxied']; $this->batchjob_fields = ['proxied'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields); $this->field_options = $this->getFormFieldOptions($this->filter_fields);
return $this->list_procedure(); return $this->list_procedure();

View File

@ -19,7 +19,7 @@ class ZoneController extends CloudflareController
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->class_name = "Zone"; $this->class_name = "Zone";
$this->class_path .= $this->class_name; $this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title"); $this->title = lang("{$this->class_path}.title");
helper($this->class_path); helper($this->class_path);
} }
@ -50,6 +50,13 @@ class ZoneController extends CloudflareController
// echo $this->getAccountModel()->getLastQuery(); // echo $this->getAccountModel()->getLastQuery();
// dd($options); // dd($options);
break; break;
case 'type':
case 'proxied':
$options[$field] = [
"" => lang($this->root . 'Record.label.' . $field) . ' 선택',
...lang($this->root . 'Record.' . strtoupper($field)),
];
break;
default: default:
$options = parent::getFormFieldOption($field, $options); $options = parent::getFormFieldOption($field, $options);
break; break;
@ -79,16 +86,22 @@ class ZoneController extends CloudflareController
} }
private function init(string $action): void private function init(string $action): void
{ {
$this->action = $action;
$this->fields = [$this->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied']; $this->fields = [$this->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied'];
$this->field_rules = $this->getModel()->getFieldRules($action, $this->fields); $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level', 'status']; $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields); $this->field_options = $this->getFormFieldOptions($this->filter_fields);
} }
//생성 //생성
protected function create_validate(array $fields): void public function create_form(): RedirectResponse|string
{
$this->init('create');
return $this->create_form_procedure();
}
protected function create_validate(string $action, array $fields): void
{ {
//domains,hosts를 제외한 fields Valid처리 //domains,hosts를 제외한 fields Valid처리
parent::create_validate(array_diff($fields, ['domains', 'hosts'])); parent::create_validate($action, array_diff($fields, ['domains', 'hosts']));
} }
protected function create_process(): void protected function create_process(): void
{ {
@ -114,7 +127,7 @@ class ZoneController extends CloudflareController
public function create(): RedirectResponse public function create(): RedirectResponse
{ {
$this->init(__FUNCTION__); $this->init(__FUNCTION__);
$this->create_validate($this->_fields); $this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas(); $this->formDatas = $this->getFormDatas();
//부모데이터 정의 //부모데이터 정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]); $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
@ -149,8 +162,9 @@ class ZoneController extends CloudflareController
// 리스트 // 리스트
public function index(): string public function index(): string
{ {
$this->action = __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->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(__FUNCTION__, $this->fields); $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level']; $this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level'];
$this->batchjob_fields = ['development_mode', 'ipv6', 'security_level']; $this->batchjob_fields = ['development_mode', 'ipv6', 'security_level'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields); $this->field_options = $this->getFormFieldOptions($this->filter_fields);

View File

@ -6,20 +6,20 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Controllers\CommonController;
use App\Models\UserModel; use App\Models\UserModel;
use App\Traits\AuthTrait; use App\Traits\AuthTrait;
class UserController extends CommonController class UserController extends AdminController
{ {
use AuthTrait;
private $_model = null; 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);
$this->root = "Admin/";
$this->layout = "admin";
$this->session = $this->session_AuthTrait(); $this->session = $this->session_AuthTrait();
} }
private function getModel(): UserModel protected function getModel(): UserModel
{ {
if ($this->_model === null) { if ($this->_model === null) {
$this->_model = new UserModel(); $this->_model = new UserModel();

View File

@ -57,11 +57,11 @@ abstract class MVController extends CommonController
return $formDatas; return $formDatas;
} }
// 생성 // 생성
protected function create_validate(array $fields): void protected function create_validate(string $action, array $fields): void
{ {
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요 //변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
$this->validation = service('validation'); $this->validation = service('validation');
$this->validation->setRules($this->getModel()->getFieldRules($fields)); $this->validation->setRules($this->getModel()->getFieldRules($action, $fields));
if (!$this->validation->withRequest($this->request)->run()) { if (!$this->validation->withRequest($this->request)->run()) {
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode( throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
"\n", "\n",
@ -78,7 +78,7 @@ abstract class MVController extends CommonController
$this->session->keepFlashdata(SESSION_NAMES['RETURN_URL']); $this->session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []]; $this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return view( return view(
strtolower($this->class_path) . "/create", strtolower(string: $this->class_path) . "/create",
data: ['viewDatas' => $this->getViewDatas()] data: ['viewDatas' => $this->getViewDatas()]
); );
} catch (\Exception $e) { } catch (\Exception $e) {
@ -105,11 +105,11 @@ abstract class MVController extends CommonController
} }
} }
// 수정 // 수정
protected function modify_validate(array $fields): void protected function modify_validate(string $action, array $fields): void
{ {
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요 //변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
$this->validation = service('validation'); $this->validation = service('validation');
$this->validation->setRules($this->getModel()->getFieldRules($fields)); $this->validation->setRules($this->getModel()->getFieldRules($action, $fields));
if (!$this->validation->withRequest($this->request)->run()) { if (!$this->validation->withRequest($this->request)->run()) {
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode( throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
"\n", "\n",
@ -117,12 +117,12 @@ abstract class MVController extends CommonController
)); ));
} }
} }
protected function modify_form_process(): void {} protected function modify_form_process(string $uid): void {}
final protected function modify_form_procedure(): RedirectResponse|string final protected function modify_form_procedure(string $uid): RedirectResponse|string
{ {
try { try {
helper(['form']); helper(['form']);
$this->modify_form_process(); $this->modify_form_process($uid);
$this->session->keepFlashdata(SESSION_NAMES['RETURN_URL']); $this->session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []]; $this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return view( return view(
@ -134,13 +134,13 @@ abstract class MVController extends CommonController
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with(SESSION_NAMES['RETURN_MSG'], $e->getMessage()); return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with(SESSION_NAMES['RETURN_MSG'], $e->getMessage());
} }
} }
protected function modify_process(): void {} protected function modify_process(string $uid): void {}
final protected function modify_procedure(): RedirectResponse final protected function modify_procedure(string $uid): RedirectResponse
{ {
try { try {
//Transaction Start //Transaction Start
$this->getModel()->transStart(); $this->getModel()->transStart();
$this->modify_process(); $this->modify_process($uid);
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다."); log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) { } catch (\Exception $e) {
@ -222,7 +222,7 @@ abstract class MVController extends CommonController
$this->page * $this->per_page - $this->per_page $this->page * $this->per_page - $this->per_page
); );
} }
$entitys = $this->getModel()->findAll(); $entitys = $this->getModel()->select($this->getModel()->getTable() . '.*')->findAll();
echo $this->getModel()->getLastQuery(); echo $this->getModel()->getLastQuery();
return $entitys; return $entitys;
} }

View File

@ -1,3 +1,4 @@
###cloudflareaccount 조정###
1. 필드추가 1. 필드추가
alter table cloudflareaccount add column id varchar(30) not null after auth_uid; alter table cloudflareaccount add column id varchar(30) not null after auth_uid;
alter table cloudflareaccount add column authkey varchar(255) not null after id; alter table cloudflareaccount add column authkey varchar(255) not null after id;

View File

@ -1,39 +1,41 @@
<?php <?php
use App\Entities\Cloudflare\AccountEntity;
use App\Models\Cloudflare\AccountModel; use App\Models\Cloudflare\AccountModel;
function getFieldLabel_AccountHelper(string $field, array $viewDatas, array $attributes = []): string function getFieldLabel_AccountHelper(string $field, array $viewDatas, array $extras = []): string
{ {
switch ($field) { switch ($field) {
case AccountModel::PARENT:
$extras = [...$extras, "class" => 'text-danger'];
break;
default: default:
if (strpos($viewDatas['field_rules'][$field], 'required') !== false) { if (strpos($viewDatas['field_rules'][$field], 'required') !== false) {
$attributes = ['style="color:red";']; $extras = [...$extras, "class" => 'text-danger'];
} }
$label = sprintf(
"<span %s>%s</span>",
implode(" ", $attributes),
lang("{$viewDatas['class_path']}.label.{$field}")
);
break; break;
} }
return $label; return form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
} }
//header.php에서 getFieldForm_Helper사용 //header.php에서 getFieldForm_Helper사용
function getFieldForm_AccountHelper(string $field, mixed $value, array $viewDatas, array $attributes = []): string function getFieldForm_AccountHelper(string $field, mixed $value, array $viewDatas, array $extras = []): string
{ {
$value = $value ?: DEFAULTS['EMPTY']; $value = $value ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
case AccountModel::PARENT: case AccountModel::PARENT:
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, [...$attributes, 'class' => "select-field"]); $form = form_dropdown($field, $viewDatas['field_options'][$field], $value, [...$extras, 'class' => "select-field"]);
// // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); // // return form_multiselect($field, $field_options[$field], is_array($value) ? [...$value] : [$value], [$extras]);
// foreach ($viewDatas['field_options'][$field] as $key => $label) { // foreach ($viewDatas['field_options'][$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label;
// } // }
// return implode("&nbsp;", $checkboxs); // return implode("&nbsp;", $checkboxs);
break; break;
case "type": case AccountModel::TITLE:
case "status": $form = form_input($field, $value, ["placeholder" => "예)test@exmaple.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]);
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $attributes); break;
case 'type':
case 'status':
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':
@ -45,11 +47,45 @@ function getFieldForm_AccountHelper(string $field, mixed $value, array $viewData
} }
return $form; return $form;
} // } //
function getFieldView_AccountHelper(string $field, AccountEntity $entity, array $viewDatas, array $extras = [])
function getFieldView_AccountHelper(string $field, mixed $entity, array $viewDatas, array $attributes = [])
{ {
$value = $entity->$field ?: DEFAULTS['EMPTY']; $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
case AccountModel::PARENT:
if ($extras['old_auth'] === $entity->getParent()) {
$value = "";
} else {
// dd($viewDatas['field_options']);
$value = anchor(
base_url() . strtolower($viewDatas['root']) . "auth/reload/" . $entity->getParent(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
"target" => "_self"
]
) . " <span class=\"label_accounts\">" .
preg_replace("/(\w+)@(.+)/", "$1", $viewDatas['field_options'][$field][$value])
. "</span>";
}
break;
case AccountModel::TITLE:
$value = anchor(
current_url() . '/reload/' . $entity->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
"target" => "_self"
]
) . " " .
anchor(
base_url() . strtolower($viewDatas['root']) . "zone?account_uid=" . $entity->getPK(),
ICONS["FLAG"],
[
"class" => "btn btn-sm btn-primary btn-circle",
"target" => "_self"
]
) . " <span class=\"label_Accounts\">{$value}</span>";
break;
case 'category_uid': case 'category_uid':
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) { foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) {
foreach ($category_2depths as $key => $depth) { foreach ($category_2depths as $key => $depth) {
@ -59,64 +95,40 @@ function getFieldView_AccountHelper(string $field, mixed $entity, array $viewDat
} }
} }
break; break;
case 'cost':
case 'price':
case 'sale':
$value = number_format(!$value ? 0 : $value) . "";
break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':
$value = $value ? date("Y-m-d", strtotime($value)) : ""; $value = $value ? date("Y-m-d", strtotime($value)) : "";
break; break;
default: default:
if (in_array($field, $viewDatas['filter_fields']) && $value) { if (in_array($field, $viewDatas['filter_fields']) && $value) {
$value = $viewDatas['field_options'][$field][$value]; $extras["onChange"] = sprintf(
}
break;
}
return $value;
} //
function getListHeaders_AccountHelper(string $field, array $viewDatas, array $attributes = []): string
{
$label = getFieldLabel_AccountHelper($field, $viewDatas, $attributes);
if ($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);
$header = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case 'title':
$attributes = [...$attributes, "class=\"col-2\""];
break;
}
return sprintf("<th %s>%s</th>", implode(" ", $attributes), $header);
}
function getListColumns_AccountHelper(string $field, mixed $entity, array $viewDatas, array $attributes = []): string
{
switch ($field) {
case AccountModel::TITLE:
$value = anchor(
current_url() . '/view/' . $entity->getPK(),
getFieldView_AccountHelper($field, $entity, $viewDatas),
["target" => "_self"]
);
break;
default:
if (in_array($field, $viewDatas['filter_fields'])) {
$attributes["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(), current_url(),
$entity->getPK(), $entity->getPK(),
$field, $field,
$field $field
); );
$value = getFieldForm_AccountHelper($field, $entity, $viewDatas, $attributes); $value = getFieldForm_AccountHelper($field, $entity->$field, $viewDatas, $extras);
} }
$value = getFieldView_AccountHelper($field, $entity, $viewDatas);
break; break;
} }
return $value; return $value;
} //
function getListColumns_AccountHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_AccountHelper($field, $viewDatas, $extras);
if ($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::PARENT:
break;
case AccountModel::TITLE:
break;
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
} }

View File

@ -1,37 +1,29 @@
<?php <?php
use App\Entities\Cloudflare\AuthEntity;
use App\Models\Cloudflare\AuthModel; use App\Models\Cloudflare\AuthModel;
function getFieldLabel_AuthHelper(string $field, array $viewDatas, array $attributes = []): string function getFieldLabel_AuthHelper(string $field, array $viewDatas, array $extras = []): string
{ {
switch ($field) { switch ($field) {
default: default:
if (strpos($viewDatas['field_rules'][$field], 'required') !== false) { if (strpos($viewDatas['field_rules'][$field], 'required') !== false) {
$attributes = ['style="color:red";']; $extras = [...$extras, "class" => 'text-danger'];
} }
$label = sprintf(
"<span %s>%s</span>",
implode(" ", $attributes),
lang("{$viewDatas['class_path']}.label.{$field}")
);
break; break;
} }
return $label; return form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
} }
//header.php에서 getFieldForm_Helper사용 //header.php에서 getFieldForm_Helper사용
function getFieldForm_AuthHelper(string $field, mixed $value, array $viewDatas, array $attributes = []): string function getFieldForm_AuthHelper(string $field, mixed $value, array $viewDatas, array $extras = []): string
{ {
$value = $value ?: DEFAULTS['EMPTY']; $value = $value ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
case AuthModel::TITLE: case AuthModel::TITLE:
$form = form_input($field, $value, ["placeholder" => "예)sample@test.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); $form = form_input($field, $value, ["placeholder" => "예)test@example.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]);
break; break;
case 'head': case 'status':
case 'tail': $form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras);
$form = form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']);
break;
case "status":
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $attributes);
break; break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':
@ -43,11 +35,28 @@ function getFieldForm_AuthHelper(string $field, mixed $value, array $viewDatas,
} }
return $form; return $form;
} // } //
function getFieldView_AuthHelper(string $field, AuthEntity $entity, array $viewDatas, array $extras = [])
function getFieldView_AuthHelper(string $field, mixed $entity, array $viewDatas, array $attributes = [])
{ {
$value = $entity->$field ?: DEFAULTS['EMPTY']; $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
case AuthModel::TITLE:
$value = anchor(
current_url() . '/reload/' . $entity->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
"target" => "_self"
]
) . " " .
anchor(
base_url() . strtolower($viewDatas['root']) . "account?auth_uid=" . $entity->getPK(),
ICONS["FLAG"],
[
"class" => "btn btn-sm btn-primary btn-circle",
"target" => "_self"
]
) . " <span class=\"label_Auths\">{$value}</span>";
break;
case 'category_uid': case 'category_uid':
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) { foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) {
foreach ($category_2depths as $key => $depth) { foreach ($category_2depths as $key => $depth) {
@ -57,67 +66,39 @@ function getFieldView_AuthHelper(string $field, mixed $entity, array $viewDatas,
} }
} }
break; break;
case 'cost':
case 'price':
case 'sale':
$value = number_format(!$value ? 0 : $value) . "";
break;
case 'content':
$value = html_entity_decode($value);
break;
case 'updated_at': case 'updated_at':
case 'created_at': case 'created_at':
$value = $value ? date("Y-m-d", strtotime($value)) : ""; $value = $value ? date("Y-m-d", strtotime($value)) : "";
break; break;
default: default:
if (in_array($field, $viewDatas['filter_fields']) && $value) { if (in_array($field, $viewDatas['filter_fields']) && $value) {
$value = $viewDatas['field_options'][$field][$value]; $extras["onChange"] = sprintf(
}
break;
}
return $value;
} //
function getListHeaders_AuthHelper(string $field, array $viewDatas, array $attributes = []): string
{
$label = getFieldLabel_AuthHelper($field, $viewDatas, $attributes);
if ($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);
$header = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case 'title':
$attributes = [...$attributes, "class=\"col-2\""];
break;
}
return sprintf("<th %s>%s</th>", implode(" ", $attributes), $header);
}
function getListColumns_AuthHelper(string $field, mixed $entity, array $viewDatas, array $attributes = []): string
{
switch ($field) {
case AuthModel::TITLE:
$value = anchor(
current_url() . '/view/' . $entity->getPK(),
getFieldView_AuthHelper($field, $entity, $viewDatas),
["target" => "_self"]
);
break;
default:
if (in_array($field, $viewDatas['filter_fields'])) {
$attributes["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(), current_url(),
$entity->getPK(), $entity->getPK(),
$field, $field,
$field $field
); );
$value = getFieldForm_AuthHelper($field, $entity, $viewDatas, $attributes); $value = getFieldForm_AuthHelper($field, $entity->$field, $viewDatas, $extras);
} }
$value = getFieldView_AuthHelper($field, $entity, $viewDatas);
break; break;
} }
return $value; return $value;
} //
function getListColumns_AuthHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_AuthHelper($field, $viewDatas, $extras);
if ($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:
$label .= "<button onClick=\"getElementsByClassNameCopyToClipboard('label_Auths'); return false;\" class=\"btn btn-sm btn-danger btn-circle\">Copy Domains</buttion>";
break;
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
} }

View File

@ -1,5 +1,6 @@
<?php <?php
use App\Entities\Cloudflare\RecordEntity;
use App\Models\Cloudflare\RecordModel; use App\Models\Cloudflare\RecordModel;
function getFieldLabel_RecordHelper(string $field, array $viewDatas, array $extras = []): string function getFieldLabel_RecordHelper(string $field, array $viewDatas, array $extras = []): string
@ -29,13 +30,17 @@ function getFieldForm_RecordHelper(string $field, mixed $value, array $viewDatas
// } // }
// return implode("&nbsp;", $checkboxs); // return implode("&nbsp;", $checkboxs);
break; break;
case RecordModel::TITLE: case RecordModel::TITLE: //host
$form = form_input($field, $value, ["placeholder" => "예)123.123.123.123", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); $form = form_input($field, $value, ["placeholder" => "예)www.example.com", "style" => "width:200px; ::placeholder{color:silver; opacity: 1;}"]);
break; break;
case 'hosts': case 'hosts':
$form = form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '5']); $form = form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '5']);
break; break;
case 'content':
$form = form_input($field, $value, ["placeholder" => "예)123.123.123.123", "style" => "width:200px; ::placeholder{color:silver; opacity: 1;}"]);
break;
case "type": case "type":
case "fixed":
case "locked": case "locked":
case "proxied": case "proxied":
case "proxiable": case "proxiable":
@ -51,7 +56,7 @@ function getFieldForm_RecordHelper(string $field, mixed $value, array $viewDatas
} }
return $form; return $form;
} // } //
function getFieldView_RecordHelper(string $field, mixed $entity, array $viewDatas, array $extras = []) function getFieldView_RecordHelper(string $field, RecordEntity $entity, array $viewDatas, array $extras = [])
{ {
$value = $entity->$field ?: DEFAULTS['EMPTY']; $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
@ -60,7 +65,7 @@ function getFieldView_RecordHelper(string $field, mixed $entity, array $viewData
$value = ""; $value = "";
} else { } else {
$value = anchor( $value = anchor(
current_url() . '/reload/' . $entity->getParent(), base_url() . strtolower($viewDatas['root']) . 'zone/reload/' . $entity->getParent(),
ICONS["RELOAD"], ICONS["RELOAD"],
[ [
"class" => "btn btn-sm btn-primary btn-circle", "class" => "btn btn-sm btn-primary btn-circle",
@ -70,11 +75,9 @@ function getFieldView_RecordHelper(string $field, mixed $entity, array $viewData
} }
break; break;
case RecordModel::TITLE: case RecordModel::TITLE:
$value = anchor( $url = sprintf("%s/toggle/%s?fixed=%s", current_url(), $entity->getPK(), $entity->fixed == 'on' ? "off" : "on");
current_url() . '/immobilized/' . $entity->getPK(), $value = sprintf("%s%s", $entity->fixed == 'on' ? ICONS['LOCK'] : "", $value);
$value, $value = anchor($url, $value, ["target" => "_self"]);
["target" => "_self", "class" => "label_hosts"]
);
break; break;
case 'category_uid': case 'category_uid':
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) { foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) {
@ -97,11 +100,10 @@ function getFieldView_RecordHelper(string $field, mixed $entity, array $viewData
default: default:
if (in_array($field, $viewDatas['filter_fields']) && $value) { if (in_array($field, $viewDatas['filter_fields']) && $value) {
$extras["onChange"] = sprintf( $extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', 'location.href="%s/toggle/%s?%s="+this.options[this.selectedIndex].value',
current_url(), current_url(),
$entity->getPK(), $entity->getPK(),
$field, $field,
$field
); );
$value = getFieldForm_RecordHelper($field, $entity->$field, $viewDatas, $extras); $value = getFieldForm_RecordHelper($field, $entity->$field, $viewDatas, $extras);
} }

View File

@ -1,5 +1,6 @@
<?php <?php
use App\Entities\Cloudflare\ZoneEntity;
use App\Models\Cloudflare\ZoneModel; use App\Models\Cloudflare\ZoneModel;
function getFieldLabel_ZoneHelper(string $field, array $viewDatas, array $extras = []): string function getFieldLabel_ZoneHelper(string $field, array $viewDatas, array $extras = []): string
@ -32,13 +33,19 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas,
case ZoneModel::TITLE: case ZoneModel::TITLE:
$form = form_input($field, $value, ["placeholder" => "예)exmaple.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]); $form = form_input($field, $value, ["placeholder" => "예)exmaple.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]);
break; break;
case 'domains':
case 'hosts': case 'hosts':
$form = form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '5']); $form = form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '5']);
break; break;
case 'content':
$form = form_input($field, $value, ["placeholder" => "예)123.123.123.123", "style" => "width:200px; ::placeholder{color:silver; opacity: 1;}"]);
break;
case "development_mode": case "development_mode":
case "ipv6": case "ipv6":
case "security_level": case "security_level":
case 'status': case 'status':
case 'type':
case 'proxied':
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras); $form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras);
break; break;
case 'updated_at': case 'updated_at':
@ -51,7 +58,7 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas,
} }
return $form; return $form;
} // } //
function getFieldView_ZoneHelper(string $field, mixed $entity, array $viewDatas, array $extras = []) function getFieldView_ZoneHelper(string $field, ZoneEntity $entity, array $viewDatas, array $extras = [])
{ {
$value = $entity->$field ?: DEFAULTS['EMPTY']; $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) { switch ($field) {
@ -60,7 +67,7 @@ function getFieldView_ZoneHelper(string $field, mixed $entity, array $viewDatas,
$value = ""; $value = "";
} else { } else {
$value = anchor( $value = anchor(
current_url() . '/reload/' . $entity->getParent(), base_url() . strtolower($viewDatas['root']) . "account/reload/" . $entity->getParent(),
ICONS["RELOAD"], ICONS["RELOAD"],
[ [
"class" => "btn btn-sm btn-primary btn-circle", "class" => "btn btn-sm btn-primary btn-circle",
@ -73,7 +80,7 @@ function getFieldView_ZoneHelper(string $field, mixed $entity, array $viewDatas,
break; break;
case ZoneModel::TITLE: case ZoneModel::TITLE:
$value = anchor( $value = anchor(
current_url() . '/reload/' . $entity->getParent(), current_url() . '/reload/' . $entity->getPK(),
ICONS["RELOAD"], ICONS["RELOAD"],
[ [
"class" => "btn btn-sm btn-primary btn-circle", "class" => "btn btn-sm btn-primary btn-circle",
@ -81,7 +88,7 @@ function getFieldView_ZoneHelper(string $field, mixed $entity, array $viewDatas,
] ]
) . " " . ) . " " .
anchor( anchor(
current_url() . '/reload/' . $entity->getParent(), base_url() . strtolower($viewDatas['root']) . "record?zone_uid=" . $entity->getPK(),
ICONS["FLAG"], ICONS["FLAG"],
[ [
"class" => "btn btn-sm btn-primary btn-circle", "class" => "btn btn-sm btn-primary btn-circle",

View File

@ -3,6 +3,7 @@ return [
'title' => "Account정보", 'title' => "Account정보",
'label' => [ 'label' => [
'uid' => "번호", 'uid' => "번호",
'auth_uid' => "인증",
'title' => "계정명", 'title' => "계정명",
'type' => "계정형식", 'type' => "계정형식",
'status' => "상태", 'status' => "상태",

View File

@ -14,6 +14,7 @@ return [
'locked' => "서비스", 'locked' => "서비스",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
'hosts' => "호스트명",
], ],
"ZONE_UID" => [], "ZONE_UID" => [],
"TYPE" => [ "TYPE" => [
@ -28,17 +29,17 @@ return [
'SRV' => 'SRV', 'SRV' => 'SRV',
'INFO' => 'INFO', 'INFO' => 'INFO',
], ],
"FIXED" => [
"on" => "고정",
"off" => "비고정",
],
"PROXIABLE" => [ "PROXIABLE" => [
"on" => "사용", "on" => "사용",
"off" => "사용 않함", "off" => "사용 않함",
], ],
"FIXED" => [
"on" => "고정 사용",
"off" => "고정 사용 않함",
],
"PROXIED" => [ "PROXIED" => [
"on" => "CDN 사용", "on" => "CDN 사용",
"off" => "CDN 사용 않함", "off" => "CDN 미사용",
], ],
"LOCKED" => [ "LOCKED" => [
"on" => "운영중", "on" => "운영중",

View File

@ -14,6 +14,11 @@ return [
'status' => "서비스", 'status' => "서비스",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
'domains' => "도메인명",
'hosts' => "호스트명",
'type' => "TYPE",
'content' => "IP정보",
'proxied' => "CDN기능",
], ],
"ACCOUNT_UID" => [], "ACCOUNT_UID" => [],
"DEVELOPMENT_MODE" => [ "DEVELOPMENT_MODE" => [

View File

@ -11,7 +11,7 @@ class AccountModel extends CommonModel
const TABLE = "cloudflareaccount"; const TABLE = "cloudflareaccount";
const PK = "uid"; const PK = "uid";
const TITLE = "title"; const TITLE = "title";
const PARENT = "account_uid"; const PARENT = "auth_uid";
protected $table = self::TABLE; protected $table = self::TABLE;
protected $primaryKey = self::PK; protected $primaryKey = self::PK;
protected $useAutoIncrement = false; protected $useAutoIncrement = false;
@ -30,7 +30,7 @@ class AccountModel extends CommonModel
{ {
switch ($field) { switch ($field) {
case self::PARENT: case self::PARENT:
$rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; $rules[$field] = "required|numeric";
break; break;
case self::TITLE: case self::TITLE:
$rules[$field] = "required|trim|string"; $rules[$field] = "required|trim|string";

View File

@ -12,9 +12,9 @@ class AuthModel extends CommonModel
const TITLE = "id"; const TITLE = "id";
protected $table = self::TABLE; protected $table = self::TABLE;
protected $primaryKey = self::PK; protected $primaryKey = self::PK;
protected $useAutoIncrement = false; protected $useAutoIncrement = true;
protected $returnType = AuthEntity::class; //object,array,entity명::class protected $returnType = AuthEntity::class; //object,array,entity명::class
protected $allowedFields = [self::PK, self::TITLE, 'authkey', 'oldkey', 'status', 'updated_at', 'created_at']; protected $allowedFields = [self::TITLE, 'authkey', 'oldkey', 'status', 'updated_at', 'created_at'];
protected $useTimestamps = true; protected $useTimestamps = true;
public function __construct() public function __construct()
{ {
@ -28,13 +28,15 @@ class AuthModel extends CommonModel
{ {
switch ($field) { switch ($field) {
case self::TITLE: case self::TITLE:
$rules[$field] = "required|valid_emailvalid_email|is_unique[cloudflareauth.id]"; $rules[$field] = "required|trim|valid_email";
$rules[$field] .= $action == "create" ? "|is_unique[{$this->table}.{$field}]" : "";
break; break;
case "authkey": case "authkey":
$rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";; $rules[$field] = "required|trim|string";
$rules[$field] .= $action == "create" ? "|is_unique[{$this->table}.{$field}]" : "";
break; break;
case "oldkey": case "oldkey":
$rules[$field] = "if_exist|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; $rules[$field] = "if_exist|trim|string";
break; break;
default: default:
$rules = parent::getFieldRule($action, $field, $rules); $rules = parent::getFieldRule($action, $field, $rules);

View File

@ -50,6 +50,10 @@ abstract class CommonModel extends Model
parent::__construct(); parent::__construct();
} }
abstract public function getTitleField(): string; abstract public function getTitleField(): string;
final public function getTable(): string
{
return $this->table;
}
final public function getPKField(): string final public function getPKField(): string
{ {
return $this->primaryKey; return $this->primaryKey;

View File

@ -8,7 +8,7 @@
<nav class="condition nav"> <nav class="condition nav">
조건검색: 조건검색:
<?php foreach ($viewDatas['filter_fields'] as $field): ?> <?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= getFieldForm_AccountHelper($field, $viewDatas[$field], $viewDatas) ?> <?= getFieldForm_AccountHelper($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
</nav> </nav>
<nav class="search nav justify-content-center"> <nav class="search nav justify-content-center">
@ -31,42 +31,30 @@
<tr> <tr>
<th>번호</th> <th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListHeaders_AccountHelper($field, $viewDatas) ?> <?= getListColumns_AccountHelper($field, $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
<th>작업</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $cnt = 0 ?> <?php $cnt = 0 ?>
<?php $old_auth = '' ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?> <?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> <tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap"> <td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?> <?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/modify/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> <?= anchor(current_url() . '/sync/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td> </td>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getListColumns_AccountHelper($field, $entity, $viewDatas) ?></td> <td><?= getFieldView_AccountHelper($field, $entity, $viewDatas, ['old_auth' => $old_auth]) ?></td>
<?php if ($cnt == 2) {
dd($viewDatas['fields']);
} ?>
<?php endforeach ?> <?php endforeach ?>
<td>
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
</td>
</tr> </tr>
<?php $cnt++ ?> <?php $cnt++ ?>
<?php $old_auth = $entity->getParent(); ?>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<div class="index_bottom">
<ul class="nav justify-content-center">
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
<?php foreach ($viewDatas['batchjob_fields'] as $field): ?>
<?= getFieldForm_AccountHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item">
<?= anchor(current_url() . '/create', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
</li>
</ul>
</div>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= form_close() ?> <?= form_close() ?>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@ -1,19 +1,29 @@
<?= $this->extend("layouts/{$viewDatas['layout']}") ?>
<?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<?= form_open(current_url() . '/create', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> <?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-striped" style="width:500px;"> <table class="action_form table table-bordered">
<?php foreach ($viewDatas['fields'] as $field): ?>
<tr> <tr>
<td class="label"><?= getFieldLabel_AuthHelper($field, $viewDatas) ?></td> <?php $cnt = 1 ?>
<td class="column"> <?php foreach ($viewDatas['fields'] as $field): ?>
<th nowrap><?= getFieldLabel_AuthHelper($field, $viewDatas) ?></th>
<?php endforeach; ?>
</tr>
<tr>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td nowrap>
<?= getFieldForm_AuthHelper($field, old($field), $viewDatas) ?> <?= getFieldForm_AuthHelper($field, old($field), $viewDatas) ?>
<?= validation_show_error($field); ?> <?= validation_show_error($field); ?>
</td> </td>
</tr> <?php $cnt++ ?>
<?php endforeach; ?> <?php endforeach; ?>
</tr>
<tr> <tr>
<td valign="bottom" colspan="2"> <td valign="bottom" colspan="<?= $cnt * 2 ?>">
<?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?> <?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?>
</td> </td>
</tr> </tr>
<?= form_close(); ?>
</table> </table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')): ?> <?= session()->getFlashdata('error') ?><?php endif ?>
<?= $this->endSection() ?>

View File

@ -0,0 +1,26 @@
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="action_form table table-bordered">
<tr>
<?php $cnt = 1 ?>
<?php foreach ($viewDatas['fields'] as $field): ?>
<th nowrap><?= getFieldLabel_AuthHelper($field, $viewDatas) ?></th>
<?php endforeach; ?>
</tr>
<tr>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td nowrap>
<?= getFieldForm_AuthHelper($field, old($field), $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
<?php $cnt++ ?>
<?php endforeach; ?>
</tr>
<tr>
<td valign="bottom" colspan="<?= $cnt * 2 ?>">
<?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?>
</td>
</tr>
<?= form_close(); ?>
</table>
<?php if (session()->getFlashdata('error')): ?> <?= session()->getFlashdata('error') ?><?php endif ?>

View File

@ -8,7 +8,7 @@
<nav class="condition nav"> <nav class="condition nav">
조건검색: 조건검색:
<?php foreach ($viewDatas['filter_fields'] as $field): ?> <?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= getFieldForm_AuthHelper($field, $viewDatas[$field], $viewDatas) ?> <?= getFieldForm_AuthHelper($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
</nav> </nav>
<nav class="search nav justify-content-center"> <nav class="search nav justify-content-center">
@ -31,7 +31,7 @@
<tr> <tr>
<th>번호</th> <th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListHeaders_AuthHelper($field, $viewDatas) ?> <?= getListColumns_AuthHelper($field, $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
<th>작업</th> <th>작업</th>
</tr> </tr>
@ -39,13 +39,14 @@
<tbody> <tbody>
<?php $cnt = 0 ?> <?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?> <?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> <tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap"> <td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?> <span onClick="loadContentForm(' <?= current_url() . "/modify/" . $entity->getPK() ?>' , document.getElementById('ActionForm'))">
<?= anchor(current_url() . '/modify/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> <?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</span>
</td> </td>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getListColumns_AuthHelper($field, $entity, $viewDatas) ?></td> <td><?= getFieldView_AuthHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?> <?php endforeach ?>
<td> <td>
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> <?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
@ -55,6 +56,7 @@
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<?= form_close() ?>
<div class="index_bottom"> <div class="index_bottom">
<ul class="nav justify-content-center"> <ul class="nav justify-content-center">
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li> <li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
@ -62,26 +64,8 @@
<?= getFieldForm_AuthHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?> <?= getFieldForm_AuthHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li> <li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item"> <li class="nav-item"><?= anchor(current_url() . '/create', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
<?= anchor(current_url() . '/create', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
</li>
</ul> </ul>
</div> </div>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div> <div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= form_close() ?>
<nav class="index_form navbar navbar-expand-lg">
<div class="container-fluid">
<nav class="nav"></nav>
<nav id="index_create_form" class="nav justify-content-center"></nav>
<nav class="nav justify-content-end"></nav>
</div>
</nav>
<script>
document.addEventListener('DOMContentLoaded', function() {
loadContentForm(
"<?= base_url(strtolower($viewDatas["class_path"]) . "/create") ?>",
document.getElementById('index_create_form')
);
});
</script>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@ -0,0 +1,29 @@
<?= $this->extend("layouts/{$viewDatas['layout']}") ?>
<?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="action_form table table-bordered">
<tr>
<?php $cnt = 1 ?>
<?php foreach ($viewDatas['fields'] as $field): ?>
<th nowrap><?= getFieldLabel_AuthHelper($field, $viewDatas) ?></th>
<?php endforeach; ?>
</tr>
<tr>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td nowrap>
<?= getFieldForm_AuthHelper($field, is_null(old($field)) ? $viewDatas['entity']->$field : old($field), $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
<?php $cnt++ ?>
<?php endforeach; ?>
</tr>
<tr>
<td valign="bottom" colspan="<?= $cnt * 2 ?>">
<?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?>
</td>
</tr>
</table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')): ?> <?= session()->getFlashdata('error') ?><?php endif ?>
<?= $this->endSection() ?>

View File

@ -1,35 +1,26 @@
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<?= form_open(current_url() . '/create', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> <?= form_open(current_url() . '/create', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-striped"> <table class="action_form table table-bordered">
<tr> <tr>
<th style="text-align:center;">도메인</th> <?php $cnt = 1 ?>
<th style="text-align:center;">Type</th> <?php foreach ($viewDatas['fields'] as $field): ?>
<th style="text-align:center;">IP/내용</th> <th nowrap><?= getFieldLabel_RecordHelper($field, $viewDatas) ?></th>
<th style="text-align:center;">CDN기능</th> <?php endforeach; ?>
<th colspan="2" style="text-align:center;">호스트명</th>
</tr> </tr>
<tr> <tr>
<td> <?php foreach ($viewDatas['fields'] as $field): ?>
<?= getFieldForm_RecordHelper('zone_uid', isset($this->zone_uid) ?: old('zone_uid'), $viewDatas) ?> <td nowrap>
<?= validation_show_error('zone_uid'); ?> <?= getFieldForm_RecordHelper($field, isset($viewDatas[$field]) ? $viewDatas[$field] : old($field), $viewDatas) ?>
<?= validation_show_error($field); ?>
</td> </td>
<td> <?php $cnt++ ?>
<?= form_dropdown('type', array_merge(["" => "Type 선택"], lang('Admin/Cloudflare/Record.TYPE')), old('type')) ?> <?php endforeach; ?>
<?= validation_show_error('type'); ?>
</td>
<td>
<?= form_input('content', is_null(old('content')) ? DEFAULTS['EMPTY'] : old('content'), ["size" => 30]) ?>
<?= validation_show_error('content'); ?>
</td>
<td><?= form_dropdown('proxied', ["" => "CDN기능 선택", "on" => "사용", "off" => "사용 않함"], old('proxied')) ?>
<?= validation_show_error('proxied'); ?>
</td>
<td>
<?= form_textarea('hosts', is_null(old('hosts')) ? DEFAULTS['EMPTY'] : old('hosts'), ["cols" => 30, "rows" => 5]) ?>
<?= validation_show_error('hosts'); ?>
</td>
<td><input type="submit" value="추가" class="btn btn-sm btn-primary btn-circle" type="button" /></td>
</tr> </tr>
<tr>
<td valign="bottom" colspan="<?= $cnt * 2 ?>">
<?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?>
</td>
</tr>
<?= form_close(); ?>
</table> </table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')): ?> <?= session()->getFlashdata('error') ?><?php endif ?> <?php if (session()->getFlashdata('error')): ?> <?= session()->getFlashdata('error') ?><?php endif ?>

View File

@ -8,7 +8,7 @@
<nav class="condition nav"> <nav class="condition nav">
조건검색: 조건검색:
<?php foreach ($viewDatas['filter_fields'] as $field): ?> <?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= getFieldForm_RecordHelper($field, $viewDatas[$field], $viewDatas) ?> <?= getFieldForm_RecordHelper($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
</nav> </nav>
<nav class="search nav justify-content-center"> <nav class="search nav justify-content-center">
@ -40,12 +40,12 @@
<?php $cnt = 0 ?> <?php $cnt = 0 ?>
<?php $old_zone = '' ?> <?php $old_zone = '' ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?> <?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->locked != 'on' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> <tr id="<?= $entity->getPK() ?>" <?= $entity->locked != 'on' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap"> <td class="text-center text-wrap">
<?php if ($entity->fixed == 'off' && $entity->type == 'A') : ?> <?php if ($entity->fixed == 'off' && $entity->type == 'A') : ?>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?> <?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<?php endif ?> <?php endif ?>
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?> <?= anchor(current_url() . '/sync/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td> </td>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_RecordHelper($field, $entity, $viewDatas, ['old_zone' => $old_zone]) ?></td> <td><?= getFieldView_RecordHelper($field, $entity, $viewDatas, ['old_zone' => $old_zone]) ?></td>
@ -59,6 +59,7 @@
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<?= form_close() ?>
<div class="index_bottom"> <div class="index_bottom">
<ul class="nav justify-content-center"> <ul class="nav justify-content-center">
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li> <li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
@ -66,20 +67,15 @@
<?= getFieldForm_RecordHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?> <?= getFieldForm_RecordHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li> <li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item">
<?= anchor(current_url() . '/create', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
</li>
</ul> </ul>
</div> </div>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div> <div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= form_close() ?> <div id="ActionForm" style="text-align:center;">
<nav class="index_form navbar navbar-expand-lg"> <div id="form_page" class="modal-body" style="text-align:center;"></div>
<div class="container-fluid"> </div>
<nav class="nav"></nav> <script>
<nav id="index_create_form" class="nav justify-content-center"> document.addEventListener('DOMContentLoaded', function() {
<?= $this->include("{$viewDatas['class_path']}/create"); ?> loadContentForm("<?= current_url() . "/create" ?>", document.getElementById('form_page'));
</nav> });
<nav class="nav justify-content-end"></nav> </script>
</div>
</nav>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@ -1,44 +1,26 @@
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<?= form_open(current_url() . '/create', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> <?= form_open(current_url() . '/create', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-striped"> <table class="action_form table table-bordered">
<tr> <tr>
<th style="text-align:center;">계정정보</th> <?php $cnt = 1 ?>
<th style="text-align:center;">Type</th> <?php foreach ($viewDatas['fields'] as $field): ?>
<th style="text-align:center;">IP/내용</th> <th nowrap><?= getFieldLabel_ZoneHelper($field, $viewDatas) ?></th>
<th style="text-align:center;">도메인명</th>
<th>CDN기능</th>
<th colspan="2" style="text-align:center;">호스트명</th>
</tr>
<tr>
<td>
<?= getFieldForm_ZoneHelper('account_uid', isset($this->account_uid) ?: old('account_uid'), $viewDatas) ?>
<?= validation_show_error('account_uid'); ?>
</td>
<td>
<?= form_dropdown('type', array_merge(["" => "Type 선택"], lang('Admin/Cloudflare/Record.TYPE')), old('type')) ?>
<?= validation_show_error('type'); ?>
</td>
<td>
<?= form_input('content', is_null(old('content')) ? DEFAULTS['EMPTY'] : old('content'), ["size" => 30]) ?>
<?= validation_show_error('content'); ?>
</td>
<td>
<?= form_textarea('domains', is_null(old('domains')) ? DEFAULTS['EMPTY'] : old('domains'), ["cols" => 30, "rows" => 5]) ?>
<?= validation_show_error('domains'); ?>
</td>
<td>
<?= form_dropdown('proxied', ["" => "CDN기능 선택", "on" => "사용", "off" => "사용 않함"], old('proxied')) ?>
<?= validation_show_error('proxied'); ?>
</td>
<td nowrap>
<?php foreach (explode(",", getenv("cfmgr.default.record.hosts")) as $host): ?>
<div style="text-align:left;">
<?= form_checkbox(["name" => "hosts[]", "value" => $host, "checked" => "checked"]); ?> <?= $host ?>
</div>
<?php endforeach; ?> <?php endforeach; ?>
</td>
<td><input type="submit" value="추가" class="btn btn-sm btn-primary btn-circle" type="button" /></td>
</tr> </tr>
<tr>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td nowrap>
<?= getFieldForm_ZoneHelper($field, isset($viewDatas[$field]) ? $viewDatas[$field] : old($field), $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
<?php $cnt++ ?>
<?php endforeach; ?>
</tr>
<tr>
<td valign="bottom" colspan="<?= $cnt * 2 ?>">
<?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?>
</td>
</tr>
<?= form_close(); ?>
</table> </table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')): ?> <?= session()->getFlashdata('error') ?><?php endif ?> <?php if (session()->getFlashdata('error')): ?> <?= session()->getFlashdata('error') ?><?php endif ?>

View File

@ -8,7 +8,7 @@
<nav class="condition nav"> <nav class="condition nav">
조건검색: 조건검색:
<?php foreach ($viewDatas['filter_fields'] as $field): ?> <?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= getFieldForm_ZoneHelper($field, $viewDatas[$field], $viewDatas) ?> <?= getFieldForm_ZoneHelper($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
</nav> </nav>
<nav class="search nav justify-content-center"> <nav class="search nav justify-content-center">
@ -40,10 +40,10 @@
<?php $cnt = 0 ?> <?php $cnt = 0 ?>
<?php $old_account = '' ?> <?php $old_account = '' ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?> <?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> <tr id="<?= $entity->getPK() ?>" <?= $entity->status != 'active' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap"> <td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?> <?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/modify/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> <?= anchor(current_url() . '/sync/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td> </td>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_ZoneHelper($field, $entity, $viewDatas, ['old_account' => $old_account]) ?></td> <td><?= getFieldView_ZoneHelper($field, $entity, $viewDatas, ['old_account' => $old_account]) ?></td>
@ -57,6 +57,7 @@
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>
</table> </table>
<?= form_close() ?>
<div class="index_bottom"> <div class="index_bottom">
<ul class="nav justify-content-center"> <ul class="nav justify-content-center">
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li> <li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
@ -64,20 +65,13 @@
<?= getFieldForm_ZoneHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?> <?= getFieldForm_ZoneHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?> <?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li> <li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item">
<?= anchor(current_url() . '/create', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
</li>
</ul> </ul>
</div> </div>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div> <div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= form_close() ?> <div id="ActionForm" class="modal-body"></div>
<nav class="index_form navbar navbar-expand-lg"> <script>
<div class="container-fluid"> document.addEventListener('DOMContentLoaded', function() {
<nav class="nav"></nav> loadContentForm("<?= current_url() . "/create" ?>", document.getElementById('ActionForm'));
<nav id="index_create_form" class="nav justify-content-center"> });
<?= $this->include("{$viewDatas['class_path']}/create"); ?> </script>
</nav>
<nav class="nav justify-content-end"></nav>
</div>
</nav>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@ -1,7 +1,7 @@
<!-- left menu start --> <!-- left menu start -->
<link href="/css/<?= $viewDatas['layout'] ?>/left_menu.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/left_menu.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/left_menu.js"></script> <script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/left_menu.js"></script>
<div id="left_menu"> <div id="left_menu" onMouseOver="sideMenuToggle(this);" onMouseOut="sideMenuToggle(this);">
<div id="accordion" class="accordion accordion-flush"> <div id="accordion" class="accordion accordion-flush">
<div class="main"> <div class="main">
<a href="/admin/user"><?= ICONS["HOME"] ?> Main</a> <a href="/admin/user"><?= ICONS["HOME"] ?> Main</a>
@ -9,5 +9,5 @@
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/base'); ?> <?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/base'); ?>
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/cloudflare'); ?> <?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/cloudflare'); ?>
</div> </div>
<div id="menu_button" onClick="sideMenuToggle(this);">메뉴열기</div> <div id="menu_button">메뉴열기</div>
</div> </div>

View File

@ -6,15 +6,15 @@
</h2> </h2>
<div id="flush-heading1" class="accordion-collapse collapse show" aria-labelledby="flush-heading1"> <div id="flush-heading1" class="accordion-collapse collapse show" aria-labelledby="flush-heading1">
<div class="accordion-item"> <div class="accordion-item">
<a href="/admin/cloudflare/auth"><?= ICONS['MEMBER'] ?> Auth</a> <a href="/admin/cloudflare/auth"><?= ICONS['DATABASE'] ?> Auth</a>
</div> </div>
<div class="accordion-item"> <div class="accordion-item">
<a href="/admin/cloudflare/account"><?= ICONS['SIGNPOST'] ?> Account</a> <a href="/admin/cloudflare/account"><?= ICONS['SIGNPOST'] ?> Account</a>
</div> </div>
<div class="accordion-item"> <div class="accordion-item">
<a href="/admin/cloudflare/zone"><?= ICONS['SIGNPOST2'] ?> Zone</a> <a href="/admin/cloudflare/zone"><?= ICONS['BOXS'] ?> Zone</a>
</div> </div>
<div class="accordion-item"> <div class="accordion-item">
<a href="/admin/cloudflare/record"><?= ICONS['SIGNPOST'] ?> Record</a> <a href="/admin/cloudflare/record"><?= ICONS['BOX'] ?> Record</a>
</div> </div>
</div> </div>

View File

@ -0,0 +1,6 @@
<div id="ActionForm"></div>
<script>
document.addEventListener('DOMContentLoaded', function() {
loadContentForm("<?= current_url() . "/create" ?>", document.getElementById('ActionForm'));
});
</script>

View File

@ -0,0 +1,19 @@
<div id="AcionForm" class="modal fade" tabindex="-1" aria-labelledby="ActionFormModal" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="FormModal">Cloudflare DNS</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="form_page" class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
loadContentForm("<?= current_url() . "/create" ?>", document.getElementById('form_page'));
});
</script>

View File

@ -66,6 +66,7 @@ table.index_table thead th {
} }
div.index_bottom { div.index_bottom {
padding-top: 15px; padding-top: 15px;
text-align:center;
/* border: 1px solid red; */ /* border: 1px solid red; */
} }
@ -101,3 +102,20 @@ nav.index_form {
text-align:center; text-align:center;
/* border: 1px solid red; */ /* border: 1px solid red; */
} }
div#ActionForm {
margin-top:20px;
text-align:center;
/* border: 1px solid red; */
}
table.action_form {
margin:auto;
width:800px;
/* border: 1px solid blue; */
}
table.action_form td{
text-align:center;
}
table.action_form th{
text-align:center;
background-color:silver;
}

View File

@ -1,6 +1,6 @@
div#left_menu { div#left_menu {
position: fixed; position: fixed;
margin-top: 120px; margin-top: 60px;
z-index: 100; z-index: 100;
border: 1px solid silver; border: 1px solid silver;
} }
@ -10,7 +10,7 @@ div#left_menu div#menu_button {
top: -1px; top: -1px;
right: -21px; right: -21px;
width: 20px; width: 20px;
height: 180px; height: 160px;
cursor: pointer; cursor: pointer;
writing-mode: vertical-rl; writing-mode: vertical-rl;
/* 세로로 글자를 출력 */ /* 세로로 글자를 출력 */