cfmgrv4 init...1
This commit is contained in:
parent
8ce1c0ffb0
commit
cf0d205f75
@ -101,6 +101,12 @@ define('DEFAULTS', [
|
|||||||
'DELIMITER_FILE' => "||",
|
'DELIMITER_FILE' => "||",
|
||||||
'DELIMITER_ROLE' => ",",
|
'DELIMITER_ROLE' => ",",
|
||||||
]);
|
]);
|
||||||
|
//FORM
|
||||||
|
define('FORMS', [
|
||||||
|
'MODAL' => 'modal_form',
|
||||||
|
'IFRAME' => 'iframe_form',
|
||||||
|
'ACTION' => 'action_form',
|
||||||
|
]);
|
||||||
//URL
|
//URL
|
||||||
define('URLS', [
|
define('URLS', [
|
||||||
'LOGIN' => '/user/login',
|
'LOGIN' => '/user/login',
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use CodeIgniter\HTTP\DownloadResponse;
|
|||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\Validation\Validation;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class UserController extends AdminController
|
class UserController extends AdminController
|
||||||
@ -28,6 +29,19 @@ class UserController extends AdminController
|
|||||||
}
|
}
|
||||||
return $this->_model;
|
return $this->_model;
|
||||||
}
|
}
|
||||||
|
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
case 'role':
|
||||||
|
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||||
|
$validation->setRule($field . ".*", $field, $this->getModel()->getFieldRule($action, $field));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$validation = parent::setFormFieldRule($field, $validation, $action);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $validation;
|
||||||
|
}
|
||||||
protected function getFormFieldOption(string $field, array $options = []): array
|
protected function getFormFieldOption(string $field, array $options = []): array
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
@ -62,29 +76,6 @@ class UserController extends AdminController
|
|||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
}
|
}
|
||||||
//생성
|
//생성
|
||||||
protected function create_validate(string $action, array $fields): void
|
|
||||||
{
|
|
||||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
|
||||||
$this->validation = service('validation');
|
|
||||||
foreach ($fields as $field) {
|
|
||||||
switch ($field) {
|
|
||||||
case 'role':
|
|
||||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
|
||||||
$this->validation->setRule($field . ".*", $field, $this->getModel()->getFieldRule($action, $field));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$this->validation->setRule($field, $field, $this->getModel()->getFieldRule($action, $field));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$this->validation->withRequest($this->request)->run()) {
|
|
||||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
|
||||||
"\n",
|
|
||||||
$this->validation->getErrors()
|
|
||||||
));
|
|
||||||
// redirect()->back()->withInput()->with('errors', $this->validation->getErrors());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public function create_form(): RedirectResponse|string
|
public function create_form(): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('create');
|
$this->init('create');
|
||||||
@ -96,28 +87,6 @@ class UserController extends AdminController
|
|||||||
return $this->create_procedure();
|
return $this->create_procedure();
|
||||||
}
|
}
|
||||||
//수정
|
//수정
|
||||||
protected function modify_validate(string $action, array $fields): void
|
|
||||||
{
|
|
||||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
|
||||||
$this->validation = service('validation');
|
|
||||||
foreach ($fields as $field) {
|
|
||||||
switch ($field) {
|
|
||||||
case 'role':
|
|
||||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
|
||||||
$this->validation->setRule($field . ".*", $field, $this->getModel()->getFieldRule($action, $field));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$this->validation->setRule($field, $field, $this->getModel()->getFieldRule($action, $field));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$this->validation->withRequest($this->request)->run()) {
|
|
||||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
|
||||||
"\n",
|
|
||||||
$this->validation->getErrors()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public function modify_form(string $uid): RedirectResponse|string
|
public function modify_form(string $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
$this->init('modify');
|
$this->init('modify');
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use CodeIgniter\HTTP\DownloadResponse;
|
|||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\Validation\Validation;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
|
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
|
||||||
@ -17,8 +18,26 @@ abstract class MVController extends CommonController
|
|||||||
{
|
{
|
||||||
parent::initController($request, $response, $logger);
|
parent::initController($request, $response, $logger);
|
||||||
helper('common');
|
helper('common');
|
||||||
|
$this->action_form = getenv("mvc.default.action.form") ?? "modal_form";
|
||||||
}
|
}
|
||||||
abstract protected function getModel(): mixed;
|
abstract protected function getModel(): mixed;
|
||||||
|
//Field별 Form Rule용
|
||||||
|
protected function setFormFieldRule($field, Validation $validation, string $action): Validation
|
||||||
|
{
|
||||||
|
switch ($field) {
|
||||||
|
default:
|
||||||
|
$validation->setRule($field, $field, $this->getModel()->getFieldRule($action, $field));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $validation;
|
||||||
|
}
|
||||||
|
final protected function setFormFieldRules(array $fields, Validation $validation, string $action): Validation
|
||||||
|
{
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
$validation = $this->setFormFieldRule($field, $validation, $action);
|
||||||
|
}
|
||||||
|
return $validation;
|
||||||
|
}
|
||||||
//Field별 Form Option용
|
//Field별 Form Option용
|
||||||
protected function getFormFieldOption(string $field, array $options): array
|
protected function getFormFieldOption(string $field, array $options): array
|
||||||
{
|
{
|
||||||
@ -62,10 +81,7 @@ abstract class MVController extends CommonController
|
|||||||
protected function create_validate(string $action, array $fields): void
|
protected function create_validate(string $action, array $fields): void
|
||||||
{
|
{
|
||||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
||||||
$this->validation = service('validation');
|
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
||||||
foreach ($fields as $field) {
|
|
||||||
$this->validation->setRule($field, $field, $this->getModel()->getFieldRule($action, $field));
|
|
||||||
}
|
|
||||||
if (!$this->validation->withRequest($this->request)->run()) {
|
if (!$this->validation->withRequest($this->request)->run()) {
|
||||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
||||||
"\n",
|
"\n",
|
||||||
@ -103,10 +119,21 @@ abstract class MVController extends CommonController
|
|||||||
try {
|
try {
|
||||||
$this->create_process();
|
$this->create_process();
|
||||||
$this->getModel()->transCommit();
|
$this->getModel()->transCommit();
|
||||||
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
$this->message = "입력작업이 완료되었습니다.";
|
||||||
// $this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
log_message("notice", __FUNCTION__ . $this->message);
|
||||||
// return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
switch ($this->action_form) {
|
||||||
return alert_CommonHelper(__FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
case FORMS['MODAL']:
|
||||||
|
$result = view("templates/{$this->layout}/{$this->action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||||
|
break;
|
||||||
|
case FORMS['IFRAM']:
|
||||||
|
$result = view("templates/{$this->layout}/{$this->action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $this->message);
|
||||||
|
$result = redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//Transaction Rollback
|
//Transaction Rollback
|
||||||
$this->getModel()->transRollback();
|
$this->getModel()->transRollback();
|
||||||
@ -120,10 +147,7 @@ abstract class MVController extends CommonController
|
|||||||
protected function modify_validate(string $action, array $fields): void
|
protected function modify_validate(string $action, array $fields): void
|
||||||
{
|
{
|
||||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
||||||
$this->validation = service('validation');
|
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
||||||
foreach ($fields as $field) {
|
|
||||||
$this->validation->setRule($field, $field, $this->getModel()->getFieldRule($action, $field));
|
|
||||||
}
|
|
||||||
if (!$this->validation->withRequest($this->request)->run()) {
|
if (!$this->validation->withRequest($this->request)->run()) {
|
||||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
||||||
"\n",
|
"\n",
|
||||||
@ -172,10 +196,21 @@ abstract class MVController extends CommonController
|
|||||||
try {
|
try {
|
||||||
$this->modify_process($uid);
|
$this->modify_process($uid);
|
||||||
$this->getModel()->transCommit();
|
$this->getModel()->transCommit();
|
||||||
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
$this->message = "수정작업이 완료되었습니다.";
|
||||||
// $this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
log_message("notice", __FUNCTION__ . $this->message);
|
||||||
// return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
switch ($this->action_form) {
|
||||||
return alert_CommonHelper(__FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
case FORMS['MODAL']:
|
||||||
|
$result = view("templates/{$this->layout}/{$this->action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||||
|
break;
|
||||||
|
case FORMS['IFRAME']:
|
||||||
|
$result = view("templates/{$this->layout}/{$this->action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $this->message);
|
||||||
|
$result = redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//Transaction Rollback
|
//Transaction Rollback
|
||||||
$this->getModel()->transRollback();
|
$this->getModel()->transRollback();
|
||||||
@ -193,25 +228,21 @@ abstract class MVController extends CommonController
|
|||||||
return $this->modify_procedure($uid);
|
return $this->modify_procedure($uid);
|
||||||
}
|
}
|
||||||
//일괄처리작업
|
//일괄처리작업
|
||||||
protected function batcjob_process(): void
|
|
||||||
{
|
|
||||||
//변경할 UIDS
|
|
||||||
$uids = $this->request->getVar('batchjob_uids[]');
|
|
||||||
if (!count($uids)) {
|
|
||||||
throw new \Exception("지정된 정보가 없습니다.");
|
|
||||||
}
|
|
||||||
$this->entitys = [];
|
|
||||||
foreach ($uids as $uid) {
|
|
||||||
$this->modify_process($uid);
|
|
||||||
$this->entitys = $this->entity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final protected function batcjob_procedure(): RedirectResponse
|
final protected function batcjob_procedure(): RedirectResponse
|
||||||
{
|
{
|
||||||
//Transaction Start
|
//Transaction Start
|
||||||
$this->getModel()->transStart();
|
$this->getModel()->transStart();
|
||||||
try {
|
try {
|
||||||
$this->batcjob_process();
|
//변경할 UIDS
|
||||||
|
$uids = $this->request->getVar('batchjob_uids[]');
|
||||||
|
if (!count($uids)) {
|
||||||
|
throw new \Exception("지정된 정보가 없습니다.");
|
||||||
|
}
|
||||||
|
$this->entitys = [];
|
||||||
|
foreach ($uids as $uid) {
|
||||||
|
$this->modify_process($uid);
|
||||||
|
$this->entitys = $this->entity;
|
||||||
|
}
|
||||||
$this->getModel()->transCommit();
|
$this->getModel()->transCommit();
|
||||||
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
||||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
||||||
@ -241,8 +272,9 @@ abstract class MVController extends CommonController
|
|||||||
try {
|
try {
|
||||||
$this->delete_process($uid);
|
$this->delete_process($uid);
|
||||||
$this->getModel()->transCommit();
|
$this->getModel()->transCommit();
|
||||||
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
$message = "삭제작업을 완료하였습니다.";
|
||||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
log_message("notice", $message);
|
||||||
|
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $message);
|
||||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//Transaction Rollback
|
//Transaction Rollback
|
||||||
|
|||||||
@ -101,6 +101,53 @@ function getFieldView_UserHelper(string $field, UserEntity $entity, array $viewD
|
|||||||
}
|
}
|
||||||
return $value;
|
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 getListColumns_UserHelper(string $field, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
$label = getFieldLabel_UserHelper($field, $viewDatas, $extras);
|
$label = getFieldLabel_UserHelper($field, $viewDatas, $extras);
|
||||||
|
|||||||
@ -47,5 +47,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<?= form_close() ?>
|
<?= form_close() ?>
|
||||||
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
|
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||||
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
|
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -49,5 +49,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<?= form_close() ?>
|
<?= form_close() ?>
|
||||||
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
|
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||||
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
|
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -47,5 +47,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<?= form_close() ?>
|
<?= form_close() ?>
|
||||||
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
|
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||||
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
|
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -47,5 +47,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<?= form_close() ?>
|
<?= form_close() ?>
|
||||||
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
|
<div class="index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||||
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
|
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -17,18 +17,15 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php $cnt = 0 ?>
|
<?php $cnt = 0 ?>
|
||||||
<?php foreach ($viewDatas['entitys'] as $entity): ?>
|
<?php foreach ($viewDatas['entitys'] as $entity): ?>
|
||||||
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
|
<tr <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
|
||||||
<td class="text-center text-wrap">
|
<td class="text-center text-wrap">
|
||||||
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
|
<?= getListAction_UserHelper('modify', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
|
||||||
<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>
|
</td>
|
||||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||||
<td><?= getFieldView_UserHelper($field, $entity, $viewDatas) ?></td>
|
<td><?= getFieldView_UserHelper($field, $entity, $viewDatas) ?></td>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<td>
|
<td>
|
||||||
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
|
<?= getListAction_UserHelper('delete', $entity, $viewDatas) ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $cnt++ ?>
|
<?php $cnt++ ?>
|
||||||
@ -47,5 +44,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<?= form_close() ?>
|
<?= form_close() ?>
|
||||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||||
<?= $this->include('templates/' . $viewDatas['layout'] . '/modalform'); ?>
|
<?= $this->include('templates/' . $viewDatas['layout'] . '/' . $viewDatas['action_form']); ?>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -23,9 +23,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="header"><?= $this->include('templates/empty/header'); ?></div>
|
|
||||||
<div class="content"><?= $this->renderSection('content') ?></div>
|
<div class="content"><?= $this->renderSection('content') ?></div>
|
||||||
<div class="footer"><?= $this->include('templates/empty/footer'); ?></div>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
8
app/Views/templates/admin/iframe_form_close.php
Normal file
8
app/Views/templates/admin/iframe_form_close.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?= $this->extend("layouts/empty") ?>
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
<div class="text-center">
|
||||||
|
<div><?= $viewDatas['message'] ?></div>
|
||||||
|
<p>작업 완료 후 아래 버튼을 클릭하면 모달이 닫힙니다.</p>
|
||||||
|
<button onclick="parent.window.location.reload()">작업 완료</button>
|
||||||
|
</div>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
@ -27,6 +27,18 @@
|
|||||||
iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
|
iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeBootstrapModal() {
|
||||||
|
var modalElement = document.getElementById('index_action_form'); // 모달의 실제 DOM 요소 가져오기
|
||||||
|
var modalInstance = bootstrap.Modal.getInstance(modalElement); // 모달 인스턴스 가져오기
|
||||||
|
if (modalInstance) {
|
||||||
|
// 먼저 모달을 호출한 페이지를 리로드
|
||||||
|
window.location.reload();
|
||||||
|
modalInstance.hide(); // 모달 닫기 (hide() 메서드 사용)
|
||||||
|
} else {
|
||||||
|
console.error("Modal instance not found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var index_action_form = document.getElementById('index_action_form');
|
var index_action_form = document.getElementById('index_action_form');
|
||||||
index_action_form.addEventListener('show.bs.modal', function(event) {
|
index_action_form.addEventListener('show.bs.modal', function(event) {
|
||||||
// 버튼이 클릭된 이벤트를 가져옴
|
// 버튼이 클릭된 이벤트를 가져옴
|
||||||
8
app/Views/templates/admin/modal_form_close.php
Normal file
8
app/Views/templates/admin/modal_form_close.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?= $this->extend("layouts/empty") ?>
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
<div class="text-center">
|
||||||
|
<div><?= $viewDatas['message'] ?></div>
|
||||||
|
<p>작업 완료 후 아래 버튼을 클릭하면 모달이 닫힙니다.</p>
|
||||||
|
<button onclick="parent.closeBootstrapModal()">작업 완료</button>
|
||||||
|
</div>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
@ -1,64 +0,0 @@
|
|||||||
<?= $viewDatas['session']->getFlashdata(SESSION_NAMES['RETURN_MSG']) ? alert_CommonHelper($viewDatas['session']->getFlashdata(SESSION_NAMES['RETURN_MSG'])) : "" ?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function() {
|
|
||||||
//class가 calender인 inputbox용,날짜field용
|
|
||||||
$(".calender").datepicker({
|
|
||||||
changeYear: true,
|
|
||||||
changeMonth: true,
|
|
||||||
yearRange: "-10:+0",
|
|
||||||
dateFormat: "yy-mm-dd"
|
|
||||||
});
|
|
||||||
//id가 batchjobuids_checkbox인 버튼을 클릭시 class가 batchjobuids_checkboxs인 checkbox용
|
|
||||||
$('#batchjobuids_checkbox').click(function(event) {
|
|
||||||
if (this.checked) {
|
|
||||||
$('.batchjobuids_checkboxs').each(function() { //loop checkbox
|
|
||||||
$(this).prop('checked', true); //check
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$('.batchjobuids_checkboxs').each(function() { //loop checkbox
|
|
||||||
$(this).prop('checked', false); //uncheck
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//class가 select-field인 SelectBox용
|
|
||||||
$(".select-field").select2({
|
|
||||||
theme: "classic",
|
|
||||||
width: 'style',
|
|
||||||
dropdownAutoWidth: true
|
|
||||||
});
|
|
||||||
// text editor 초기화
|
|
||||||
//참고: https://phppot.com/menu/php/learn-php/
|
|
||||||
// class가 editor인 textarea용
|
|
||||||
tinymce.init({
|
|
||||||
selector: 'textarea.editor',
|
|
||||||
plugins: ['code', 'image', 'preview', 'table', 'emoticons', 'autoresize'],
|
|
||||||
height: 600,
|
|
||||||
// content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
|
|
||||||
automatic_uploads: false,
|
|
||||||
images_upload_url: '/tinymce_upload.php',
|
|
||||||
// images_upload_base_path: '/upload_images',
|
|
||||||
images_upload_handler: function(blobInfo, success, failure) {
|
|
||||||
var xhr, formData;
|
|
||||||
xhr = new XMLHttpRequest();
|
|
||||||
xhr.withCredentials = false;
|
|
||||||
xhr.open('POST', '/tinymce_upload.php');
|
|
||||||
xhr.onload = function() {
|
|
||||||
var json;
|
|
||||||
if (xhr.status != 200) {
|
|
||||||
failure('HTTP Error: ' + xhr.status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
json = JSON.parse(xhr.responseText);
|
|
||||||
if (!json || typeof json.file_path != 'string') {
|
|
||||||
failure('Invalid JSON: ' + xhr.responseText);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
success(json.file_path);
|
|
||||||
};
|
|
||||||
formData = new FormData();
|
|
||||||
formData.append('file', blobInfo.blob(), blobInfo.filename());
|
|
||||||
xhr.send(formData);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
Loading…
Reference in New Issue
Block a user