cfmgrv4 init...1

This commit is contained in:
최준흠 2024-10-04 11:50:44 +09:00
parent d5fd167712
commit 6ac8f794ce
37 changed files with 670 additions and 341 deletions

View File

@ -105,7 +105,7 @@ define('DEFAULTS', [
define('FORMS', [
'MODAL' => 'modal_form',
'IFRAME' => 'iframe_form',
'ACTION' => 'action_form',
'DIRECT' => 'direct_form',
]);
//URL
define('URLS', [

View File

@ -18,5 +18,6 @@ abstract class AdminController extends MVController
$this->root = "Admin/";
$this->layout = "admin";
$this->session = $this->session_AuthTrait();
$this->action_form = FORMS['MODAL'];
}
}

View File

@ -22,7 +22,6 @@ class AccountController extends CloudflareController
$this->class_name = "Account";
$this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title");
$this->action_form = getenv("mvc.default." . strtolower($this->class_name) . ".form") ?: "modal_form";
helper($this->class_path);
}
final protected function getModel(): AccountModel

View File

@ -19,7 +19,6 @@ class AuthController extends CloudflareController
$this->class_name = "Auth";
$this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title");
$this->action_form = getenv("mvc.default." . strtolower($this->class_name) . ".form") ?: "modal_form";
helper($this->class_path);
}
final protected function getModel(): AuthModel

View File

@ -10,7 +10,6 @@ use App\Models\Cloudflare\ZoneModel;
use App\Models\Cloudflare\RecordModel;
use App\Models\Cloudflare\AuthModel;
use App\Models\Cloudflare\AccountModel;
use App\Entities\Cloudflare\AccountEntity;
use App\Controllers\Admin\AdminController;
abstract class CloudflareController extends AdminController

View File

@ -19,7 +19,6 @@ class RecordController extends CloudflareController
$this->class_name = "Record";
$this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title");
$this->action_form = getenv("mvc.default." . strtolower($this->class_name) . ".form") ?: "modal_form";
helper($this->class_path);
}
final protected function getModel(): RecordModel

View File

@ -22,7 +22,6 @@ class ZoneController extends CloudflareController
$this->class_name = "Zone";
$this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title");
$this->action_form = getenv("mvc.default." . strtolower($this->class_name) . ".form") ?: "modal_form";
helper($this->class_path);
}
final protected function getModel(): ZoneModel

View File

@ -19,7 +19,6 @@ class MapurlController extends AdminController
$this->class_name = "Mapurl";
$this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title");
$this->action_form = getenv("mvc.default." . strtolower($this->class_name) . ".form") ?: "modal_form";
helper($this->class_path);
}
protected function getModel(): MapurlModel

View File

@ -20,7 +20,6 @@ class UserController extends AdminController
$this->class_name = "User";
$this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title");
$this->action_form = getenv("mvc.default." . strtolower($this->class_name) . ".form") ?: "modal_form";
helper($this->class_path);
}
protected function getModel(): UserModel

View File

@ -1,6 +1,5 @@
<?php
use App\Entities\Cloudflare\AccountEntity;
use App\Models\Cloudflare\AccountModel;
function getFieldLabel_AccountHelper(string $field, array $viewDatas, array $extras = []): string
@ -53,17 +52,17 @@ function getFieldForm_AccountHelper(string $field, mixed $value, array $viewData
}
return $form;
} //
function getFieldView_AccountHelper(string $field, AccountEntity $entity, array $viewDatas, array $extras = [])
function getFieldView_AccountHelper(string $field, array $viewDatas, array $extras = [])
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case AccountModel::PARENT:
if ($extras['old_auth'] === $entity->getParent()) {
if ($viewDatas['old_auth'] === $viewDatas['entity']->getParent()) {
$value = "";
} else {
// dd($viewDatas['field_options']);
$value = anchor(
base_url() . strtolower($viewDatas['root']) . "auth/reload/" . $entity->getParent(),
base_url() . strtolower($viewDatas['root']) . "auth/reload/" . $viewDatas['entity']->getParent(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -76,7 +75,7 @@ function getFieldView_AccountHelper(string $field, AccountEntity $entity, array
break;
case AccountModel::TITLE:
$value = anchor(
current_url() . '/reload/' . $entity->getPK(),
current_url() . '/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -84,7 +83,7 @@ function getFieldView_AccountHelper(string $field, AccountEntity $entity, array
]
) . " " .
anchor(
base_url() . strtolower($viewDatas['root']) . "zone?account_uid=" . $entity->getPK(),
base_url() . strtolower($viewDatas['root']) . "zone?account_uid=" . $viewDatas['entity']->getPK(),
ICONS["FLAG"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -110,17 +109,17 @@ function getFieldView_AccountHelper(string $field, AccountEntity $entity, array
// $extras["onChange"] = sprintf(
// 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
// current_url(),
// $entity->getPK(),
// $viewDatas['entity']->getPK(),
// $field,
// $field
// );
// $value = getFieldForm_AccountHelper($field, $entity->$field, $viewDatas, $extras);
// $value = getFieldForm_AccountHelper($field, $viewDatas['entity']->$field, $viewDatas, $extras);
// }
break;
}
return $value;
} //
function getListColumns_AccountHelper(string $field, array $viewDatas, array $extras = []): string
function getListLabel_AccountHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_AccountHelper($field, $viewDatas, $extras);
if ($field == $viewDatas['order_field']) {
@ -131,10 +130,66 @@ function getListColumns_AccountHelper(string $field, array $viewDatas, array $ex
$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);
}
function getListButtonLabel_AccountHelper(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$label = form_label(
$label,
"",
[
"data-src" => $viewDatas['list_action_url'],
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
if ($action == 'create') {
$label = form_label($label, "", [
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
...$extras,
]);
} else {
$label = "";
}
break;
default:
$label = anchor($viewDatas['list_action_url'], $label, $extras);
break;
}
return $label;
}
function getListButton_AccountHelper(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
$viewDatas['list_action_url'] = $url = current_url() . '/' . $action;
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = getListButtonLabel_AccountHelper($action, '입력', $viewDatas, $extras);
break;
case 'modify':
// $checkbox = form_checkbox([
// "id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
// "name" => "batchjob_uids[]",
// "value" => $viewDatas['entity']->getPK(),
// "class" => "batchjobuids_checkboxs"
// ]);
// $viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
// $action = $checkbox . getListButtonLabel_AccountHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
$action = $viewDatas['cnt'];
break;
case 'delete':
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
$action = anchor($viewDatas['list_action_url'], ICONS['DELETE'], $extras);
break;
}
return $action;
}

View File

@ -1,6 +1,5 @@
<?php
use App\Entities\Cloudflare\AuthEntity;
use App\Models\Cloudflare\AuthModel;
function getFieldLabel_AuthHelper(string $field, array $viewDatas, array $extras = []): string
@ -38,13 +37,13 @@ function getFieldForm_AuthHelper(string $field, mixed $value, array $viewDatas,
}
return $form;
} //
function getFieldView_AuthHelper(string $field, AuthEntity $entity, array $viewDatas, array $extras = [])
function getFieldView_AuthHelper(string $field, array $viewDatas, array $extras = [])
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case AuthModel::TITLE:
$value = anchor(
current_url() . '/reload/' . $entity->getPK(),
current_url() . '/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -52,7 +51,7 @@ function getFieldView_AuthHelper(string $field, AuthEntity $entity, array $viewD
]
) . " " .
anchor(
base_url() . strtolower($viewDatas['root']) . "account?auth_uid=" . $entity->getPK(),
base_url() . strtolower($viewDatas['root']) . "account?auth_uid=" . $viewDatas['entity']->getPK(),
ICONS["FLAG"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -78,64 +77,17 @@ function getFieldView_AuthHelper(string $field, AuthEntity $entity, array $viewD
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$viewDatas['entity']->getPK(),
$field,
$field
);
$value = getFieldForm_AuthHelper($field, $entity->$field, $viewDatas, $extras);
$value = getFieldForm_AuthHelper($field, $viewDatas['entity']->$field, $viewDatas, $extras);
}
break;
}
return $value;
} //
function getListAction_AuthHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$url = current_url() . '/' . $action . '/' . $entity->getPK();
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$cnt,
"",
[
"data-src" => $url,
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = form_label($cnt, "", [
"onClick" => "changeIframe_src('{$url}')",
...$extras
]);
break;
default:
$value = anchor($url, $cnt, $extras);
break;
}
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_AuthHelper(string $field, array $viewDatas, array $extras = []): string
function getListLabel_AuthHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_AuthHelper($field, $viewDatas, $extras);
if ($field == $viewDatas['order_field']) {
@ -151,3 +103,60 @@ function getListColumns_AuthHelper(string $field, array $viewDatas, array $extra
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
}
function getListButtonLabel_AuthHelper(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$label = form_label(
$label,
"",
[
"data-src" => $viewDatas['list_action_url'],
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
if ($action == 'create') {
$label = form_label($label, "", [
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
...$extras,
]);
} else {
$label = "";
}
break;
default:
$label = anchor($viewDatas['list_action_url'], $label, $extras);
break;
}
return $label;
}
function getListButton_AuthHelper(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
$viewDatas['list_action_url'] = $url = current_url() . '/' . $action;
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = getListButtonLabel_AuthHelper($action, '입력', $viewDatas, $extras);
break;
case 'modify':
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
"name" => "batchjob_uids[]",
"value" => $viewDatas['entity']->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$action = $checkbox . getListButtonLabel_AuthHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
break;
case 'delete':
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
$action = anchor($viewDatas['list_action_url'], ICONS['DELETE'], $extras);
break;
}
return $action;
}

View File

@ -1,6 +1,5 @@
<?php
use App\Entities\Cloudflare\RecordEntity;
use App\Models\Cloudflare\RecordModel;
function getFieldLabel_RecordHelper(string $field, array $viewDatas, array $extras = []): string
@ -62,16 +61,16 @@ function getFieldForm_RecordHelper(string $field, mixed $value, array $viewDatas
}
return $form;
} //
function getFieldView_RecordHelper(string $field, RecordEntity $entity, array $viewDatas, array $extras = [])
function getFieldView_RecordHelper(string $field, array $viewDatas, array $extras = [])
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case RecordModel::PARENT:
if ($extras['old_zone'] === $entity->getParent()) {
if ($viewDatas['old_zone'] === $viewDatas['entity']->getParent()) {
$value = "";
} else {
$value = anchor(
base_url() . strtolower($viewDatas['root']) . 'zone/reload/' . $entity->getParent(),
base_url() . strtolower($viewDatas['root']) . 'zone/reload/' . $viewDatas['entity']->getParent(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -81,8 +80,8 @@ function getFieldView_RecordHelper(string $field, RecordEntity $entity, array $v
}
break;
case RecordModel::TITLE:
$url = sprintf("%s/toggle/%s?fixed=%s", current_url(), $entity->getPK(), $entity->fixed == 'on' ? "off" : "on");
$value = sprintf("%s%s", $entity->fixed == 'on' ? ICONS['LOCK'] : "", $value);
$url = sprintf("%s/toggle/%s?fixed=%s", current_url(), $viewDatas['entity']->getPK(), $viewDatas['entity']->fixed == 'on' ? "off" : "on");
$value = sprintf("%s%s", $viewDatas['entity']->fixed == 'on' ? ICONS['LOCK'] : "", $value);
$value = anchor($url, $value, ["target" => "_self"]);
break;
case 'category_uid':
@ -108,45 +107,18 @@ function getFieldView_RecordHelper(string $field, RecordEntity $entity, array $v
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$viewDatas['entity']->getPK(),
$field,
$field
);
$value = getFieldForm_RecordHelper($field, $entity->$field, $viewDatas, $extras);
$value = getFieldForm_RecordHelper($field, $viewDatas['entity']->$field, $viewDatas, $extras);
}
break;
}
return $value;
} //
function getListAction_RecordHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'sync':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = "";
if ($entity->fixed == 'off' && $entity->type == 'A') {
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs",
]);
}
$url = current_url() . '/' . $action . '/' . $entity->getPK();
$value = anchor($url, $cnt, $extras);
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_RecordHelper(string $field, array $viewDatas, array $extras = []): string
function getListLabel_RecordHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_RecordHelper($field, $viewDatas, $extras);
if ($field == $viewDatas['order_field']) {
@ -166,3 +138,86 @@ function getListColumns_RecordHelper(string $field, array $viewDatas, array $ext
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
}
function getListButtonLabel_RecordHelper(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$label,
"",
[
"data-src" => $viewDatas['list_action_url'],
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = "";
break;
default:
$value = anchor($viewDatas['list_action_url'], $label, $extras);
break;
}
break;
case 'modify':
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$label,
"",
[
"data-src" => $viewDatas['list_action_url'],
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = form_label($label, "", [
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
...$extras
]);
break;
default:
$value = anchor($viewDatas['list_action_url'], $label, $extras);
break;
}
break;
default:
break;
}
return $value;
}
function getListButton_RecordHelper(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
$viewDatas['list_action_url'] = $url = current_url() . '/' . $action;
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = getListButtonLabel_RecordHelper($action, '입력', $viewDatas, $extras);
break;
case 'sync':
$checkbox = "";
if ($viewDatas['entity']->type == "A" && $viewDatas['entity']->fixed != 'on')
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
"name" => "batchjob_uids[]",
"value" => $viewDatas['entity']->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$action = $checkbox . anchor($viewDatas['list_action_url'], $viewDatas['cnt'], $extras);
break;
case 'delete':
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
$action = anchor($viewDatas['list_action_url'], ICONS['DELETE'], $extras);
break;
}
return $action;
}

View File

@ -1,6 +1,5 @@
<?php
use App\Entities\Cloudflare\ZoneEntity;
use App\Models\Cloudflare\ZoneModel;
function getFieldLabel_ZoneHelper(string $field, array $viewDatas, array $extras = []): string
@ -71,16 +70,16 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas,
}
return $form;
} //
function getFieldView_ZoneHelper(string $field, ZoneEntity $entity, array $viewDatas, array $extras = [])
function getFieldView_ZoneHelper(string $field, array $viewDatas, array $extras = [])
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case ZoneModel::PARENT:
if ($extras['old_account'] === $entity->getParent()) {
if ($viewDatas['old_account'] === $viewDatas['entity']->getParent()) {
$value = "";
} else {
$value = anchor(
base_url() . strtolower($viewDatas['root']) . "account/reload/" . $entity->getParent(),
base_url() . strtolower($viewDatas['root']) . "account/reload/" . $viewDatas['entity']->getParent(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -93,7 +92,7 @@ function getFieldView_ZoneHelper(string $field, ZoneEntity $entity, array $viewD
break;
case ZoneModel::TITLE:
$value = anchor(
current_url() . '/reload/' . $entity->getPK(),
current_url() . '/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -101,7 +100,7 @@ function getFieldView_ZoneHelper(string $field, ZoneEntity $entity, array $viewD
]
) . " " .
anchor(
base_url() . strtolower($viewDatas['root']) . "record?zone_uid=" . $entity->getPK(),
base_url() . strtolower($viewDatas['root']) . "record?zone_uid=" . $viewDatas['entity']->getPK(),
ICONS["FLAG"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -136,42 +135,17 @@ function getFieldView_ZoneHelper(string $field, ZoneEntity $entity, array $viewD
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$viewDatas['entity']->getPK(),
$field,
$field
);
$value = getFieldForm_ZoneHelper($field, $entity->$field, $viewDatas, $extras);
$value = getFieldForm_ZoneHelper($field, $viewDatas['entity']->$field, $viewDatas, $extras);
}
break;
}
return $value;
} //
function getListAction_ZoneHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'sync':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs",
]);
$url = current_url() . '/' . $action . '/' . $entity->getPK();
$value = anchor($url, $cnt, $extras);
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_ZoneHelper(string $field, array $viewDatas, array $extras = []): string
function getListLabel_ZoneHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_ZoneHelper($field, $viewDatas, $extras);
if ($field == $viewDatas['order_field']) {
@ -190,3 +164,84 @@ function getListColumns_ZoneHelper(string $field, array $viewDatas, array $extra
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
}
function getListButtonLabel_ZoneHelper(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$label,
"",
[
"data-src" => $viewDatas['list_action_url'],
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = "";
break;
default:
$value = anchor($viewDatas['list_action_url'], $label, $extras);
break;
}
break;
case 'modify':
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$label,
"",
[
"data-src" => $viewDatas['list_action_url'],
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = form_label($label, "", [
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
...$extras
]);
break;
default:
$value = anchor($viewDatas['list_action_url'], $label, $extras);
break;
}
break;
default:
break;
}
return $value;
}
function getListButton_ZoneHelper(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
$viewDatas['list_action_url'] = $url = current_url() . '/' . $action;
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = getListButtonLabel_ZoneHelper($action, '입력', $viewDatas, $extras);
break;
case 'sync':
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
"name" => "batchjob_uids[]",
"value" => $viewDatas['entity']->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$action = $checkbox . anchor($viewDatas['list_action_url'], $viewDatas['cnt'], $extras);
break;
case 'delete':
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
$action = anchor($viewDatas['list_action_url'], ICONS['DELETE'], $extras);
break;
}
return $action;
}

View File

@ -1,6 +1,5 @@
<?php
use App\Entities\MapurlEntity;
use App\Models\MapurlModel;
function getFieldLabel_MapurlHelper(string $field, array $viewDatas, array $extras = []): string
@ -41,13 +40,13 @@ function getFieldForm_MapurlHelper(string $field, mixed $value, array $viewDatas
}
return $form;
} //
function getFieldView_MapurlHelper(string $field, MapurlEntity $entity, array $viewDatas, array $extras = [])
function getFieldView_MapurlHelper(string $field, array $viewDatas, array $extras = [])
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case MapurlModel::TITLE:
// $value = anchor(
// current_url() . '/view/' . $entity->getPK(),
// current_url() . '/view/' . $viewDatas['entity']->getPK(),
// $value,
// [
// "target" => "_self",
@ -72,64 +71,17 @@ function getFieldView_MapurlHelper(string $field, MapurlEntity $entity, array $v
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$viewDatas['entity']->getPK(),
$field,
$field
);
$value = getFieldForm_MapurlHelper($field, $entity->$field, $viewDatas, $extras);
$value = getFieldForm_MapurlHelper($field, $viewDatas['entity']->$field, $viewDatas, $extras);
}
break;
}
return $value;
} //
function getListAction_MapurlHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$url = current_url() . '/' . $action . '/' . $entity->getPK();
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$cnt,
"",
[
"data-src" => $url,
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = form_label($cnt, "", [
"onClick" => "changeIframe_src('{$url}')",
...$extras
]);
break;
default:
$value = anchor($url, $cnt, $extras);
break;
}
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_MapurlHelper(string $field, array $viewDatas, array $extras = []): string
function getListLabel_MapurlHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_MapurlHelper($field, $viewDatas, $extras);
if ($field == $viewDatas['order_field']) {
@ -145,22 +97,78 @@ function getListColumns_MapurlHelper(string $field, array $viewDatas, array $ext
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
}
function getListButtonLabel_MapurlHelper(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$label = form_label(
$label,
"",
[
"data-src" => $viewDatas['list_action_url'],
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
if ($action == 'create') {
$label = form_label($label, "", [
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
...$extras,
]);
} else {
$label = "";
}
break;
default:
$label = anchor($viewDatas['list_action_url'], $label, $extras);
break;
}
return $label;
}
function getListButton_MapurlHelper(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
$viewDatas['list_action_url'] = $url = current_url() . '/' . $action;
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = getListButtonLabel_MapurlHelper($action, '입력', $viewDatas, $extras);
break;
case 'modify':
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
"name" => "batchjob_uids[]",
"value" => $viewDatas['entity']->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$action = $checkbox . getListButtonLabel_MapurlHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
break;
case 'delete':
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
$action = anchor($viewDatas['list_action_url'], ICONS['DELETE'], $extras);
break;
}
return $action;
}
function getRemapPage_MapurlHelper(array $viewDatas): string
{
$urls = [];
foreach ($viewDatas['entitys'] as $entity) {
foreach ($viewDatas['entitys'] as $viewDatas['entity']) {
//한글을 포함하고 있는지 체크 HTTP 나 HTTPS 와 도메인 분리해서 한글도메인을 Punycode로 변환
if (preg_match("/[\xE0-\xFF][\x80-\xFF][\x80-\xFF]/", $entity->oldurl)) {
preg_match("/^(https?:\/\/)(.*)/", $entity->oldurl, $matches);
if (preg_match("/[\xE0-\xFF][\x80-\xFF][\x80-\xFF]/", $viewDatas['entity']->oldurl)) {
preg_match("/^(https?:\/\/)(.*)/", $viewDatas['entity']->oldurl, $matches);
$oldurl = $matches[1] . idn_to_ascii($matches[2]);
} else {
$oldurl = trim($entity->oldurl);
$oldurl = trim($viewDatas['entity']->oldurl);
}
$urls[] = sprintf(
"case '%s': window.location.href='%s'; break;",
$oldurl,
trim($entity->newurl)
trim($viewDatas['entity']->newurl)
);
}
return sprintf("

View File

@ -1,6 +1,5 @@
<?php
use App\Entities\UserEntity;
use App\Models\UserModel;
function getFieldLabel_UserHelper(string $field, array $viewDatas, array $extras = []): string
@ -62,13 +61,13 @@ function getFieldForm_UserHelper(string $field, mixed $value, array $viewDatas,
}
return $form;
} //
function getFieldView_UserHelper(string $field, UserEntity $entity, array $viewDatas, array $extras = [])
function getFieldView_UserHelper(string $field, array $viewDatas, array $extras = []): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case UserModel::TITLE:
// $value = anchor(
// current_url() . '/view/' . $entity->getPK(),
// current_url() . '/view/' . $viewDatas['entity']->getPK(),
// $value,
// [
// "target" => "_self",
@ -91,64 +90,17 @@ function getFieldView_UserHelper(string $field, UserEntity $entity, array $viewD
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$viewDatas['entity']->getPK(),
$field,
$field
);
$value = getFieldForm_UserHelper($field, $entity->$field, $viewDatas, $extras);
$value = getFieldForm_UserHelper($field, $viewDatas['entity']->$field, $viewDatas, $extras);
}
break;
}
return $value;
} //
function getListAction_UserHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$url = current_url() . '/' . $action . '/' . $entity->getPK();
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$cnt,
"",
[
"data-src" => $url,
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = form_label($cnt, "", [
"onClick" => "changeIframe_src('{$url}')",
...$extras
]);
break;
default:
$value = anchor($url, $cnt, $extras);
break;
}
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_UserHelper(string $field, array $viewDatas, array $extras = []): string
function getListLabel_UserHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_UserHelper($field, $viewDatas, $extras);
if ($field == $viewDatas['order_field']) {
@ -164,3 +116,60 @@ function getListColumns_UserHelper(string $field, array $viewDatas, array $extra
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
}
function getListButtonLabel_UserHelper(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$label = form_label(
$label,
"",
[
"data-src" => $viewDatas['list_action_url'],
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
if ($action == 'create') {
$label = form_label($label, "", [
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
...$extras,
]);
} else {
$label = "";
}
break;
default:
$label = anchor($viewDatas['list_action_url'], $label, $extras);
break;
}
return $label;
}
function getListButton_UserHelper(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
$viewDatas['list_action_url'] = $url = current_url() . '/' . $action;
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = getListButtonLabel_UserHelper($action, '입력', $viewDatas, $extras);
break;
case 'modify':
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$viewDatas['entity']->getPK()}",
"name" => "batchjob_uids[]",
"value" => $viewDatas['entity']->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$action = $checkbox . getListButtonLabel_UserHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
break;
case 'delete':
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
$action = anchor($viewDatas['list_action_url'], ICONS['DELETE'], $extras);
break;
}
return $action;
}

View File

@ -53,13 +53,12 @@ class AccountSocket extends CloudflareSocket
log_message("notice", "-----{$this->_auth_entity->getTitle()} 처리 시작-----");
$entity_uids = [];
$results = $this->reload_procedure("accounts");
//DB수정
foreach ($results as $result) {
foreach ($result as $item) {
$formDatas = $this->getArrayByResult($item);
$formDatas = $this->getArrayByResult($result);
$entity = $this->getModel()->modify($this->getModel()->getEntity(), $formDatas);
$entity_uids[] = $entity->getPK();
}
}
//부모키를 기준으로 CF에 존재하지 않는 데이터 삭제용
$this->getModel()->where(AccountModel::PARENT, $this->_auth_entity);
$this->getModel()->whereNotIn(AccountModel::PK, $entity_uids);

View File

@ -6,7 +6,6 @@ use App\Models\Cloudflare\RecordModel;
use App\Libraries\MySocket\CloudflareSocket;
use App\Entities\Cloudflare\ZoneEntity;
use App\Entities\Cloudflare\RecordEntity;
use App\Entities\Cloudflare\AuthEntity;
class RecordSocket extends CloudflareSocket
{
@ -136,14 +135,11 @@ class RecordSocket extends CloudflareSocket
$entity_uids = [];
$results = $this->reload_procedure("zones/{$this->_zone_entity->getPK()}/dns_records");
//DB수정
dd($results);
foreach ($results as $result) {
foreach ($result as $item) {
$formDatas = $this->getArrayByResult($item);
$formDatas = $this->getArrayByResult($result);
$entity = $this->getModel()->modify($this->getModel()->getEntity(), $formDatas);
$entity_uids[] = $entity->getPK();
}
}
//부모키를 기준으로 CF에 존재하지 않는 데이터 DB삭제
$this->getModel()->where(RecordModel::PARENT, $this->_zone_entity);
$this->getModel()->whereNotIn(RecordModel::PK, $entity_uids);

View File

@ -5,7 +5,6 @@ namespace App\Libraries\MySocket\Cloudflare;
use App\Models\Cloudflare\ZoneModel;
use App\Libraries\MySocket\CloudflareSocket;
use App\Entities\Cloudflare\ZoneEntity;
use App\Entities\Cloudflare\AuthEntity;
use App\Entities\Cloudflare\AccountEntity;
class ZoneSocket extends CloudflareSocket
@ -167,13 +166,12 @@ class ZoneSocket extends CloudflareSocket
log_message("notice", "-----{$this->_account_entity->getTitle()} 처리 시작-----");
$entity_uids = [];
$results = $this->reload_procedure('zones');
//DB수정
foreach ($results as $result) {
foreach ($result as $item) {
$formDatas = $this->getArrayByResult($item);
$formDatas = $this->getArrayByResult($result);
$entity = $this->getModel()->modify($this->getModel()->getEntity(), $formDatas);
$entity_uids[] = $entity->getPK();
}
}
//부모키를 기준으로 CF에 존재하지 않는 데이터 삭제용
$this->getModel()->where(ZoneModel::PARENT, $this->_account_entity);
$this->getModel()->whereNotIn(ZoneModel::PK, $entity_uids);

View File

@ -83,9 +83,14 @@ abstract class CloudflareSocket extends CommonLibrary
if (!$cf->success) {
throw new \Exception(__FUNCTION__ . "에서 실패:\n" . var_export($cf, true));
}
$results[] = $cf->result;
//Loop 제한 : 한페이지에서 가져온 갯수가 perpage_max보다 적다는것은 더이상 다음페이지기 없으므로 0로 종료시키기 위함
$page = count($cf->result) < $perpage_max ? 0 : $page + 1;
if (count($cf->result) < $perpage_max) {
$results = $cf->result;
$page = 0;
} else {
$results = array_merge($results, $cf->result);
$page++;
}
} while (0 < $page);
return $results;
}

View File

@ -3,31 +3,53 @@
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open("", $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListColumns_AccountHelper($field, $viewDatas) ?>
<?= getListLabel_AccountHelper($field, $viewDatas) ?>
<?php endforeach ?>
<th>작업</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php $old_auth = '' ?>
<?php $old_auth = "" ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<tr <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<?php $viewDatas['entity'] = $entity; ?>
<?php $viewDatas['old_auth'] = $old_auth ?>
<td class="text-center text-wrap">
<?= anchor(current_url() . '/sync/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
<?= getListButton_AccountHelper('modify', $viewDatas, ["style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_AccountHelper($field, $entity, $viewDatas, ['old_auth' => $old_auth]) ?></td>
<td><?= getFieldView_AccountHelper($field, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= getListButton_AccountHelper('delete', $viewDatas) ?>
</td>
</tr>
<?php $old_auth = $entity->getParent() ?>
<?php $cnt++ ?>
<?php $old_auth = $entity->getParent(); ?>
<?php endforeach ?>
</tbody>
</table>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<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("", '일괄처리', ['formaction' => current_url() . '/batchjob', "class" => "btn btn-outline btn-warning"]) ?></li>
<li class="nav-item"><?= getListButton_AccountHelper('create', $viewDatas, ["style" => "cursor:pointer"]) ?></li>
</ul>
</div>
<?= form_close() ?>
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
<?php if (in_array($viewDatas['action_form'], [FORMS['MODAL'], FORMS['IFRAME']])): ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<?php endif ?>
<?= $this->endSection() ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->extend("layouts/{$viewDatas['layout']}/{$viewDatas['action_form']}") ?>
<?= $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']) ?>

View File

@ -9,7 +9,7 @@
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListColumns_AuthHelper($field, $viewDatas) ?>
<?= getListLabel_AuthHelper($field, $viewDatas) ?>
<?php endforeach ?>
<th>작업</th>
</tr>
@ -17,15 +17,17 @@
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<tr <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<?php $viewDatas['entity'] = $entity; ?>
<td class="text-center text-wrap">
<?= getListAction_AuthHelper('modify', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
<?= getListButton_AuthHelper('modify', $viewDatas, ["style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_AuthHelper($field, $entity, $viewDatas) ?></td>
<td><?= getFieldView_AuthHelper($field, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= getListAction_AuthHelper('delete', $entity, $viewDatas) ?>
<?= getListButton_AuthHelper('delete', $viewDatas) ?>
</td>
</tr>
<?php $cnt++ ?>
@ -39,10 +41,12 @@
<?= getFieldForm_AuthHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit("", '일괄처리', ['formaction' => current_url() . '/batchjob', "class" => "btn btn-outline btn-warning"]) ?></li>
<li class="nav-item"><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/create' ?>">입력</button></li>
<li class="nav-item"><?= getListButton_AuthHelper('create', $viewDatas, ["style" => "cursor:pointer"]) ?></li>
</ul>
</div>
<?= form_close() ?>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
<?php if (in_array($viewDatas['action_form'], [FORMS['MODAL'], FORMS['IFRAME']])): ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<?php endif ?>
<?= $this->endSection() ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->extend("layouts/{$viewDatas['layout']}/{$viewDatas['action_form']}") ?>
<?= $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']) ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->extend("layouts/{$viewDatas['layout']}/{$viewDatas['action_form']}") ?>
<?= $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']) ?>

View File

@ -9,28 +9,31 @@
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListColumns_RecordHelper($field, $viewDatas) ?>
<?= getListLabel_RecordHelper($field, $viewDatas) ?>
<?php endforeach ?>
<th>작업</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php $old_zone = '' ?>
<?php $old_zone = "" ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->locked != 'on' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<tr <?= $entity->locked != 'on' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<?php $viewDatas['entity'] = $entity; ?>
<?php $viewDatas['old_zone'] = $old_zone ?>
<td class="text-center text-wrap">
<?= getListAction_RecordHelper('sync', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
<?= getListButton_RecordHelper('sync', $viewDatas, ["style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_RecordHelper($field, $entity, $viewDatas, ['old_zone' => $old_zone]) ?></td>
<td><?= getFieldView_RecordHelper($field, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= getListAction_RecordHelper('delete', $entity, $viewDatas) ?>
<?= getListButton_RecordHelper('delete', $viewDatas) ?>
</td>
</tr>
<?php $old_zone = $entity->getParent() ?>
<?php $cnt++ ?>
<?php $old_zone = $entity->getParent(); ?>
<?php endforeach ?>
</tbody>
</table>
@ -41,10 +44,12 @@
<?= getFieldForm_RecordHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit("", '일괄처리', ['formaction' => current_url() . '/batchjob', "class" => "btn btn-outline btn-warning"]) ?></li>
<li class="nav-item"><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/create' ?>">입력</button></li>
<li class="nav-item"><?= getListButton_RecordHelper('create', $viewDatas, ["style" => "cursor:pointer"]) ?></li>
</ul>
</div>
<?= form_close() ?>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
<?php if (in_array($viewDatas['action_form'], [FORMS['MODAL'], FORMS['IFRAME']])): ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<?php endif ?>
<?= $this->endSection() ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->extend("layouts/{$viewDatas['layout']}/{$viewDatas['action_form']}") ?>
<?= $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']) ?>

View File

@ -9,28 +9,31 @@
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListColumns_ZoneHelper($field, $viewDatas) ?>
<?= getListLabel_ZoneHelper($field, $viewDatas) ?>
<?php endforeach ?>
<th>작업</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php $old_account = '' ?>
<?php $old_account = "" ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != 'active' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<tr <?= $entity->status != 'active' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<?php $viewDatas['entity'] = $entity ?>
<?php $viewDatas['old_account'] = $old_account ?>
<td class="text-center text-wrap">
<?= getListAction_ZoneHelper('sync', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
<?= getListButton_ZoneHelper('sync', $viewDatas, ["style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_ZoneHelper($field, $entity, $viewDatas, ['old_account' => $old_account]) ?></td>
<td><?= getFieldView_ZoneHelper($field, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= getListAction_ZoneHelper('delete', $entity, $viewDatas) ?>
<?= getListButton_ZoneHelper('delete', $viewDatas) ?>
</td>
</tr>
<?php $old_account = $entity->getParent() ?>
<?php $cnt++ ?>
<?php $old_account = $entity->getParent(); ?>
<?php endforeach ?>
</tbody>
</table>
@ -41,10 +44,12 @@
<?= getFieldForm_ZoneHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit("", '일괄처리', ['formaction' => current_url() . '/batchjob', "class" => "btn btn-outline btn-warning"]) ?></li>
<li class="nav-item"><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/create' ?>">입력</button></li>
<li class="nav-item"><?= getListButton_ZoneHelper('create', $viewDatas, ["style" => "cursor:pointer"]) ?></li>
</ul>
</div>
<?= form_close() ?>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
<?php if (in_array($viewDatas['action_form'], [FORMS['MODAL'], FORMS['IFRAME']])): ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<?php endif ?>
<?= $this->endSection() ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->extend("layouts/{$viewDatas['layout']}/{$viewDatas['action_form']}") ?>
<?= $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']) ?>

View File

@ -2,14 +2,14 @@
<?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/content.js"></script>
<?= form_open("", $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open("", $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListColumns_MapurlHelper($field, $viewDatas) ?>
<?= getListLabel_MapurlHelper($field, $viewDatas) ?>
<?php endforeach ?>
<th>작업</th>
</tr>
@ -17,15 +17,17 @@
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<tr <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<?php $viewDatas['entity'] = $entity; ?>
<td class="text-center text-wrap">
<?= getListAction_MapurlHelper('modify', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
<?= getListButton_MapurlHelper('modify', $viewDatas, ["style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_MapurlHelper($field, $entity, $viewDatas) ?></td>
<td><?= getFieldView_MapurlHelper($field, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= getListAction_MapurlHelper('delete', $entity, $viewDatas) ?>
<?= getListButton_MapurlHelper('delete', $viewDatas) ?>
</td>
</tr>
<?php $cnt++ ?>
@ -39,10 +41,12 @@
<?= getFieldForm_MapurlHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit("", '일괄처리', ['formaction' => current_url() . '/batchjob', "class" => "btn btn-outline btn-warning"]) ?></li>
<li class="nav-item"><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/create' ?>">입력</button></li>
<li class="nav-item"><?= getListButton_MapurlHelper('create', $viewDatas, ["style" => "cursor:pointer"]) ?></li>
</ul>
</div>
<?= form_close() ?>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
<?php if (in_array($viewDatas['action_form'], [FORMS['MODAL'], FORMS['IFRAME']])): ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<?php endif ?>
<?= $this->endSection() ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->extend("layouts/{$viewDatas['layout']}/{$viewDatas['action_form']}") ?>
<?= $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']) ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->extend("layouts/{$viewDatas['layout']}/{$viewDatas['action_form']}") ?>
<?= $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']) ?>

View File

@ -9,7 +9,7 @@
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListColumns_UserHelper($field, $viewDatas) ?>
<?= getListLabel_UserHelper($field, $viewDatas) ?>
<?php endforeach ?>
<th>작업</th>
</tr>
@ -18,14 +18,16 @@
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
<?php $viewDatas['entity'] = $entity; ?>
<td class="text-center text-wrap">
<?= getListAction_UserHelper('modify', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
<?= getListButton_UserHelper('modify', $viewDatas, ["style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_UserHelper($field, $entity, $viewDatas) ?></td>
<td><?= getFieldView_UserHelper($field, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= getListAction_UserHelper('delete', $entity, $viewDatas) ?>
<?= getListButton_UserHelper('delete', $viewDatas) ?>
</td>
</tr>
<?php $cnt++ ?>
@ -39,10 +41,12 @@
<?= getFieldForm_UserHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit("", '일괄처리', ['formaction' => current_url() . '/batchjob', "class" => "btn btn-outline btn-warning"]) ?></li>
<li class="nav-item"><button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/create' ?>">입력</button></li>
<li class="nav-item"><?= getListButton_UserHelper('create', $viewDatas, ["style" => "cursor:pointer"]) ?></li>
</ul>
</div>
<?= form_close() ?>
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<?php if (in_array($viewDatas['action_form'], [FORMS['MODAL'], FORMS['IFRAME']])): ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
<?php endif ?>
<?= $this->endSection() ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->extend("layouts/{$viewDatas['layout']}/{$viewDatas['action_form']}") ?>
<?= $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']) ?>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title><?= $viewDatas['title'] ?></title>
<?php foreach (LAYOUTS[$viewDatas['layout']]['stylesheets'] as $stylesheet): ?>
<?= $stylesheet ?>
<?php endforeach; ?>
<?php foreach (LAYOUTS[$viewDatas['layout']]['javascripts'] as $javascript): ?>
<?= $javascript ?>
<?php endforeach; ?>
<link href="/css/<?= $viewDatas['layout'] ?>.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn' t work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="top">
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?>
</div>
<div class="middle">
<div class="left"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?></div>
<div class="center">
<div class="header"><?= $this->include('templates/admin/header'); ?></div>
<div class="content"><?= $this->renderSection('content') ?></div>
<div class="footer"><?= $this->include('templates/admin/footer'); ?></div>
</div>
</div>
<div class="bottom">
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
</div>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title><?= $viewDatas['title'] ?></title>
<?php foreach (LAYOUTS[$viewDatas['layout']]['stylesheets'] as $stylesheet): ?>
<?= $stylesheet ?>
<?php endforeach; ?>
<?php foreach (LAYOUTS[$viewDatas['layout']]['javascripts'] as $javascript): ?>
<?= $javascript ?>
<?php endforeach; ?>
<link href="/css/<?= $viewDatas['layout'] ?>.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn' t work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="content"><?= $this->renderSection('content') ?></div>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title><?= $viewDatas['title'] ?></title>
<?php foreach (LAYOUTS[$viewDatas['layout']]['stylesheets'] as $stylesheet): ?>
<?= $stylesheet ?>
<?php endforeach; ?>
<?php foreach (LAYOUTS[$viewDatas['layout']]['javascripts'] as $javascript): ?>
<?= $javascript ?>
<?php endforeach; ?>
<link href="/css/<?= $viewDatas['layout'] ?>.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn' t work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="content"><?= $this->renderSection('content') ?></div>
</body>
</html>

View File

@ -8,7 +8,9 @@
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable"> <!-- modal-lg는 모달 크기를 크게 설정 -->
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="iframeModalLabel">Iframe Modal</h5>
<h5 class="modal-title" id="iframeModalLabel">
<h4>&nbsp;&nbsp;<?= ICONS['DESKTOP'] ?> <?= $viewDatas['title'] ?>&nbsp;&nbsp;</h4>
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">