cfmgrv4 init...1

This commit is contained in:
최준흠 2024-10-01 18:25:10 +09:00
parent 310130906c
commit e1b63ce4c5
50 changed files with 1113 additions and 448 deletions

View File

@ -156,6 +156,8 @@ define("MESSENGERS", [
//아이콘 및 Sound관련
define('ICONS', [
'LOGO' => '<img src="/images/logo/android-icon-48x48.png">',
'EXCEL' => '<img src="/images/common/excel.png"/>',
'PDF' => '<img src="/images/common/pdf.png"/>',
'MEMBER' => '<i class="bi bi-people"></i>',
'LOGIN' => '<i class="bi bi-shield-check"></i>',
'LOGOUT' => '<i class="bi bi-sign-stop-fill"></i>',
@ -170,7 +172,6 @@ define('ICONS', [
'SETUP' => '<i class="bi bi-gear"></i>',
'FLAG' => '<i class="bi bi-send"></i>',
'SEARCH' => '<i class="bi bi-search"></i>',
'EXCEL' => '<img src="/images/common/excel.png"/>',
'PLAY' => '<i class="bi bi-play-fill"></i>',
'CART' => '<i class="bi bi-cart4"></i>',
'CARD' => '<i class="bi bi-credit-card"></i>',

View File

@ -17,6 +17,17 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
$routes->get('/', 'Home::index');
$routes->group('user', function ($routes) {
$routes->get('/', 'UserController::index');
$routes->get('create', 'UserController::create_form');
$routes->post('create', 'UserController::create');
$routes->get('modify/(:num)', 'UserController::modify_form/$1');
$routes->post('modify/(:num)', 'UserController::modify/$1');
});
$routes->group('mapurl', function ($routes) {
$routes->get('/', 'MapurlController::index');
$routes->get('create', 'MapurlController::create_form');
$routes->post('create', 'MapurlController::create');
$routes->get('modify/(:num)', 'MapurlController::modify_form/$1');
$routes->post('modify/(:num)', 'MapurlController::modify/$1');
});
$routes->group('cloudflare', ['namespace' => 'App\Controllers\Admin\Cloudflare'], function ($routes) {
$routes->cli('/reload', 'CloudflareController::reload');

View File

@ -62,19 +62,22 @@ class AccountController extends CloudflareController
$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->batchjob_fields = ['typep', 'status'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = ['typep', 'status'];
return $this->list_procedure();
}
public function reload(): RedirectResponse
{
//Transaction Start
$this->getModel()->transStart();
try {
//Transaction Start
$this->getModel()->transStart();
foreach ($this->getModel()->getEntitys as $entity) {
$zone_socket = new ZoneSocket($entity);
$zone_socket->reload();
}
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
$this->getModel()->transCommit();
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
//Transaction Rollback

View File

@ -46,7 +46,7 @@ class AuthController extends CloudflareController
$this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
parent::create_process();
$this->entity = $this->getModel()->create($this->formDatas);
$this->entity = $this->getModel()->create(formDatas: $this->formDatas);
}
public function create(): RedirectResponse
{
@ -90,20 +90,23 @@ class AuthController extends CloudflareController
$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->batchjob_fields = ['status'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = ['status'];
return $this->list_procedure();
}
public function reload(): RedirectResponse
{
//Transaction Start
$this->getModel()->transStart();
try {
//Transaction Start
$this->getModel()->transStart();
foreach ($this->getModel()->getEntitys as $entity) {
$account_socket = new AccountSocket($entity);
$account_socket->reload();
}
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
$this->getModel()->transCommit();
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
//Transaction Rollback

View File

@ -121,10 +121,10 @@ class RecordController extends CloudflareController
{
$this->action = __FUNCTION__;
$this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at'];
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->batchjob_fields = ['proxied'];
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = ['proxied'];
return $this->list_procedure();
}
}

View File

@ -166,20 +166,23 @@ class ZoneController extends CloudflareController
$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->batchjob_fields = ['development_mode', 'ipv6', 'security_level'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = ['development_mode', 'ipv6', 'security_level'];
return $this->list_procedure();
}
//reload
public function reload(): RedirectResponse
{
//Transaction Start
$this->getModel()->transStart();
try {
//Transaction Start
$this->getModel()->transStart();
foreach ($this->getModel()->getEntitys as $entity) {
$record_socket = new RecordSocket($entity);
$record_socket->reload();
}
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
$this->getModel()->transCommit();
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
//Transaction Rollback

View File

@ -0,0 +1,145 @@
<?php
namespace App\Controllers\Admin;
use App\Models\MapurlModel;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
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);
$this->class_name = "Mapurl";
$this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title");
helper($this->class_path);
}
protected function getModel(): MapurlModel
{
if ($this->_model === null) {
$this->_model = new MapurlModel();
}
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
{
$this->action = $action;
$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);
}
private function remaping_process(): void
{
//모든 필요한 FormOption등 조기화작업 필요
$this->getModel()->where('status', DEFAULTS['STATUS']);
$this->getModel()->orderBy('oldurl', 'ASC');
//html의 case문 설정
$urls = array("");
foreach ($this->getModel()->getEntitys() as $entity) {
$temp_oldurl = sprintf("case '%s':", trim($entity->oldurl));
//한글을 포함하고 있는지 체크
if (preg_match("/[\xE0-\xFF][\x80-\xFF][\x80-\xFF]/", $entity->oldurl)) {
//도메인 URL 분리
preg_match("/^(https?:\/\/)(.*)/", $entity->oldurl, $matches);
$temp_oldurl = sprintf("case '%s%s':\ncase '%s':", $matches[1], idn_to_ascii($matches[2]), trim($entity->oldurl));
}
array_push($urls, sprintf("\t\t\t%s\n \t\t\twindow.location.href='%s';\n \t\tbreak;", $temp_oldurl, trim($entity->newurl)));
}
$remap_page = view($this->class_path . DIRECTORY_SEPARATOR . __FUNCTION__, ["urls" => $urls]);
$remap_path = FCPATH . DIRECTORY_SEPARATOR . "mapurl";
//디렉토리 생성 여부 확인
if (!is_dir($remap_path)) {
mkdir($remap_path, 0755, true);
}
//htmlBuild용
if (!file_put_contents($remap_path . '/index.html', $remap_page)) {
throw new \Exception(__FUNCTION__ . "에서 " . $remap_path . "/index.html Write 실패");
}
}
//생성
public function create_form(): RedirectResponse|string
{
$this->init('create');
return $this->create_form_procedure();
}
protected function create_process(): void
{
$this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
parent::create_process();
$this->entity = $this->getModel()->create(formDatas: $this->formDatas);
$this->remaping_process();
}
public function create(): RedirectResponse
{
$this->init(__FUNCTION__);
return $this->create_procedure();
}
//수정
protected function modify_form_process(string $uid): void
{
$this->entity = $this->getModel()->getEntityByPK(intval($uid));
if ($this->entity === null) {
throw new \Exception("해당 정보를 찾을수 없습니다.");
}
parent::modify_form_process($uid);
}
public function modify_form(string $uid): RedirectResponse|string
{
$this->init('modify');
return $this->modify_form_procedure($uid);
}
protected function modify_process(string $uid): void
{
$this->entity = $this->getModel()->getEntityByPK(intval($uid));
if ($this->entity === null) {
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
}
$this->modify_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
parent::modify_process($uid);
$this->entity = $this->getModel()->modify($this->entity, $this->formDatas);
$this->remaping_process();
}
public function modify(string $uid): RedirectResponse
{
$this->init(__FUNCTION__);
return $this->modify_procedure($uid);
}
// 리스트
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'];
return $this->list_procedure();
}
}

View File

@ -2,22 +2,23 @@
namespace App\Controllers\Admin;
use App\Models\UserModel;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Models\UserModel;
use App\Traits\AuthTrait;
class UserController extends AdminController
{
private $_model = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->root = "Admin/";
$this->layout = "admin";
$this->session = $this->session_AuthTrait();
$this->class_name = "User";
$this->class_path = $this->root . $this->class_name;
$this->title = lang("{$this->class_path}.title");
helper($this->class_path);
}
protected function getModel(): UserModel
{
@ -26,4 +27,89 @@ class UserController extends AdminController
}
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
{
$this->action = $action;
$this->fields = ['id', 'passwd', $this->getModel()::TITLE, 'email', 'mobile', 'role'];
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->filter_fields = ['role', 'status'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
}
//생성
public function create_form(): RedirectResponse|string
{
$this->init('create');
return $this->create_form_procedure();
}
protected function create_process(): void
{
$this->create_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
parent::create_process();
$this->entity = $this->getModel()->create(formDatas: $this->formDatas);
}
public function create(): RedirectResponse
{
$this->init(__FUNCTION__);
return $this->create_procedure();
}
//수정
protected function modify_form_process(string $uid): void
{
$this->entity = $this->getModel()->getEntityByPK(intval($uid));
if ($this->entity === null) {
throw new \Exception("해당 정보를 찾을수 없습니다.");
}
parent::modify_form_process($uid);
}
public function modify_form(string $uid): RedirectResponse|string
{
$this->init('modify');
return $this->modify_form_procedure($uid);
}
protected function modify_process(string $uid): void
{
$this->entity = $this->getModel()->getEntityByPK(intval($uid));
if ($this->entity === null) {
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
}
$this->modify_validate($this->action, $this->fields);
$this->formDatas = $this->getFormDatas();
parent::modify_process($uid);
$this->entity = $this->getModel()->modify($this->entity, $this->formDatas);
}
public function modify(string $uid): RedirectResponse
{
$this->init(__FUNCTION__);
return $this->modify_procedure($uid);
}
// 리스트
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 = ['role', 'status'];
return $this->list_procedure();
}
}

View File

@ -2,10 +2,11 @@
namespace App\Controllers;
use Psr\Log\LoggerInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
abstract class MVController extends CommonController
{
@ -20,7 +21,7 @@ abstract class MVController extends CommonController
{
switch ($field) {
default:
// log_message("debug", __FUNCTION__ . "에서 호출:" . $field);
// dd(lang($this->class_path . '.' . strtoupper($field)));
$options[$field] = [
"" => lang($this->class_path . '.label.' . $field) . ' 선택',
...lang($this->class_path . '.' . strtoupper($field)),
@ -90,11 +91,13 @@ abstract class MVController extends CommonController
protected function create_process(): void {}
final protected function create_procedure(): RedirectResponse
{
//Transaction Start
$this->getModel()->transStart();
try {
//Transaction Start
$this->getModel()->transStart();
$this->create_process();
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
$this->getModel()->transCommit();
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
//Transaction Rollback
@ -138,11 +141,13 @@ abstract class MVController extends CommonController
protected function modify_process(string $uid): void {}
final protected function modify_procedure(string $uid): RedirectResponse
{
//Transaction Start
$this->getModel()->transStart();
try {
//Transaction Start
$this->getModel()->transStart();
$this->modify_process($uid);
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
$this->getModel()->transCommit();
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
//Transaction Rollback
@ -252,4 +257,63 @@ abstract class MVController extends CommonController
// return redirect()->back()->with('return_message', $e->getMessage());
}
}
//OUPUT Document 관련
private function output_save_process(string $document_type, mixed $loaded_data): array
{
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "excel";
switch ($document_type) {
case 'excel':
$file_name = sprintf("%s_%s.xlsx", $this->class_name, date('Y-m-d_Hm'));
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($loaded_data, 'Xlsx');
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
break;
case 'pdf':
$file_name = sprintf("%s_%s.pdf", $this->class_name, date('Y-m-d_Hm'));
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($loaded_data);
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
break;
default:
if (!is_file($full_path)) {
throw new \Exception("첨부파일이 확인되지 않습니다.\n");
}
// //oupuput directly
// header("Content-Type: application/vnd.ms-excel");
// header(sprintf("Content-Disposition: attachment; filename=%s", urlencode($output_name)));
// header("Expires: 0");
// header("Cache-Control: must-revalidate");
// header("Pragma: public");
// header("Content-Length:" . filesize($full_path));
// return $writer->save('php://output');
break;
}
return array($full_path, $file_name);
}
//File Download관련
final public function download_procedure(string $output_type, mixed $entity = null): DownloadResponse|RedirectResponse
{
try {
switch ($output_type) {
case 'excel':
case 'pdf':
//data loading
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html();
// string buffer에서 읽어오는 경우
$this->entitys = $this->list_entitys_process();
$loaded_data = $reader->loadFromString(view(
strtolower($this->class_path) . DIRECTORY_SEPARATOR . $output_type,
['viewDatas' => $this->getViewDatas()]
));
list($full_path, $file_name) = $this->output_save_process($output_type, $loaded_data);
break;
default:
list($file_name, $uploaded_filename) = $entity->getDownlaodFile();
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename;
break;
}
return $this->response->download($full_path, null)->setFileName($file_name);
} catch (\Exception $e) {
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage());
}
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Entities;
use App\Entities\CommonEntity;
use App\Models\MapurlModel;
class MapurlEntity extends CommonEntity
{
public function __toString(): string
{
return "{$this->getPK()}:{$this->getTitle()}}";
}
public function getPK(): int
{
return $this->attributes[MapurlModel::PK];
}
public function getTitle(): string
{
return $this->attributes[MapurlModel::TITLE];
}
public function setTitle(string $title): void
{
$this->attributes[MapurlModel::TITLE] = $title;
}
//Common Function
}

View File

@ -9,7 +9,7 @@ class UserEntity extends CommonEntity
{
public function __toString(): string
{
return "{$this->getPK()}:{$this->getID()}:{$this->getTitle()},{$this->getLevel()}/{$this->getPoint()}";
return "{$this->getPK()}:{$this->getID()}:{$this->getTitle()},{$this->getRole()}}";
}
public function getPK(): int
{
@ -29,21 +29,8 @@ class UserEntity extends CommonEntity
{
return $this->attributes['id'];
}
public function getPoint(): int
public function getRole(): string
{
return $this->attributes['point'];
}
public function setPoint(int $point): void
{
$this->attributes['point'] = $point;
}
public function getLevel(): int
{
return $this->attributes['level'];
}
public function setLevel(int $value): void
{
$this->attributes['level'] = $value;
return $this->attributes['role'];
}
}

View File

@ -100,16 +100,16 @@ function getFieldView_AccountHelper(string $field, AccountEntity $entity, array
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
default:
if (in_array($field, $viewDatas['filter_fields']) && $value) {
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$field,
$field
);
$value = getFieldForm_AccountHelper($field, $entity->$field, $viewDatas, $extras);
}
// if (in_array($field, $viewDatas['filter_fields']) && $value) {
// $extras["onChange"] = sprintf(
// 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
// current_url(),
// $entity->getPK(),
// $field,
// $field
// );
// $value = getFieldForm_AccountHelper($field, $entity->$field, $viewDatas, $extras);
// }
break;
}
return $value;

View File

@ -97,7 +97,6 @@ function getListColumns_AuthHelper(string $field, array $viewDatas, array $extra
$label = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case AuthModel::TITLE:
$label .= "<button onClick=\"getElementsByClassNameCopyToClipboard('label_Auths'); return false;\" class=\"btn btn-sm btn-danger btn-circle\">Copy Domains</buttion>";
break;
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);

View File

@ -0,0 +1,97 @@
<?php
use App\Entities\MapurlEntity;
use App\Models\MapurlModel;
function getFieldLabel_MapurlHelper(string $field, array $viewDatas, array $extras = []): string
{
switch ($field) {
default:
if (strpos($viewDatas['field_rules'][$field], 'required') !== false) {
$extras = [...$extras, "class" => 'text-danger'];
}
break;
}
return form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_MapurlHelper(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case MapurlModel::TITLE:
$form = form_input($field, $value, ["placeholder" => "예)http://old.example.com", "style" => "width:100%; ::placeholder{color:silver; opacity: 1;}"]);
break;
case 'newurl':
$form = form_input($field, $value, ["placeholder" => "예)https://new.example.com", "style" => "width:100%; ::placeholder{color:silver; opacity: 1;}"]);
break;
case 'status':
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras);
break;
case 'updated_at':
case 'created_at':
$form = form_input($field, $value, ['class' => 'calender']);
break;
default:
$form = form_input($field, $value, ["style" => "width:60%;"]);
break;
}
return $form;
} //
function getFieldView_MapurlHelper(string $field, MapurlEntity $entity, array $viewDatas, array $extras = [])
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case MapurlModel::TITLE:
$value = anchor(
current_url() . '/view/' . $entity->getPK(),
$value,
[
"target" => "_self",
]
);
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']) && $value) {
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$field,
$field
);
$value = getFieldForm_MapurlHelper($field, $entity->$field, $viewDatas, $extras);
}
break;
}
return $value;
} //
function getListColumns_MapurlHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_MapurlHelper($field, $viewDatas, $extras);
if ($field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
}
$order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $order_value);
$label = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case MapurlModel::TITLE:
break;
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
}

View File

@ -0,0 +1,101 @@
<?php
use App\Entities\UserEntity;
use App\Models\UserModel;
function getFieldLabel_UserHelper(string $field, array $viewDatas, array $extras = []): string
{
switch ($field) {
default:
if (strpos($viewDatas['field_rules'][$field], 'required') !== false) {
$extras = [...$extras, "class" => 'text-danger'];
}
break;
}
return form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_UserHelper(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case UserModel::TITLE:
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", "style" => "width:60%; ::placeholder{color:silver; opacity: 1;}"]);
break;
// case 'role':
// foreach ($viewDatas['field_options'][$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label;
// }
// $form = implode(" ", $checkboxs);
// break;
case 'role':
case 'status':
$form = form_dropdown($field, $viewDatas['field_options'][$field], $value, $extras);
break;
case 'updated_at':
case 'created_at':
$form = form_input($field, $value, ['class' => 'calender']);
break;
default:
$form = form_input($field, $value, ["style" => "width:60%;"]);
break;
}
return $form;
} //
function getFieldView_UserHelper(string $field, UserEntity $entity, array $viewDatas, array $extras = [])
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case UserModel::TITLE:
$value = anchor(
current_url() . '/view/' . $entity->getPK(),
$value,
[
"target" => "_self",
]
);
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']) && $value) {
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$field,
$field
);
$value = getFieldForm_UserHelper($field, $entity->$field, $viewDatas, $extras);
}
break;
}
return $value;
} //
function getListColumns_UserHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_UserHelper($field, $viewDatas, $extras);
if ($field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
}
$order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $order_value);
$label = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case UserModel::TITLE:
break;
}
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
}

View File

@ -7,6 +7,7 @@ return [
'passwd' => "암호",
'confirmpassword' => "암호확인",
'email' => "메일",
'mobile' => "연락처",
'role' => "권한",
'name' => "이름",
'status' => "상태",
@ -14,7 +15,9 @@ return [
'created_at' => "작성일",
],
"ROLE" => [
"member" => "회원",
"guest" => "비회원",
"user" => "회원",
"vip" => "회원",
"manager" => "관리자",
"cloudflare" => "Cloudflare관리자",
"director" => "감독자",

View File

@ -114,9 +114,15 @@ class RecordModel extends CommonModel
}
public function setList_OrderBy(string $order = "")
{
parent::setList_OrderBy($order);
//Join을 해서 도메인부터 Sorting하기위함
$this->join('cloudflarezone', "cloudflarezone.uid=cloudflarerecord.zone_uid");
$this->orderBy("cloudflarezone.domain ASC");
$this->join(ZoneModel::TABLE, sprintf(
"%s.%s=%s.%s",
self::TABLE,
self::PARENT,
ZoneModel::TABLE,
ZoneModel::PK
));
$this->orderBy(ZoneModel::TABLE . ".domain ASC");
parent::setList_OrderBy($order);
}
}

View File

@ -97,17 +97,29 @@ class ZoneModel extends CommonModel
public function setList_WordFilter(string $word, $field = null): void
{
//Join을 해서 Record의 content(IP검색)을 하기위함
$this->join(RecordModel::TABLE, sprintf(
"%s.%s=%s.%s",
self::TABLE,
self::PK,
RecordModel::TABLE,
RecordModel::PARENT
));
parent::setList_WordFilter($word, $field);
$this->join('cloudflarerecord', "cloudflarezone.uid=cloudflarerecord.zone_uid");
$this->orLike('cloudflarerecord.content', $word, 'both');
$this->orLike(RecordModel::TABLE . '.content', $word, 'both');
// $subquery = $this->db->table(RecordModel::TABLE)->select(RecordModel::PARENT)->like('content', $word, 'both');
// $this->orWhereIn(self::PK, $subquery);
}
public function setList_OrderBy(string $order = ""): void
{
parent::setList_OrderBy($order);
//Join을 해서 도메인부터 Sorting하기위함
$this->join('cloudflareaccount', "cloudflareaccount.uid=cloudflarezone.account_uid");
$this->orderBy("cloudflareaccount.title ASC");
$this->join(AccountModel::TABLE, sprintf(
"%s.%s=%s.%s",
self::TABLE,
self::PARENT,
AccountModel::TABLE,
AccountModel::PK
));
$this->orderBy(AccountModel::TABLE . ".title ASC");
parent::setList_OrderBy($order);
}
}

View File

@ -185,6 +185,9 @@ abstract class CommonModel extends Model
var_export($this->errors(), true)
));
}
log_message("notice", __FUNCTION__ . " 저장이 완료되었습니다.");
} else {
log_message("notice", __FUNCTION__ . " 변경된 내용이 없습니다.");
}
return $entity;
}
@ -202,7 +205,7 @@ abstract class CommonModel extends Model
$pkField = $this->getPKField();
$entity->$pkField = $this->getInsertID();
}
log_message("debug", $this->table . "=> " . __FUNCTION__ . " 작업 완료");
log_message("debug", $this->getTable() . " => " . __FUNCTION__ . " 작업 완료");
return $entity;
}
final protected function modify_process($entity, array $formDatas): mixed
@ -214,7 +217,7 @@ abstract class CommonModel extends Model
$entity->$field = $this->convertEntityData($field, $formDatas);
}
$this->save_process($entity);
log_message("debug", $this->table . "=> " . __FUNCTION__ . " 작업 완료");
log_message("debug", $this->getTable() . " => " . __FUNCTION__ . " 작업 완료");
return $entity;
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Models;
use App\Entities\MapurlEntity;
use App\Models\CommonModel;
class MapurlModel extends CommonModel
{
const TABLE = "mapurl";
const PK = "uid";
const TITLE = "oldurl";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = MapurlEntity::class;
protected $allowedFields = [
"oldurl",
"newurl",
"status"
];
public function __construct()
{
parent::__construct();
}
public function getTitleField(): string
{
return self::TITLE;
}
public function getFieldRule(string $action, string $field, array $rules): array
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "oldurl":
$rules[$field] = "required|valid_url_strict";
$rules[$field] .= $action == "create" ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "newurl":
$rules[$field] = "required|valid_url_strict";
break;
default:
$rules = parent::getFieldRule($action, $field, $rules);
break;
}
return $rules;
}
public function getEntityByPK(int $uid): null|MapurlEntity
{
$this->where($this->getPKField(), $uid);
return $this->getEntity();
}
//create용
public function create(array $formDatas = []): MapurlEntity
{
return $this->create_process(new MapurlEntity(), $formDatas);
}
//modify용
public function modify(MapurlEntity $entity, array $formDatas): MapurlEntity
{
return $this->modify_process($entity, $formDatas);
}
}

View File

@ -28,7 +28,7 @@ class SNSUserModel extends CommonModel
{
return self::TITLE;
}
public function getFieldRule(string $field, array $rules): array
public function getFieldRule(string $action, string $field, array $rules): array
{
switch ($field) {
case "id":
@ -41,7 +41,7 @@ class SNSUserModel extends CommonModel
$rules[$field] = "if_exist|trim|valid_email";
break;
default:
$rules = parent::getFieldRule($field, $rules);
$rules = parent::getFieldRule($action, $field, $rules);
break;
}
return $rules;

View File

@ -7,7 +7,7 @@ use App\Models\CommonModel;
class UserModel extends CommonModel
{
const TABLE = "users";
const TABLE = "user";
const PK = "uid";
const TITLE = "name";
protected $table = self::TABLE;
@ -18,7 +18,6 @@ class UserModel extends CommonModel
"passwd",
"name",
"email",
"pohne",
"mobild",
"role",
"status"
@ -29,20 +28,17 @@ class UserModel extends CommonModel
}
public function getTitleField(): string
{
return 'name';
return self::TITLE;
}
public function getFieldRule(string $field, array $rules): array
public function getFieldRule(string $action, string $field, array $rules): array
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "id":
if ($this->getAction() == 'create') {
$rules[$field] = "required|trim|min_length[4]|max_length[20]|is_unique[{$this->table}.{$field}]";
} else {
$rules[$field] = "required|trim|min_length[4]|max_length[20]";
}
break;
case $this->getTitleField():
$rules[$field] = "required|trim|string";
$rules[$field] = "required|trim|min_length[4]|max_length[20]|is_unique[{$this->table}.{$field}]";
$rules[$field] .= $action == "create" ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "email":
$rules[$field] = "if_exist|trim|valid_email";
@ -51,11 +47,11 @@ class UserModel extends CommonModel
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user]";
//아래 Rule은 checkbox를 사용시에는 required만 우선 써야 수정시 validate문제없음
$rules[$field] = "if_exist|trim|string";
$rules[$field] = "required|trim|string";
break;
case "passwd":
default:
$rules = parent::getFieldRule($field, $rules);
$rules = parent::getFieldRule($action, $field, $rules);
break;
}
return $rules;

View File

@ -3,28 +3,7 @@
<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(current_url(), array("method" => "get")) ?>
<nav class="index_top navbar navbar-expand-lg">
<div class="container-fluid">
<nav class="condition nav">
조건검색:
<?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= getFieldForm_AccountHelper($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?>
</nav>
<nav class="search nav justify-content-center">
검색어:<?= form_input('word', $viewDatas['word']) ?>
검색일:<?= form_input('start', $viewDatas['start'], ["class" => "calender"]) ?><?= form_input('end', $viewDatas['end'], ["class" => "calender"]) ?>
<?= form_submit('', '검색하기') ?>
<?= anchor(current_url() . '/excel?' . $viewDatas['uri']->getQuery(), ICONS['EXCEL'], ["target" => "_self", "class" => "excel"]) ?>
</nav>
<nav class="pageinfo nav justify-content-end">
페이지정보 : <?= $viewDatas['page'] ?>/<?= $viewDatas['total_page'] ?>
<?= form_dropdown('per_page', $viewDatas['page_options'], $viewDatas['per_page'], array('onChange' => 'this.form.submit()')) ?>
/ :<?= $viewDatas['total_count'] ?>
</nav>
</div>
</nav>
<?= form_close() ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped">
<thead>
@ -41,7 +20,6 @@
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/sync/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>

View File

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

View File

@ -2,30 +2,8 @@
<?= $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(current_url(), array("method" => "get")) ?>
<nav class="index_top navbar navbar-expand-lg">
<div class="container-fluid">
<nav class="condition nav">
조건검색:
<?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= getFieldForm_AuthHelper($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?>
</nav>
<nav class="search nav justify-content-center">
검색어:<?= form_input('word', $viewDatas['word']) ?>
검색일:<?= form_input('start', $viewDatas['start'], ["class" => "calender"]) ?><?= form_input('end', $viewDatas['end'], ["class" => "calender"]) ?>
<?= form_submit('', '검색하기') ?>
<?= anchor(current_url() . '/excel?' . $viewDatas['uri']->getQuery(), ICONS['EXCEL'], ["target" => "_self", "class" => "excel"]) ?>
</nav>
<nav class="pageinfo nav justify-content-end">
페이지정보 : <?= $viewDatas['page'] ?>/<?= $viewDatas['total_page'] ?>
<?= form_dropdown('per_page', $viewDatas['page_options'], $viewDatas['per_page'], array('onChange' => 'this.form.submit()')) ?>
/ :<?= $viewDatas['total_count'] ?>
</nav>
</div>
</nav>
<?= form_close() ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<table class="index_table table table-bordered table-hover table-striped">
<thead>
<tr>
@ -42,7 +20,8 @@
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/modify/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
<span data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/modify/' . $entity->getPK() ?>" style="cursor:pointer;">
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</span>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
@ -64,8 +43,9 @@
<?= getFieldForm_AuthHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item"><?= anchor(current_url() . '/create', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
<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>
</ul>
</div>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
<?= $this->endSection() ?>

View File

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

View File

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

View File

@ -3,28 +3,7 @@
<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(current_url(), array("method" => "get")) ?>
<nav class="index_top navbar navbar-expand-lg">
<div class="container-fluid">
<nav class="condition nav">
조건검색:
<?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= getFieldForm_RecordHelper($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?>
</nav>
<nav class="search nav justify-content-center">
검색어:<?= form_input('word', $viewDatas['word']) ?>
검색일:<?= form_input('start', $viewDatas['start'], ["class" => "calender"]) ?><?= form_input('end', $viewDatas['end'], ["class" => "calender"]) ?>
<?= form_submit('', '검색하기') ?>
<?= anchor(current_url() . '/excel?' . $viewDatas['uri']->getQuery(), ICONS['EXCEL'], ["target" => "_self", "class" => "excel"]) ?>
</nav>
<nav class="pageinfo nav justify-content-end">
페이지정보 : <?= $viewDatas['page'] ?>/<?= $viewDatas['total_page'] ?>
<?= form_dropdown('per_page', $viewDatas['page_options'], $viewDatas['per_page'], array('onChange' => 'this.form.submit()')) ?>
/ :<?= $viewDatas['total_count'] ?>
</nav>
</div>
</nav>
<?= form_close() ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped">
<thead>
@ -67,15 +46,9 @@
<?= getFieldForm_RecordHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("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>
</ul>
</div>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<div id="ActionForm" style="text-align:center;">
<div id="form_page" class="modal-body" style="text-align:center;"></div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
loadContentForm("<?= current_url() . "/create" ?>", document.getElementById('form_page'));
});
</script>
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
<?= $this->endSection() ?>

View File

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

View File

@ -3,28 +3,7 @@
<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(current_url(), array("method" => "get")) ?>
<nav class="index_top navbar navbar-expand-lg">
<div class="container-fluid">
<nav class="condition nav">
조건검색:
<?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= getFieldForm_ZoneHelper($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?>
</nav>
<nav class="search nav justify-content-center">
검색어:<?= form_input('word', $viewDatas['word']) ?>
검색일:<?= form_input('start', $viewDatas['start'], ["class" => "calender"]) ?><?= form_input('end', $viewDatas['end'], ["class" => "calender"]) ?>
<?= form_submit('', '검색하기') ?>
<?= anchor(current_url() . '/excel?' . $viewDatas['uri']->getQuery(), ICONS['EXCEL'], ["target" => "_self", "class" => "excel"]) ?>
</nav>
<nav class="pageinfo nav justify-content-end">
페이지정보 : <?= $viewDatas['page'] ?>/<?= $viewDatas['total_page'] ?>
<?= form_dropdown('per_page', $viewDatas['page_options'], $viewDatas['per_page'], array('onChange' => 'this.form.submit()')) ?>
/ :<?= $viewDatas['total_count'] ?>
</nav>
</div>
</nav>
<?= form_close() ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="index_table table table-bordered table-hover table-striped">
<thead>
@ -65,13 +44,9 @@
<?= getFieldForm_ZoneHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("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>
</ul>
</div>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<div id="ActionForm" class="modal-body"></div>
<script>
document.addEventListener('DOMContentLoaded', function() {
loadContentForm("<?= current_url() . "/create" ?>", document.getElementById('ActionForm'));
});
</script>
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
<?= $this->endSection() ?>

View File

@ -0,0 +1,24 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="action_form table table-bordered">
<?php $cnt = 1 ?>
<?php foreach ($viewDatas['fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= getFieldLabel_MapurlHelper($field, $viewDatas) ?></th>
<td nowrap class="text-start">
<?= getFieldForm_MapurlHelper($field, old($field), $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
<?php $cnt++ ?>
</tr>
<?php endforeach; ?>
<tr>
<td valign=" bottom" colspan="<?= $cnt * 2 ?>">
<?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?>
</td>
</tr>
</table>
<?= form_close(); ?>
<?= $this->endSection() ?>

View File

@ -0,0 +1,51 @@
<?= $this->extend("layouts/{$viewDatas['layout']}") ?>
<?= $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(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<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) ?>
<?php endforeach ?>
<th>작업</th>
</tr>
</thead>
<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"' ?>>
<td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<span data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/modify/' . $entity->getPK() ?>" style="cursor:pointer;">
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</span>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_MapurlHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
</td>
</tr>
<?php $cnt++ ?>
<?php endforeach ?>
</tbody>
</table>
<?= form_close() ?>
<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_MapurlHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("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>
</ul>
</div>
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
<?= $this->endSection() ?>

View File

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

View File

@ -0,0 +1,24 @@
<?= $this->extend("layouts/empty") ?>
<?= $this->section('content') ?>
<link href="/css/<?= $viewDatas['layout'] ?>/content.css" media="screen" rel="stylesheet" type="text/css" />
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="action_form table table-bordered">
<?php $cnt = 1 ?>
<?php foreach ($viewDatas['fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= getFieldLabel_UserHelper($field, $viewDatas) ?></th>
<td nowrap class="text-start">
<?= getFieldForm_UserHelper($field, old($field), $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
<?php $cnt++ ?>
</tr>
<?php endforeach; ?>
<tr>
<td valign=" bottom" colspan="<?= $cnt * 2 ?>">
<?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?>
</td>
</tr>
</table>
<?= form_close(); ?>
<?= $this->endSection() ?>

View File

@ -1,50 +1,51 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->extend("layouts/{$viewDatas['layout']}") ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div class="top container-fluid">
<?= form_open(current_url(), array("method" => "get")) ?>
<nav class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_UserHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
</nav>
<?= $this->include('templates/admin/index_head') ?>
<?= form_close() ?>
</div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_UserHelper($field, $viewDatas) ?><?php endforeach ?>
<th>@</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowarp>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td><?= getFieldIndex_Row_UserHelper_Admin($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>
<?php $cnt++ ?>
<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(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<?= $this->include('templates/' . $viewDatas['layout'] . '/index_top'); ?>
<table class="index_table table table-bordered table-hover table-striped">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field): ?>
<?= getListColumns_UserHelper($field, $viewDatas) ?>
<?php endforeach ?>
</tbody>
</table>
<div class="bottom">
<ul class="nav justify-content-center">
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
<?php foreach ($viewDatas['batchjobFilters'] as $field) : ?><?= getFieldFilter_UserHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?><?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item"><?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
</ul>
<?= $viewDatas['pagination'] ?>
</div>
<?= form_close() ?>
<th>작업</th>
</tr>
</thead>
<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"' ?>>
<td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<span data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/modify/' . $entity->getPK() ?>" style="cursor:pointer;">
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</span>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_UserHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
</td>
</tr>
<?php $cnt++ ?>
<?php endforeach ?>
</tbody>
</table>
<?= form_close() ?>
<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_UserHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("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>
</ul>
</div>
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
<?= $this->endSection() ?>

View File

@ -1,24 +0,0 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_UserHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_UserHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

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

View File

@ -1,24 +0,0 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_UserHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_UserHelper($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,19 +0,0 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_UserHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldView_UserHelper($field, $viewDatas['entity'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -5,5 +5,5 @@
<a href="/admin/usersns"><?= ICONS['GOOGLE'] ?> SNS 계정 관리</a>
</div>
<div class="accordion-item">
<a href="/admin/cloudflare/mapurl"><?= ICONS['FLAG'] ?> MapURL 관리</a>
<a href="/admin/mapurl"><?= ICONS['FLAG'] ?> MapURL 관리</a>
</div>

View File

@ -1,34 +1,29 @@
<!doctype html>
<html>
<!DOCTYPE html>
<html lang="ko">
<head>
<base href="/" target="_self" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?php foreach ($viewDatas['layout']['stylesheets'] as $stylesheet) : ?>
<?= $stylesheet ?>
<?php endforeach ?>
<?php foreach ($viewDatas['layout']['javascripts'] as $javascript) : ?>
<?= $javascript ?>
<?php endforeach ?>
<link href="/css/empty.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/empty.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]-->
<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 id="body">
<?= $this->include('templates/empty/header'); ?>
<?= $this->renderSection('content') ?>
<?= $this->include('templates/empty/footer'); ?>
</div>
<div class="content"><?= $this->renderSection('content') ?></div>
</body>
</html>

View File

@ -1,7 +1,29 @@
<div id="ActionForm"></div>
<!-- 처음 호출할때 사용법
$this->include('templates/' . $viewDatas['layout'] . '/actionform');
-->
<!-- 동적으로 ifram src 바꾸고싶을때
<span onClick="changeIframe_src('신규URL')" style="cursor:pointer;"></span>
-->
<div class="index_action_form">
<iframe id="index_iframe" src=" <?= current_url() . "/create" ?>" scrolling="no">
<p>사용 중인 브라우저는 iframe을 지원하지 않습니다.</p>
</iframe>
</div>
<script>
function resizeIframe() {
var iframe = document.getElementById('index_iframe');
iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
}
function changeIframe_src(target_url) {
var iframe = document.getElementById('index_iframe');
var newIframe = iframe.cloneNode();
newIframe.src = target_url;
iframe.parentNode.replaceChild(newIframe, iframe); // 기존 iframe을 새 iframe으로 교체
}
document.addEventListener('DOMContentLoaded', function() {
loadContentForm("<?= current_url() . "/create" ?>", document.getElementById('ActionForm'));
var iframe = document.getElementById('index_iframe');
iframe.onload = resizeIframe; // iframe이 로드된 후 높이를 조정
});
</script>
<!-- <span onClick="loadContentForm(' <?= current_url() . "/modify/" . $entity->getPK() ?>' , document.getElementById('ActionForm'))"></span> -->
</script>

View File

@ -0,0 +1,25 @@
<?= form_open(current_url(), array("method" => "get")) ?>
<nav class="index_top navbar navbar-expand-lg">
<div class="container-fluid">
<nav class="condition nav">
조건검색:
<?php $fieldform_function = "getFieldForm_{$viewDatas['class_name']}Helper" ?>
<?php foreach ($viewDatas['filter_fields'] as $field): ?>
<?= $fieldform_function($field, $viewDatas[$field] ?: old($field), $viewDatas) ?>
<?php endforeach ?>
</nav>
<nav class="search nav justify-content-center">
검색어:<?= form_input('word', $viewDatas['word']) ?>
검색일:<?= form_input('start', $viewDatas['start'], ["class" => "calender"]) ?><?= form_input('end', $viewDatas['end'], ["class" => "calender"]) ?>
<?= form_submit('', '검색하기') ?>
<?= anchor(current_url() . '/download?output_type=excel' . $viewDatas['uri']->getQuery(), ICONS['EXCEL'], ["target" => "_self", "class" => "excel"]) ?>
<?= anchor(current_url() . '/download?output_type=pdf' . $viewDatas['uri']->getQuery(), ICONS['PDF'], ["target" => "_self", "class" => "pdf"]) ?>
</nav>
<nav class="pageinfo nav justify-content-end">
페이지정보 : <?= $viewDatas['page'] ?>/<?= $viewDatas['total_page'] ?>
<?= form_dropdown('per_page', $viewDatas['page_options'], $viewDatas['per_page'], array('onChange' => 'this.form.submit()')) ?>
/ :<?= $viewDatas['total_count'] ?>
</nav>
</div>
</nav>
<?= form_close() ?>

View File

@ -1,19 +1,47 @@
<div id="AcionForm" class="modal fade" tabindex="-1" aria-labelledby="ActionFormModal" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
<!-- 처음 호출할때 사용법
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#iframeInModal" data-src="시작URL">시작</button>
-->
<!-- 동적으로 ifram src 바꾸고싶을때
<span data-bs-toggle="modal" data-bs-target="#iframeInModal" data-src="바꾸고싶은URL" style="cursor:pointer;">바꾸기</span>
-->
<div id="index_action_form" class="index_action_form modal fade" tabindex="-1" aria-labelledby="iframeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable"> <!-- modal-lg는 모달 크기를 크게 설정 -->
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="FormModal">Cloudflare DNS</h1>
<h5 class="modal-title" id="iframeModalLabel">Iframe Modal</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="form_page" class="modal-body"></div>
<div class="modal-body">
<iframe id="iframeInModal" src="about:blank" width="100%" height="400" frameborder="0" allowfullscreen></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal이 열릴 iframe의 src를 설정 -->
<script>
document.addEventListener('DOMContentLoaded', function() {
loadContentForm("<?= current_url() . "/create" ?>", document.getElementById('form_page'));
function resizeIframe() {
var iframe = document.getElementById('iframeInModal');
iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
}
var index_action_form = document.getElementById('index_action_form');
index_action_form.addEventListener('show.bs.modal', function(event) {
// 버튼이 클릭된 이벤트를 가져옴
var button = event.relatedTarget;
// console.log(button.getAttribute('data-src'));
var iframeSrc = button.getAttribute('data-src'); // data-src 값을 가져옴
var iframe = document.getElementById('iframeInModal');
// console.log(iframe.getAttribute('src'));
iframe.src = iframeSrc; // 가져온 data-src 값을 iframe에 설정
// iframe.onload = resizeIframe; // iframe이 로드된 후 높이를 조정
});
// 모달이 닫힐 때 iframe src를 초기화하여 종료 처리
index_action_form.addEventListener('hidden.bs.modal', function() {
var iframe = document.getElementById('iframeInModal');
iframe.src = "about:blank"; // 모달 닫힐 때 iframe 초기화
});
</script>

View File

@ -1,31 +1,20 @@
/* insert,update,reply,view Form Page 관련 전용*/
table.form.tbody tr td.label {
width: 10%;
text-align: right;
padding-right: 20px;
background-color: #e8ebe9;
}
table.form tbody tr td.column {
height: 27px;
text-align: left;
padding-left: 20px;
}
/* insert,update,reply,view Form Page 관련 전용*/
/*조건검색*/
nav.index_top nav.condition {
border-color: 1px solid red;
}
/*검색*/
nav.index_top nav.search {
position: relative;
height: 30px;
border-color: 1px solid red;
}
nav.index_top nav.search input[type="text"] {
width: 200px;
height: 30px;
}
/*검색submit*/
nav.index_top nav.search input[type="submit"] {
font-weight: bold;
@ -34,6 +23,7 @@ nav.index_top nav.search input[type="submit"] {
color: white;
background-color: #555555;
}
/*검색submit*/
nav.index_top nav.search a.excel {
position: absolute;
@ -41,18 +31,18 @@ nav.index_top nav.search a.excel {
right: -45px;
/* border-color: 1px solid red; */
}
/*페이지정보*/
nav.index_top nav.pageinfo {
font-weight: bold;
/* border-color: 1px solid red; */
}
/* Table 부분 */
table.index_table {
width: 100%;
/* overflow-x: auto;
padding-top:5px;
padding-bottom:5px; */
}
table.index_table thead th {
white-space: nowrap;
padding-top: 15px;
@ -64,9 +54,10 @@ table.index_table thead th {
text-align: center;
/* border:1px solid silver; */
}
div.index_bottom {
padding-top: 15px;
text-align:center;
text-align: center;
/* border: 1px solid red; */
}
@ -74,48 +65,66 @@ div.index_pagination nav {
margin-top: 20px;
/* border: 1px solid red; */
}
div.index_pagination nav ul.pagination {
/* border: 1px solid green; */
width: fit-content; /* UL의 너비를 내용에 맞춤 */
margin: 0 auto; /* 좌우 마진을 자동으로 설정하여 중앙 배치 */
width: fit-content;
/* UL의 너비를 내용에 맞춤 */
margin: 0 auto;
/* 좌우 마진을 자동으로 설정하여 중앙 배치 */
padding: 0;
list-style: none; /* 기본 점 스타일 제거 (옵션) */
list-style: none;
/* 기본 점 스타일 제거 (옵션) */
}
div.index_pagination nav ul.pagination li {
margin-left: 5px;
}
div.index_pagination nav ul.pagination li a {
padding: 5px 10px 5px 10px;
font-size: 1.5rem;
color: white;
background-color: #808080;
}
div.index_pagination nav ul.pagination li.active a {
color: black;
border: 1px solid #808080;
}
div.index_pagination nav ul.pagination li a:hover {
border: 1px solid black;
}
nav.index_form {
margin-top:20px;
text-align:center;
div.index_action_form {
margin-top: 20px;
/* border: 1px solid red; */
}
div#ActionForm {
margin-top:20px;
text-align:center;
/* border: 1px solid red; */
}
table.action_form {
margin:auto;
width:800px;
div.index_action_form iframe {
width: 100%;
border: none;
/* border: 1px solid blue; */
}
table.action_form td{
text-align:center;
/* create,modify,view 페이지용 */
table.action_form {
/* 블록 요소로 변경 */
margin-left: auto;
/* 자동 여백을 이용한 가로 가운데 정렬 */
margin-right: auto;
/* 자동 여백을 이용한 가로 가운데 정렬 */
/* border: 1px solid blue; */
}
table.action_form th{
text-align:center;
background-color:silver;
}
table.action_form th {
text-align: center;
background-color: #f5f5f5;
}
table.action_form td {
text-align: center;
}
/* create,modify,view 페이지용 */

View File

@ -4,9 +4,9 @@
* Created : 2016/9/11 Tri-aBility by Junheum,Choi
* Updated :
------------------------------------------------------------ */
* {
margin: 0px;
padding: 0px;
font-size: 14px;
border: 0px;
/* font-size: 15px; */
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -70,4 +70,12 @@ async function getElementsByClassNameCopyToClipboard(class_name)
await navigator.clipboard.writeText(textToCopy)
.then(() => { alert("복사가 완료되었습니다."); })
.catch(err => { console.log('복사가 오류', err); })
}
//해당 URL의 페이지를 접속해서 targ의 위치에 표시한다.
function loadContentForm(url,target) {
fetch(url)
.then(response => response.text())
.then(data => {target.innerHTML = data})
.catch(error => console.error('Error loading form:', error));
}

View File

@ -1,6 +0,0 @@
function loadContentForm(url,target) {
fetch(url)
.then(response => response.text())
.then(data => {target.innerHTML = data;})
.catch(error => console.error('Error loading form:', error));
}