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->post('create', 'AuthController::create');
|
||||
$routes->get('modify/(:num)', 'AuthController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'AuthController::modify/$1');
|
||||
$routes->get('view/(:num)', 'AuthController::view/$1');
|
||||
$routes->get('delete/(:num)', 'AuthController::delete/$1');
|
||||
$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->get('/', 'AccountController::index');
|
||||
$routes->get('view/(:alphanum)', 'AccountController::view/$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->get('/', 'ZoneController::index');
|
||||
|
||||
@ -13,7 +13,6 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
class AccountController extends CloudflareController
|
||||
{
|
||||
private $_model = null;
|
||||
private $_auth_entity = null;
|
||||
private $_myLibrays = [];
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -26,10 +25,10 @@ class AccountController extends CloudflareController
|
||||
}
|
||||
final protected function getModel(): AccountModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new AccountModel();
|
||||
if ($this->model === null) {
|
||||
$this->model = new AccountModel();
|
||||
}
|
||||
return $this->_model;
|
||||
return $this->model;
|
||||
}
|
||||
final protected function getMyLibrary(): Account
|
||||
{
|
||||
@ -53,26 +52,31 @@ class AccountController extends CloudflareController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
private function init(string $action, array $fields = []): void
|
||||
{
|
||||
$this->action = __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->action = $action;
|
||||
$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->filter_fields = [$this->getModel()::PARENT, 'type', 'status'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_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();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->action = __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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
//reload Account By Auth
|
||||
|
||||
@ -12,7 +12,6 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
class AuthController extends CloudflareController
|
||||
{
|
||||
private $_model = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -23,47 +22,46 @@ class AuthController extends CloudflareController
|
||||
}
|
||||
final protected function getModel(): AuthModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new AuthModel();
|
||||
if ($this->model === null) {
|
||||
$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->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->filter_fields = ['status'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
$this->batchjob_fields = ['status'];
|
||||
}
|
||||
//생성
|
||||
public function create_form(): RedirectResponse|string
|
||||
{
|
||||
$this->init('create');
|
||||
$this->init('create', [$this->getModel()::TITLE, 'authkey', 'status']);
|
||||
return $this->create_form_procedure();
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'authkey', 'status']);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정
|
||||
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);
|
||||
}
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'authkey', 'status']);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batcjob(): RedirectResponse
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
$this->fields = ['status'];
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batcjob_procedure();
|
||||
}
|
||||
//View
|
||||
@ -75,23 +73,13 @@ class AuthController extends CloudflareController
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->action = __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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->action = __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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,10 +26,10 @@ class RecordController extends CloudflareController
|
||||
}
|
||||
final protected function getModel(): RecordModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new RecordModel();
|
||||
if ($this->model === null) {
|
||||
$this->model = new RecordModel();
|
||||
}
|
||||
return $this->_model;
|
||||
return $this->model;
|
||||
}
|
||||
final protected function getMyLibrary(): Record
|
||||
{
|
||||
@ -69,18 +69,21 @@ class RecordController extends CloudflareController
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
private function init(string $action): void
|
||||
private function init(string $action, array $fields = []): void
|
||||
{
|
||||
$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->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->batchjob_fields = ['type', 'content', 'proxied'];
|
||||
}
|
||||
//생성
|
||||
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;
|
||||
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
|
||||
return $this->create_form_procedure();
|
||||
@ -132,15 +135,13 @@ class RecordController extends CloudflareController
|
||||
}
|
||||
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->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);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_process_result();
|
||||
}
|
||||
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();
|
||||
}
|
||||
//수정 (modify,toggle,batchjob사용)
|
||||
@ -170,16 +171,7 @@ class RecordController extends CloudflareController
|
||||
//일괄처리작업
|
||||
public function batcjob(): RedirectResponse
|
||||
{
|
||||
$this->action = __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);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batcjob_procedure();
|
||||
}
|
||||
//View
|
||||
@ -200,11 +192,7 @@ class RecordController extends CloudflareController
|
||||
}
|
||||
public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->action = __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->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//삭제
|
||||
@ -253,23 +241,13 @@ class RecordController extends CloudflareController
|
||||
}
|
||||
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->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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->action = __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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
//Sync작업
|
||||
|
||||
@ -17,7 +17,6 @@ class ZoneController extends CloudflareController
|
||||
{
|
||||
private $_account_entity = null;
|
||||
private $_myLibrays = [];
|
||||
private $_model = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -28,10 +27,10 @@ class ZoneController extends CloudflareController
|
||||
}
|
||||
final protected function getModel(): ZoneModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new ZoneModel();
|
||||
if ($this->model === null) {
|
||||
$this->model = new ZoneModel();
|
||||
}
|
||||
return $this->_model;
|
||||
return $this->model;
|
||||
}
|
||||
final protected function getMyLibrary(): Zone
|
||||
{
|
||||
@ -80,18 +79,23 @@ class ZoneController extends CloudflareController
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
private function init(string $action): void
|
||||
private function init(string $action, array $fields = []): void
|
||||
{
|
||||
$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->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->batchjob_fields = ['development_mode', 'ipv6', 'security_level'];
|
||||
}
|
||||
//생성
|
||||
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;
|
||||
$this->$parent_field = $this->request->getVar($parent_field) ?: DEFAULTS["EMPTY"];
|
||||
return $this->create_form_procedure();
|
||||
@ -171,15 +175,15 @@ class ZoneController extends CloudflareController
|
||||
}
|
||||
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->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);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_process_result();
|
||||
}
|
||||
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();
|
||||
}
|
||||
//수정 (modify,toggle,batchjob사용)
|
||||
@ -201,16 +205,7 @@ class ZoneController extends CloudflareController
|
||||
//일괄처리작업
|
||||
public function batcjob(): RedirectResponse
|
||||
{
|
||||
$this->action = __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);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batcjob_procedure();
|
||||
}
|
||||
//View
|
||||
@ -236,11 +231,7 @@ class ZoneController extends CloudflareController
|
||||
}
|
||||
public function view(string $uid): RedirectResponse|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->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);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//삭제
|
||||
@ -295,23 +286,13 @@ class ZoneController extends CloudflareController
|
||||
}
|
||||
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->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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|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->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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
//Sync작업
|
||||
|
||||
@ -13,7 +13,6 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
class MapurlController extends AdminController
|
||||
{
|
||||
private $_model = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -24,36 +23,19 @@ class MapurlController extends AdminController
|
||||
}
|
||||
protected function getModel(): MapurlModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new MapurlModel();
|
||||
if ($this->model === null) {
|
||||
$this->model = new MapurlModel();
|
||||
}
|
||||
return $this->_model;
|
||||
return $this->model;
|
||||
}
|
||||
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) {
|
||||
default:
|
||||
$formDatas = parent::getFormData($field, $formDatas);
|
||||
break;
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
private function init(string $action): void
|
||||
private function init(string $action, array $fields = []): void
|
||||
{
|
||||
$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->filter_fields = ['status'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
$this->batchjob_fields = ['status'];
|
||||
}
|
||||
private function remaping_process(): void
|
||||
{
|
||||
@ -75,7 +57,7 @@ class MapurlController extends AdminController
|
||||
//생성
|
||||
public function create_form(): RedirectResponse|string
|
||||
{
|
||||
$this->init('create');
|
||||
$this->init('create', [$this->getModel()::TITLE, 'newurl', 'status']);
|
||||
return $this->create_form_procedure();
|
||||
}
|
||||
protected function create_process(): void
|
||||
@ -85,13 +67,13 @@ class MapurlController extends AdminController
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'newurl', 'status']);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정
|
||||
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);
|
||||
}
|
||||
//(modify,toggle,batchjob사용)
|
||||
@ -102,15 +84,13 @@ class MapurlController extends AdminController
|
||||
}
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
$this->init(__FUNCTION__, [$this->getModel()::TITLE, 'newurl', 'status']);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batcjob(): RedirectResponse
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
$this->fields = ['status'];
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batcjob_procedure();
|
||||
}
|
||||
//View
|
||||
@ -128,24 +108,14 @@ class MapurlController extends AdminController
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->action = __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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->action = __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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserController extends AdminController
|
||||
{
|
||||
private $_model = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -25,12 +24,12 @@ class UserController extends AdminController
|
||||
}
|
||||
protected function getModel(): UserModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new UserModel();
|
||||
if ($this->model === null) {
|
||||
$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) {
|
||||
case 'role':
|
||||
@ -38,20 +37,11 @@ class UserController extends AdminController
|
||||
$validation->setRule($field . ".*", $field, $this->getModel()->getFieldRule($action, $field));
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setFormFieldRule($field, $validation, $action);
|
||||
$validation = parent::setValidationRule($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) {
|
||||
@ -80,42 +70,40 @@ class UserController extends AdminController
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
private function init(string $action): void
|
||||
private function init(string $action, array $fields = []): void
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->fields = ['id', 'passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role'];
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->fields = count($fields) ? $fields : ['id', $this->getModel()::TITLE, 'email', 'mobile', 'role', 'updated_at', 'created_at'];
|
||||
$this->filter_fields = ['role', 'status'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
$this->batchjob_fields = ['status'];
|
||||
}
|
||||
//생성
|
||||
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();
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
$this->init(__FUNCTION__, ['id', 'passwd', 'confirmpassword', $this->getModel()::TITLE, 'email', 'mobile', 'role']);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
//일괄작업
|
||||
public function batcjob(): RedirectResponse
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
$this->fields = ['status'];
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batcjob_procedure();
|
||||
}
|
||||
//View
|
||||
@ -127,23 +115,13 @@ class UserController extends AdminController
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->action = __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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->action = __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'];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserSNSController extends AdminController
|
||||
{
|
||||
private $_model = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -26,19 +25,10 @@ class UserSNSController extends AdminController
|
||||
}
|
||||
protected function getModel(): UserSNSModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new UserSNSModel();
|
||||
if ($this->model === null) {
|
||||
$this->model = new UserSNSModel();
|
||||
}
|
||||
return $this->_model;
|
||||
}
|
||||
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$validation = parent::setFormFieldRule($field, $validation, $action);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
return $this->model;
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
@ -56,62 +46,42 @@ class UserSNSController extends AdminController
|
||||
}
|
||||
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
|
||||
private function init(string $action, array $fields = []): void
|
||||
{
|
||||
$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->filter_fields = [$this->getModel()::PARENT, 'status'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
$this->batchjob_fields = [];
|
||||
}
|
||||
//수정
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
//일괄작업
|
||||
public function batcjob(): RedirectResponse
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
$this->fields = ['status'];
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->batcjob_procedure();
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
{
|
||||
$this->action = __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 = [];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|string
|
||||
{
|
||||
$this->action = __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 = [];
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
abstract protected function getModel(): mixed;
|
||||
//Field별 Form Rule용
|
||||
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
||||
protected function setValidationRule($field, Validation $validation, string $action): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
@ -30,10 +30,10 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
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) {
|
||||
$validation = $this->setFormFieldRule($field, $validation, $action);
|
||||
$validation = $this->setValidationRule($field, $validation, $action);
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
@ -96,11 +96,11 @@ abstract class MVController extends CommonController
|
||||
protected function create_validate(string $action, array $fields): void
|
||||
{
|
||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
|
||||
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
||||
if (!$this->validation->withRequest($this->request)->run()) {
|
||||
$validation = $this->getValidation($fields, service('validation'), $action);
|
||||
if (!$validation->withRequest($this->request)->run()) {
|
||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
||||
"\n",
|
||||
$this->validation->getErrors()
|
||||
$validation->getErrors()
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -112,7 +112,7 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
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);
|
||||
}
|
||||
final protected function create_procedure(): RedirectResponse|string
|
||||
@ -156,14 +156,14 @@ abstract class MVController extends CommonController
|
||||
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()보다 먼처 체크필요
|
||||
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
||||
if (!$this->validation->withRequest($this->request)->run()) {
|
||||
$validation = $this->getValidation($fields, service('validation'), $action);
|
||||
if (!$validation->withRequest($this->request)->run()) {
|
||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
||||
"\n",
|
||||
$this->validation->getErrors()
|
||||
$validation->getErrors()
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -180,7 +180,7 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
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);
|
||||
}
|
||||
final protected function modify_procedure(mixed $uid): RedirectResponse|string
|
||||
@ -207,6 +207,14 @@ abstract class MVController extends CommonController
|
||||
//Transaction Start
|
||||
$this->getModel()->transStart();
|
||||
try {
|
||||
//데이터가 있는경우 Field만 처리하기위해
|
||||
$fields = [];
|
||||
foreach ($this->batchjob_fields as $field) {
|
||||
if ($this->request->getVar($field)) {
|
||||
$fields[$field] = $field;
|
||||
}
|
||||
}
|
||||
$this->fields = $fields;
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getVar('batchjob_uids');
|
||||
if (!$uids) {
|
||||
|
||||
@ -11,12 +11,10 @@ use CodeIgniter\HTTP\RedirectResponse;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserController extends FrontController
|
||||
{
|
||||
private $_model = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -27,61 +25,21 @@ class UserController extends FrontController
|
||||
}
|
||||
protected function getModel(): UserModel
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$this->_model = new UserModel();
|
||||
if ($this->model === null) {
|
||||
$this->model = new UserModel();
|
||||
}
|
||||
return $this->_model;
|
||||
return $this->model;
|
||||
}
|
||||
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule($field . ".*", $field, $this->getModel()->getFieldRule($action, $field));
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setFormFieldRule($field, $validation, $action);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
protected function getFormData(string $field, array $formDatas): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
$roles = $this->request->getVar($field) ?? [];
|
||||
if (!count($roles)) {
|
||||
throw new \Exception("권한이 지정되지 않았습니다.");
|
||||
}
|
||||
$formDatas[$field] = implode(DEFAULTS["DELIMITER_ROLE"], $roles);
|
||||
break;
|
||||
default:
|
||||
$formDatas = parent::getFormData($field, $formDatas);
|
||||
break;
|
||||
}
|
||||
return $formDatas;
|
||||
}
|
||||
|
||||
private function init(string $action): void
|
||||
private function init(string $action, array $fields = []): void
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->fields = ['id', 'passwd'];
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->fields = count($fields) ? $fields : ['id', 'passwd'];
|
||||
}
|
||||
//로그인화면
|
||||
public function login_form(): RedirectResponse|string
|
||||
{
|
||||
$this->init('login');
|
||||
try {
|
||||
$this->init('login');
|
||||
helper(['form']);
|
||||
//구글 로그인 BUTTON용
|
||||
$google_socket = new GoogleSocket();
|
||||
@ -99,8 +57,8 @@ class UserController extends FrontController
|
||||
//로그인처리
|
||||
public function login(): RedirectResponse|string
|
||||
{
|
||||
$this->init('login');
|
||||
try {
|
||||
$this->init('login');
|
||||
$this->create_validate($this->action, $this->fields);
|
||||
$this->formDatas = $this->getFormDatas();
|
||||
$auth = new LocalAuth();
|
||||
@ -116,7 +74,6 @@ class UserController extends FrontController
|
||||
}
|
||||
public function google_login(): RedirectResponse|string
|
||||
{
|
||||
$this->init('login');
|
||||
try {
|
||||
$access_code = $this->request->getVar('code');
|
||||
if (!$access_code) {
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Helpers\Cloudflare;
|
||||
|
||||
use App\Helpers\CommonHelper;
|
||||
use App\Helpers\MVCHelper;
|
||||
use App\Models\Cloudflare\AccountModel;
|
||||
|
||||
class AccountHelper extends CommonHelper
|
||||
class AccountHelper extends MVCHelper
|
||||
{
|
||||
public $old_parent = "";
|
||||
public function __construct()
|
||||
@ -14,6 +14,9 @@ class AccountHelper extends CommonHelper
|
||||
}
|
||||
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 AccountModel::PARENT:
|
||||
@ -77,7 +80,7 @@ class AccountHelper extends CommonHelper
|
||||
"class" => "btn btn-sm btn-primary btn-circle",
|
||||
"target" => "_self",
|
||||
]
|
||||
) . " <span class=\"label_Accounts\">{$value}</span>";
|
||||
) . " " . parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
case 'type':
|
||||
case 'status':
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Helpers\Cloudflare;
|
||||
|
||||
use App\Helpers\CommonHelper;
|
||||
use App\Helpers\MVCHelper;
|
||||
use App\Models\Cloudflare\AuthModel;
|
||||
|
||||
class AuthHelper extends CommonHelper
|
||||
class AuthHelper extends MVCHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@ -13,6 +13,9 @@ class AuthHelper extends CommonHelper
|
||||
}
|
||||
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 AuthModel::TITLE:
|
||||
@ -44,7 +47,7 @@ class AuthHelper extends CommonHelper
|
||||
"class" => "btn btn-sm btn-primary btn-circle",
|
||||
"target" => "_self"
|
||||
]
|
||||
) . " <span class=\"label_Auths\">{$value}</span>";
|
||||
) . " " . parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Helpers\Cloudflare;
|
||||
|
||||
use App\Helpers\CommonHelper;
|
||||
use App\Helpers\MVCHelper;
|
||||
use App\Models\Cloudflare\RecordModel;
|
||||
|
||||
class RecordHelper extends CommonHelper
|
||||
class RecordHelper extends MVCHelper
|
||||
{
|
||||
public $old_parent = "";
|
||||
public function __construct()
|
||||
@ -27,6 +27,9 @@ class RecordHelper extends CommonHelper
|
||||
}
|
||||
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 RecordModel::PARENT:
|
||||
@ -80,15 +83,22 @@ class RecordHelper extends CommonHelper
|
||||
"class" => "btn btn-sm btn-primary btn-circle",
|
||||
"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();
|
||||
break;
|
||||
case RecordModel::TITLE:
|
||||
$url = sprintf("%s/toggle/%s/fixed?fixed=%s", current_url(), $viewDatas['entity']->getPK(), $viewDatas['entity']->fixed == 'on' ? "off" : "on");
|
||||
$fixed = $viewDatas['entity']->fixed == 'on' ? "<span class=\"text-danger\">" . ICONS['LOCK'] . "</span>" : "";
|
||||
$value = sprintf("%s<span class=\"label_hosts\" style=\"font-weight:bold;\">%s</span>", $fixed, $value);
|
||||
$value = anchor($url, $value, ["target" => "_self"]);
|
||||
$value = parent::getFieldView($field, $viewDatas, ['class' => "label_hosts", ...$extras]);
|
||||
$fixed = anchor(
|
||||
sprintf("%s/toggle/%s/fixed?fixed=%s", current_url(), $viewDatas['entity']->getPK(), $viewDatas['entity']->fixed == 'on' ? "off" : "on"),
|
||||
$viewDatas['entity']->fixed == 'on' ? "<span class=\"text-danger\">" . ICONS['LOCK'] . "</span>" : ICONS['UNLOCK'],
|
||||
["class" => "ext-danger", "style" => "float:right;", ...$extras]
|
||||
);
|
||||
$value = $fixed . " " . $value;
|
||||
break;
|
||||
case 'content':
|
||||
// 값이 40자 이상인 경우 자르고 '...' 추가
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Helpers\Cloudflare;
|
||||
|
||||
use App\Helpers\CommonHelper;
|
||||
use App\Helpers\MVCHelper;
|
||||
use App\Models\Cloudflare\ZoneModel;
|
||||
|
||||
class ZoneHelper extends CommonHelper
|
||||
class ZoneHelper extends MVCHelper
|
||||
{
|
||||
public $old_parent = "";
|
||||
public function __construct()
|
||||
@ -14,6 +14,9 @@ class ZoneHelper extends CommonHelper
|
||||
}
|
||||
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 ZoneModel::PARENT:
|
||||
@ -98,7 +101,7 @@ class ZoneHelper extends CommonHelper
|
||||
"class" => "btn btn-sm btn-primary btn-circle",
|
||||
"target" => "_self"
|
||||
]
|
||||
) . " <span class=\"label_zones\" style=\"font-weight:bold;\"><b>{$value}</b></span>";
|
||||
) . " " . parent::getFieldView($field, $viewDatas, ['class' => "label_zones", ...$extras]);
|
||||
break;
|
||||
case 'name_servers':
|
||||
case 'original_name_servers':
|
||||
|
||||
@ -128,154 +128,4 @@ class CommonHelper
|
||||
}
|
||||
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;
|
||||
|
||||
class MapurlHelper extends CommonHelper
|
||||
class MapurlHelper extends MVCHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@ -12,6 +12,9 @@ class MapurlHelper extends CommonHelper
|
||||
}
|
||||
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 MapurlModel::TITLE:
|
||||
|
||||
@ -4,7 +4,7 @@ namespace App\Helpers;
|
||||
|
||||
use App\Models\UserModel;
|
||||
|
||||
class UserHelper extends CommonHelper
|
||||
class UserHelper extends MVCHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@ -12,6 +12,9 @@ class UserHelper extends CommonHelper
|
||||
}
|
||||
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 'id':
|
||||
|
||||
@ -4,7 +4,7 @@ namespace App\Helpers;
|
||||
|
||||
use App\Models\UserSNSModel;
|
||||
|
||||
class UserSNSHelper extends CommonHelper
|
||||
class UserSNSHelper extends MVCHelper
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@ -12,6 +12,9 @@ class UserSNSHelper extends CommonHelper
|
||||
}
|
||||
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 UserSNSModel::PARENT:
|
||||
|
||||
@ -10,8 +10,7 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<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, $extras) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field), $viewDatas) ?>
|
||||
<div><?= validation_show_error($field); ?></div>
|
||||
</td>
|
||||
<?php $cnt++ ?>
|
||||
|
||||
@ -17,14 +17,12 @@
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/resizeTable.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="index_body">
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
|
||||
<table class="index_table data table table-bordered table-hover table-striped"
|
||||
data-rtc-resizable-table="reisze_table">
|
||||
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="index_head_short_column">번호</th>
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?>
|
||||
</th>
|
||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?></th>
|
||||
<?php endforeach ?>
|
||||
<th class="index_head_short_column">작업</th>
|
||||
</tr>
|
||||
@ -35,23 +33,19 @@
|
||||
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
|
||||
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
|
||||
<?php $viewDatas['entity'] = $entity; ?>
|
||||
<td>
|
||||
<?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?>
|
||||
</td>
|
||||
<th><?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?></th>
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
<td>
|
||||
<?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?>
|
||||
</td>
|
||||
<th><?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?></th>
|
||||
</tr>
|
||||
<?php $cnt++ ?>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_batchjob"); ?>
|
||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||
</div>
|
||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></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'] ?>/index.js"></script>
|
||||
|
||||
@ -10,8 +10,7 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<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, $extras) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field, $viewDatas) ?>
|
||||
<div><?= validation_show_error($field); ?></div>
|
||||
</td>
|
||||
<?php $cnt++ ?>
|
||||
|
||||
@ -93,6 +93,11 @@ table.index_table thead th:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
table.index_table tbody th {
|
||||
text-align: center;
|
||||
/* border:1px solid silver; */
|
||||
}
|
||||
|
||||
div.index_batchjob {
|
||||
padding-top: 15px;
|
||||
text-align: center;
|
||||
|
||||
@ -93,12 +93,22 @@ table.index_table thead th:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
table.index_table tbody th {
|
||||
text-align: center;
|
||||
/* border:1px solid silver; */
|
||||
}
|
||||
|
||||
div.index_batchjob {
|
||||
padding-top: 15px;
|
||||
text-align: center;
|
||||
/* border: 1px solid red; */
|
||||
}
|
||||
|
||||
div.index_batchjob ul.nav li.nav-item {
|
||||
margin-left: 10px;
|
||||
/* border: 1px solid red; */
|
||||
}
|
||||
|
||||
div.index_pagination {
|
||||
margin-top: 20px;
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@ -133,7 +144,7 @@ div.index_pagination ul.pagination li a:hover {
|
||||
div.index_pagination ul.pagination li.active a {
|
||||
color: black;
|
||||
border: 1px solid #808080;
|
||||
}
|
||||
} */
|
||||
|
||||
div.index_bottom {
|
||||
padding-top: 15px;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user