trafficmonitor init...2
This commit is contained in:
parent
ef9f4d1ea9
commit
34bba22949
@ -32,25 +32,12 @@ abstract class AdminController extends CommonController
|
||||
parent::action_init_process($action);
|
||||
$this->addViewDatas('layout', $this->getLayout());
|
||||
$this->addViewDatas('helper', $this->service->getHelper($action, $this->getViewDatas()));
|
||||
switch ($action) {
|
||||
case 'create_form':
|
||||
case 'create':
|
||||
case 'modify_form':
|
||||
case 'modify':
|
||||
case 'view':
|
||||
$formFields = $this->service->getFormService()->getFormFields($action);
|
||||
$formFilters = $this->service->getFormService()->getFormFilters($action);
|
||||
$this->addViewDatas('formFields', $formFields);
|
||||
break;
|
||||
default:
|
||||
$formField = $this->service->getFormService()->getIndexFields($action);
|
||||
$this->addViewDatas('indexFields', $formField);
|
||||
break;
|
||||
}
|
||||
$this->addViewDatas('formFilters', $this->service->getFormService()->getFormFilters($action));
|
||||
$this->addViewDatas('formRules', $this->service->getFormService()->getFormRules($action, $formFields));
|
||||
$this->addViewDatas('formOptions', $this->service->getFormService()->getFormOptions($action, $formFields));
|
||||
$this->addViewDatas('batchjobFields', $this->service->getFormService()->getBatchjobFields($action));
|
||||
$this->addViewDatas('batchjobButtons', $this->service->getFormService()->getBatchjobButtons($action));
|
||||
$this->addViewDatas('formFilters', $formFilters);
|
||||
$this->addViewDatas('formRules', $this->service->getFormService()->getFormRules($action, array_keys($formFields)));
|
||||
$this->addViewDatas('formOptions', $this->service->getFormService()->getFormOptions($action, $formFilters));
|
||||
}
|
||||
protected function create_form_process(array $formDatas = []): array
|
||||
{
|
||||
@ -128,6 +115,31 @@ abstract class AdminController extends CommonController
|
||||
return redirect()->back()->withInput()->with('message', $e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function view_process($uid): CommonEntity
|
||||
{
|
||||
if (!$uid) {
|
||||
throw new \Exception("계정 번호가 정의 되지 않았습니다.");
|
||||
}
|
||||
$entity = $this->service->getEntity($uid);
|
||||
if (!$entity instanceof CommonEntity) {
|
||||
throw new \Exception("{$uid}에 해당하는 계정을 찾을수 없습니다.");
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
final public function view($uid): string
|
||||
{
|
||||
$action = __FUNCTION__;
|
||||
try {
|
||||
//초기화
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->view_process($uid);
|
||||
$this->addViewDatas('entity', $entity);
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', $e->getMessage());
|
||||
session()->setFlashdata('message', $e->getMessage());
|
||||
}
|
||||
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
|
||||
}
|
||||
//리스트관련
|
||||
//조건절 처리
|
||||
protected function index_condition_process(string $action): void
|
||||
@ -137,7 +149,7 @@ abstract class AdminController extends CommonController
|
||||
foreach ($this->service->getFormService()->getFormFilters($action) as $field) {
|
||||
$value = $this->request->getVar($field) ?? null;
|
||||
if ($value) {
|
||||
$this->service->index_condition_filterField($field, $value);
|
||||
$this->service->setFilter($field, $value);
|
||||
$index_filters[$field] = $value;
|
||||
}
|
||||
}
|
||||
@ -145,37 +157,37 @@ abstract class AdminController extends CommonController
|
||||
//검색어조건절 처리
|
||||
$index_word = $this->request->getVar('index_word');
|
||||
if ($index_word !== null && $index_word !== '') {
|
||||
$this->service->index_condition_filterWord($index_word);
|
||||
$this->service->setSearchWord($index_word);
|
||||
}
|
||||
$this->addViewDatas('index_word', $index_word);
|
||||
//날자검색
|
||||
$index_start = $this->request->getVar('index_start');
|
||||
$index_end = $this->request->getVar('index_end');
|
||||
if ($index_start !== null && $index_start !== '' && $index_end !== null && $index_end !== '') {
|
||||
$this->service->index_condition_filterDate($index_start, $index_end);
|
||||
$this->service->setDateFilter($index_start, $index_end);
|
||||
}
|
||||
$this->addViewDatas('index_start', $index_start);
|
||||
$this->addViewDatas('index_end', $index_end);
|
||||
}
|
||||
//Index Option출력용
|
||||
protected function index_pagenation_options_process(int $index_totalcount, int $index_perpage): array
|
||||
protected function pagenation_options_process(int $index_totalcount, int $perpage): array
|
||||
{
|
||||
$index_page_options = ["" => "줄수선택"];
|
||||
for ($i = $index_perpage; $i <= $index_totalcount; $i += $index_perpage) {
|
||||
$index_page_options[$i] = $i;
|
||||
$page_options = ["" => "줄수선택"];
|
||||
for ($i = $perpage; $i <= $index_totalcount; $i += $perpage) {
|
||||
$page_options[$i] = $i;
|
||||
}
|
||||
$index_page_options[$index_totalcount] = $index_totalcount;
|
||||
return $index_page_options;
|
||||
$page_options[$index_totalcount] = $index_totalcount;
|
||||
return $page_options;
|
||||
}
|
||||
//PageNation 처리
|
||||
protected function index_pagenation_process(int $index_totalcount, int $page, int $perpage, $pager_group = 'default', int $segment = 0, $template = 'bootstrap_full'): mixed
|
||||
protected function pagenation_process(int $index_totalcount, int $page, int $perpage, $pager_group = 'default', int $segment = 0, $template = 'bootstrap_full'): mixed
|
||||
{
|
||||
// 1.Views/Pagers/에 bootstrap_full.php,bootstrap_simple.php 생성
|
||||
// 2.app/Config/Pager.php/$templates에 'bootstrap_full => 'Pagers\bootstrap_full',
|
||||
// 'bootstrap_simple' => 'Pagers\bootstrap_simple', 추가
|
||||
$pager = service("pager");
|
||||
$pager->makeLinks($page, $perpage, $index_totalcount, $template, $segment, $pager_group);
|
||||
// $index_page = $pager->getCurrentPage($pager_group);
|
||||
// $page = $pager->getCurrentPage($pager_group);
|
||||
$this->addViewDatas('index_totalpage', $pager->getPageCount($pager_group));
|
||||
return $pager->links($pager_group, $template);
|
||||
}
|
||||
@ -196,33 +208,33 @@ abstract class AdminController extends CommonController
|
||||
$this->action_init_process($action);
|
||||
$this->addViewDatas('uri', $this->request->getUri());
|
||||
//Page, Per_page필요부분
|
||||
$index_page = (int) $this->request->getVar('index_page') ?: 1;
|
||||
$index_perpage = (int) $this->request->getVar('index_perpage') ?: intval(DEFAULTS['INDEX_PERPAGE']);
|
||||
$this->addViewDatas('index_page', $index_page);
|
||||
$this->addViewDatas('index_perpage', $index_perpage);
|
||||
$page = (int) $this->request->getVar('page') ?: 1;
|
||||
$perpage = (int) $this->request->getVar('perpage') ?: intval(DEFAULTS['INDEX_PERPAGE']);
|
||||
$this->addViewDatas('page', $page);
|
||||
$this->addViewDatas('perpage', $perpage);
|
||||
//index_totalcount
|
||||
//조건절 처리 index_totalcount용
|
||||
$this->index_condition_process($action);
|
||||
$index_totalcount = $this->service->getindex_totalcount();
|
||||
$index_totalcount = $this->service->getTotalCount();
|
||||
$this->addViewDatas('index_totalcount', $index_totalcount);
|
||||
$this->addViewDatas('index_pagination', $this->index_pagenation_process($index_totalcount, $index_page, $index_perpage));
|
||||
$this->addViewDatas('index_pagination_options', $this->index_pagenation_options_process($index_totalcount, $index_perpage));
|
||||
$this->addViewDatas('index_pagination', $this->pagenation_process($index_totalcount, $page, $perpage));
|
||||
$this->addViewDatas('index_pagination_options', $this->pagenation_options_process($index_totalcount, $perpage));
|
||||
//OrcerBy , Limit 처리
|
||||
$order_field = $this->request->getVar('order_field');
|
||||
$order_value = $this->request->getVar('order_value');
|
||||
$this->service->setOrderBy($order_field, $order_value);
|
||||
$this->addViewDatas('order_field', $order_field);
|
||||
$this->addViewDatas('order_value', $order_value);
|
||||
$this->service->setLimit($index_page);
|
||||
$this->service->setOffset(($index_page - 1) * $index_perpage);
|
||||
$this->service->setLimit($perpage);
|
||||
$this->service->setOffset(($page - 1) * $perpage);
|
||||
//List
|
||||
//조건절 처리 List용
|
||||
$this->index_condition_process($action);
|
||||
$this->addViewDatas('entities', $this->index_process());
|
||||
helper(['form']);
|
||||
$this->addViewDatas('formDatas', $this->request->getGet());
|
||||
$this->addViewDatas('index_batchjobFields', $this->service->getFormService()->getBatchjobFields());
|
||||
$this->addViewDatas('index_batchjobButtions', $this->service->getFormService()->getBatchjobButtons());
|
||||
$this->addViewDatas('index_batchjobFields', $this->service->getFormService()->getBatchjobFields($action));
|
||||
$this->addViewDatas('index_batchjobButtions', $this->service->getFormService()->getBatchjobButtons($action));
|
||||
} catch (\Exception $e) {
|
||||
session()->setFlashdata('message', $e->getMessage());
|
||||
}
|
||||
|
||||
@ -38,6 +38,10 @@ class UserController extends AdminController
|
||||
$redirect_url = $this->getAuthContext()->popPreviousUrl() ?? implode(DIRECTORY_SEPARATOR, $this->getActionPaths());
|
||||
return redirect()->to($redirect_url)->with('message', "{$entity->getTitle()} 계정 생성이 완료되었습니다.");
|
||||
}
|
||||
protected function modify_form_process($uid): UserEntity
|
||||
{
|
||||
return parent::modify_form_process($uid);
|
||||
}
|
||||
protected function modify_process($uid): RedirectResponse
|
||||
{
|
||||
if (!$uid) {
|
||||
@ -53,4 +57,9 @@ class UserController extends AdminController
|
||||
$redirect_url = $this->getAuthContext()->popPreviousUrl() ?? implode(DIRECTORY_SEPARATOR, $this->getActionPaths());
|
||||
return redirect()->to($redirect_url)->with('message', "{$entity->getTitle()} 계정 수정이 완료되었습니다.");
|
||||
}
|
||||
|
||||
protected function view_process($uid): UserEntity
|
||||
{
|
||||
return parent::view_process($uid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ abstract class CommonForm
|
||||
{
|
||||
private array $_attributes = [];
|
||||
protected function __construct() {}
|
||||
abstract public function getFormFields(string $action, ?array $fields = null): array;
|
||||
final public function setAttributes(array $attributes): void
|
||||
{
|
||||
$this->_attributes = $attributes;
|
||||
@ -36,33 +35,26 @@ abstract class CommonForm
|
||||
return $options;
|
||||
}
|
||||
//필수함수
|
||||
public function getFormFilters(string $action, ?array $fields = null): array
|
||||
public function getFormFields(string $action, array $fields = []): array
|
||||
{
|
||||
return $fields ?? [];
|
||||
$temps = [];
|
||||
foreach ($fields as $field) {
|
||||
$temps[$field] = lang("{$this->getAttribute('class_path')}.label.{$field}");
|
||||
}
|
||||
public function getViewFields(string $action = 'view', ?array $fields = null): array
|
||||
{
|
||||
return $fields ?? $this->getFormFields($action);
|
||||
return $temps;
|
||||
}
|
||||
public function getViewFilters(string $action = 'view', ?array $fields = null): array
|
||||
public function getFormFilters(string $action, array $fields = []): array
|
||||
{
|
||||
return $fields ?? $this->getFormFilters($action);
|
||||
return $fields;
|
||||
}
|
||||
public function getIndexFields(string $action = 'index', ?array $fields = null): array
|
||||
public function getBatchjobFields(string $action, array $fields = []): array
|
||||
{
|
||||
return $fields ?? $this->getFormFields($action);
|
||||
return $fields;
|
||||
}
|
||||
public function getIndexFilters(string $action = 'index', ?array $fields = null): array
|
||||
public function getBatchjobButtons(string $action, array $buttions = []): array
|
||||
{
|
||||
return $fields ?? $this->getFormFilters($action);
|
||||
}
|
||||
public function getBatchjobFields(string $action = 'index', ?array $fields = null): array
|
||||
{
|
||||
return $fields ?? $this->getIndexFilters($action);
|
||||
}
|
||||
public function getBatchjobButtons(string $action = 'index', ?array $buttions = null): array
|
||||
{
|
||||
return $buttions ?? [
|
||||
return [
|
||||
...$buttions,
|
||||
'batchjob' => '일괄 처리',
|
||||
'batchjob_delete' => '일괄 삭제',
|
||||
];
|
||||
@ -106,21 +98,23 @@ abstract class CommonForm
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
$userService = service('UserService');
|
||||
$option = $userService->getEntities();
|
||||
break;
|
||||
case 'clientinfo_uid':
|
||||
$clientService = service('ClientService');
|
||||
$option = $clientService->getEntities();
|
||||
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
|
||||
foreach (service('UserService')->getEntities() as $entity) {
|
||||
$tempOptions[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options[$field]['options'] = $tempOptions;
|
||||
$options[$field]['extras'] = ['class' => 'select-field'];
|
||||
break;
|
||||
default:
|
||||
$option = lang($this->getAttribute('class_path') . "." . strtoupper($field));
|
||||
$tempOptions = [
|
||||
'' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택",
|
||||
...lang($this->getAttribute('class_path') . "." . strtoupper($field))
|
||||
];
|
||||
$options[$field]['options'] = $tempOptions;
|
||||
$options[$field]['extras'] = [];
|
||||
break;
|
||||
}
|
||||
if (!is_array($option)) {
|
||||
throw new \Exception(static::class . DIRECTORY_SEPARATOR . __FUNCTION__ . "에서 {$field}의 options 값들이 배열이 아닙니다.\n" . var_export($option, true));
|
||||
}
|
||||
$options[$field] = $option;
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,9 +11,13 @@ class UserForm extends CommonForm
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getFormFields(string $action, ?array $fields = null): array
|
||||
public function getFormFields(string $action, array $fields = []): array
|
||||
{
|
||||
$fields = $fields ?? [
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
case 'create_form':
|
||||
$fields = [
|
||||
...$fields,
|
||||
'id',
|
||||
'passwd',
|
||||
'confirmpassword',
|
||||
@ -22,8 +26,12 @@ class UserForm extends CommonForm
|
||||
'mobile',
|
||||
'role',
|
||||
];
|
||||
if (in_array($action, ['modify_form', 'modify'])) {
|
||||
$fields = $fields ?? [
|
||||
break;
|
||||
case 'modify':
|
||||
case 'modify_form':
|
||||
$fields = [
|
||||
...$fields,
|
||||
'id',
|
||||
'passwd',
|
||||
'confirmpassword',
|
||||
'name',
|
||||
@ -32,19 +40,10 @@ class UserForm extends CommonForm
|
||||
'role',
|
||||
'status',
|
||||
];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
public function getFormFilters(string $action, ?array $fields = null): array
|
||||
{
|
||||
return $fields ?? [
|
||||
'role',
|
||||
'status',
|
||||
];
|
||||
}
|
||||
public function getIndexFields(string $action = 'index', ?array $fields = null): array
|
||||
{
|
||||
return $fields ?? [
|
||||
break;
|
||||
case 'view':
|
||||
$fields = [
|
||||
...$fields,
|
||||
'id',
|
||||
'name',
|
||||
'email',
|
||||
@ -52,12 +51,29 @@ class UserForm extends CommonForm
|
||||
'role',
|
||||
'status',
|
||||
];
|
||||
break;
|
||||
default:
|
||||
$fields = [
|
||||
...$fields,
|
||||
'id',
|
||||
'name',
|
||||
'email',
|
||||
'mobile',
|
||||
'role',
|
||||
'status'
|
||||
];
|
||||
break;
|
||||
}
|
||||
public function getBatchjobFields(string $action = 'index', ?array $fields = null): array
|
||||
return parent::getFormFields($action, $fields);
|
||||
}
|
||||
public function getFormFilters(string $action, array $fields = []): array
|
||||
{
|
||||
return $fields ?? ['status'];
|
||||
return parent::getFormFilters($action, [...$fields, 'role', 'status']);
|
||||
}
|
||||
public function getBatchjobFields(string $action, array $fields = []): array
|
||||
{
|
||||
return parent::getBatchjobFields($action, [...$fields, 'status']);
|
||||
}
|
||||
|
||||
public function getFormRule(string $action, string $field, array $rules = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
@ -67,14 +83,14 @@ class UserForm extends CommonForm
|
||||
$rules[$field] = $rule;
|
||||
break;
|
||||
case "passwd":
|
||||
$rules[$field] = in_array($action, ["create", "create_form"]) ? "required|trim|string" : "permit_empty|trim|string";
|
||||
$rules[$field] = in_array($action, ["create", "create_form"]) ? "required" : "permit_empty" . "|trim|string";
|
||||
break;
|
||||
case "confirmpassword":
|
||||
$rules[$field] = in_array($action, ["create", "create_form"]) ? "required|trim|string|matches[passwd]" : "permit_empty|trim|string|matches[passwd]";
|
||||
$rules[$field] = in_array($action, ["create", "create_form"]) ? "required" : "permit_empty" . "|trim|string|matches[passwd]";
|
||||
break;
|
||||
case "email":
|
||||
$rule = "required|trim|valid_email";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "" . "|trim|valid_email";
|
||||
$rules[$field] = $rule;
|
||||
break;
|
||||
case "role":
|
||||
|
||||
@ -22,59 +22,57 @@ class CommonHelper
|
||||
}
|
||||
return $this->_attributes[$key];
|
||||
}
|
||||
final public function form_dropdown_common(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], bool $isAll = false): string
|
||||
{
|
||||
// 필터 옵션이 없으면 빈 배열로 초기화
|
||||
if (!array_key_exists($field, $viewDatas['formOptions'])) {
|
||||
return ""; // 필터 옵션이 없으면 빈 문자열 반환
|
||||
}
|
||||
$extra = "";
|
||||
foreach ($extras as $extra_tag => $extra_value) {
|
||||
$extra .= sprintf(" %s=\"%s\"", $extra_tag, $extra_value);
|
||||
}
|
||||
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
||||
$html = sprintf("<select name=\"%s\" %s>", $field, $extra);
|
||||
$html .= "<option value=\"\">" . lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택" . "</option>";
|
||||
$html .= $this->form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes, $isAll);
|
||||
$html .= '</select>';
|
||||
return $html;
|
||||
}
|
||||
//필수함수
|
||||
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], bool $isAll = false): string
|
||||
{
|
||||
$html = "";
|
||||
switch ($field) {
|
||||
default:
|
||||
foreach ($viewDatas['formOptions'][$field] as $option_key => $option_value) {
|
||||
$isSelected = $option_key == $value ? ' selected' : '';
|
||||
$isDisabled = "";
|
||||
$attribute = "";
|
||||
$label = "";
|
||||
if ($option_value instanceof CommonEntity) {
|
||||
if ($option_key != $value && $option_value->getStatus() != DEFAULTS['STATUS'] && !$isAll) {
|
||||
continue;
|
||||
}
|
||||
foreach ($attributes as $attribute_name => $attribute_value) {
|
||||
$attribute .= sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value);
|
||||
}
|
||||
$label = $option_value->getCustomTitle();
|
||||
} else {
|
||||
$label = $option_value;
|
||||
}
|
||||
$html .= sprintf("<option value=\"%s\"%s%s%s>%s</option>", $option_key, $isSelected, $isDisabled, $attribute, $label);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
// final public function form_dropdown_common(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], bool $isAll = false): string
|
||||
// {
|
||||
// // 필터 옵션이 없으면 빈 배열로 초기화
|
||||
// if (!array_key_exists($field, $viewDatas['formOptions'])) {
|
||||
// return ""; // 필터 옵션이 없으면 빈 문자열 반환
|
||||
// }
|
||||
// $extra = "";
|
||||
// foreach ($extras as $extra_tag => $extra_value) {
|
||||
// $extra .= sprintf(" %s=\"%s\"", $extra_tag, $extra_value);
|
||||
// }
|
||||
// // $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
||||
// $html = sprintf("<select name=\"%s\" %s>", $field, $extra);
|
||||
// $html .= "<option value=\"\">" . lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택" . "</option>";
|
||||
// $html .= $this->form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes, $isAll);
|
||||
// $html .= '</select>';
|
||||
// return $html;
|
||||
// }
|
||||
// //필수함수
|
||||
// protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], bool $isAll = false): string
|
||||
// {
|
||||
// $html = "";
|
||||
// switch ($field) {
|
||||
// default:
|
||||
// foreach ($viewDatas['formOptions'][$field]['options'] as $option_key => $option_value) {
|
||||
// $isSelected = $option_key == $value ? ' selected' : '';
|
||||
// $isDisabled = "";
|
||||
// $attribute = "";
|
||||
// $label = "";
|
||||
// if ($option_value instanceof CommonEntity) {
|
||||
// if ($option_key != $value && $option_value->getStatus() != DEFAULTS['STATUS'] && !$isAll) {
|
||||
// continue;
|
||||
// }
|
||||
// foreach ($attributes as $attribute_name => $attribute_value) {
|
||||
// $attribute .= sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value);
|
||||
// }
|
||||
// $label = $option_value->getCustomTitle();
|
||||
// } else {
|
||||
// $label = $option_value;
|
||||
// }
|
||||
// $html .= sprintf("<option value=\"%s\"%s%s%s>%s</option>", $option_key, $isSelected, $isDisabled, $attribute, $label);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// return $html;
|
||||
// }
|
||||
public function getFieldLabel(string $field, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
dd($viewDatas['formRules']);
|
||||
// required가 있으면 class 추가
|
||||
$extras = (strpos($viewDatas['formRules'][$field], 'required') !== false) ? ["class" => "text-danger", "required" => "", ...$extras] : $extras;
|
||||
$label = $label ?: form_label(lang("{$this->getAttribute('class_path')}.label.{$field}"), $field, ['class' => 'form-label-sm', ...$extras]);
|
||||
$label = form_label($label, $field, ['class' => 'form-label-sm', ...$extras]);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
@ -99,25 +97,6 @@ class CommonHelper
|
||||
...$extras
|
||||
]);
|
||||
break;
|
||||
case 'role':
|
||||
if (!is_array($viewDatas['formOptions'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
// create, modify, create_form, modify_form일때 checkbox로 표시
|
||||
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
|
||||
$forms = [];
|
||||
foreach ($viewDatas['formOptions'][$field] as $key => $label) {
|
||||
if ($key !== '') { // 빈값은 제외
|
||||
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
//form_check에는 "class" => "form-control" 쓰면 않되거나 form-check를 써야함
|
||||
$forms[] = form_checkbox("{$field}[]", $key, in_array($key, $values), $extras) . $label;
|
||||
}
|
||||
}
|
||||
$form = implode(" ", $forms);
|
||||
} else {
|
||||
$form = form_dropdown($field, $value, $viewDatas, $extras);
|
||||
}
|
||||
break;
|
||||
case 'issue_at':
|
||||
case 'expired_at':
|
||||
case 'billing_at':
|
||||
@ -142,10 +121,8 @@ class CommonHelper
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['formFilters'])) {
|
||||
if (str_contains($field, "_uid")) {
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
}
|
||||
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras);
|
||||
$form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $viewDatas['formOptions'][$field]['extras']);
|
||||
// $form = $this->form_dropdown_common($field, $value, $viewDatas, $extras);
|
||||
} else {
|
||||
$form = form_input($field, $value ?? "", [
|
||||
"class" => "form-control",
|
||||
@ -161,14 +138,14 @@ class CommonHelper
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
if (array_key_exists($value, $viewDatas['formOptions'][$field])) {
|
||||
$value = "<a href=\"/admin/customer/client/detail/{$value}\">" . $viewDatas['formOptions'][$field][$value]->getTitle() . "</a>";
|
||||
if (array_key_exists($value, $viewDatas['formOptions'][$field]['options'])) {
|
||||
$value = "<a href=\"/admin/customer/client/detail/{$value}\">{$viewDatas['formOptions'][$field]['options'][$value]}</a>";
|
||||
}
|
||||
break;
|
||||
case 'role':
|
||||
$roles = [];
|
||||
foreach ($value as $key) {
|
||||
$roles[] = $viewDatas['formOptions'][$field][$key] ?? "";
|
||||
$roles[] = $viewDatas['formOptions'][$field]['options'][$key] ?? "";
|
||||
}
|
||||
$value = implode(" , ", $roles);
|
||||
break;
|
||||
@ -192,11 +169,7 @@ class CommonHelper
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['formFilters'])) {
|
||||
if (str_contains($field, "_uid")) {
|
||||
$value = array_key_exists($value, $viewDatas['formOptions'][$field]) && $viewDatas['formOptions'][$field][$value] ? $viewDatas['formOptions'][$field][$value]->getTitle() : "";
|
||||
} else {
|
||||
$value = array_key_exists($value, $viewDatas['formOptions'][$field]) ? $viewDatas['formOptions'][$field][$value] : "";
|
||||
}
|
||||
$value = $viewDatas['formOptions'][$field]['options'][$value] ?? "";
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -205,19 +178,18 @@ class CommonHelper
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$filter = "";
|
||||
if (in_array($field, $viewDatas['formFilters'])) {
|
||||
if (str_contains($field, "_uid")) {
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
}
|
||||
$attributes = [];
|
||||
$isAll = true;
|
||||
$filter = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes, $isAll);
|
||||
} else {
|
||||
$filter = array_key_exists($value, $viewDatas['formOptions'][$field]) ? $viewDatas['formOptions'][$field][$value] : "";
|
||||
$filter = form_dropdown(
|
||||
$field,
|
||||
$viewDatas['formOptions'][$field]['options'],
|
||||
$value,
|
||||
[...$extras, ...$viewDatas['formOptions'][$field]['extras']]
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -227,8 +199,6 @@ class CommonHelper
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
// dd($viewDatas);
|
||||
$label = $this->getFieldLabel($field, $label, $viewDatas, $extras);
|
||||
if (isset($viewDatas['order_field']) && $viewDatas['order_field'] == $field) {
|
||||
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS["UP"] : ICONS["DOWN"];
|
||||
}
|
||||
@ -237,7 +207,7 @@ class CommonHelper
|
||||
$query .= "order_field={$field}&order_value=";
|
||||
$query .= isset($viewDatas['order_value']) && $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
|
||||
$label = anchor(current_url() . "?" . $query, $label);
|
||||
form_dropdown('index_perpage', $viewDatas['index_pagination_options'], $viewDatas['index_perpage'], ['onChange' => 'this.form.submit()']);
|
||||
form_dropdown('perpage', $viewDatas['index_pagination_options'], $viewDatas['perpage'], ['onChange' => 'this.form.submit()']);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
|
||||
@ -18,19 +18,15 @@ class UserHelper extends CommonHelper
|
||||
$form = form_password($field, "", [...$extras]);
|
||||
break;
|
||||
case 'role':
|
||||
//$viewDatas['entity']->$field에서 getRole()로 캐스팅이 되지 않아서 대체함
|
||||
if (($viewDatas['entity'] ?? null) instanceof UserEntity) {
|
||||
$value = $viewDatas['entity']->getRole();
|
||||
}
|
||||
$currentRoles = is_array($value)
|
||||
? array_map('strtolower', array_map('trim', $value))
|
||||
: [];
|
||||
$form = '';
|
||||
//체크박스를 순회하며 생성
|
||||
foreach ($viewDatas['formOptions']['role'] as $key => $label) {
|
||||
//Form페이지에서는 맨앞에것 제외하기 위함
|
||||
$firstOption = array_shift($viewDatas['formOptions'][$field]['options']);
|
||||
foreach ($viewDatas['formOptions'][$field]['options'] as $key => $label) {
|
||||
$checked = in_array(strtolower(trim($key)), $currentRoles);
|
||||
$form .= '<label class="me-3">';
|
||||
// form_checkbox에 들어가는 값($key)은 원본 값을 유지(저장용).
|
||||
$form .= form_checkbox('role[]', $key, $checked, array_merge(['id' => "role_{$key}"], $extras));
|
||||
$form .= " {$label}";
|
||||
$form .= '</label>';
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Services;
|
||||
use App\Entities\CommonEntity;
|
||||
use App\Models\CommonModel;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use PhpParser\Node\Scalar\MagicConst\Dir;
|
||||
use RuntimeException;
|
||||
|
||||
abstract class CommonService
|
||||
@ -48,7 +49,11 @@ abstract class CommonService
|
||||
final public function getEntities(mixed $where = null, array $columns = ['*']): array
|
||||
{
|
||||
try {
|
||||
return $this->getEntities_process($where, $columns);
|
||||
$entities = $this->getEntities_process($where, $columns);
|
||||
echo "<P>test</P>";
|
||||
echo "<P>test</P>";
|
||||
echo static::class . DIRECTORY_SEPARATOR . __FUNCTION__ . " Query:" . $this->model->getLastQuery();
|
||||
return $entities;
|
||||
} catch (\Exception $e) {
|
||||
$message = sprintf(
|
||||
"\n------%s SQL오류-----<BR>\n%s\n%s\n------------------------------\n",
|
||||
@ -165,21 +170,21 @@ abstract class CommonService
|
||||
return $this->delete_process($uid);
|
||||
}
|
||||
//Index용
|
||||
final public function getindex_totalcount(): int
|
||||
final public function getTotalCount(): int
|
||||
{
|
||||
return $this->model->countAllResults(false);
|
||||
return $this->model->countAllResults();
|
||||
}
|
||||
//Limit처리
|
||||
final public function setLimit(int $per_page): void
|
||||
final public function setLimit(int $perpage): void
|
||||
{
|
||||
$this->model->limit($per_page);
|
||||
$this->model->limit($perpage);
|
||||
}
|
||||
//Offset처리
|
||||
final public function setOffset(int $offset): void
|
||||
{
|
||||
$this->model->offset($offset);
|
||||
}
|
||||
public function index_condition_filterField(string $field, mixed $filter_value): void
|
||||
public function setFilter(string $field, mixed $filter_value): void
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
@ -188,12 +193,12 @@ abstract class CommonService
|
||||
}
|
||||
}
|
||||
//검색어조건절처리
|
||||
public function index_condition_filterWord(string $word): void
|
||||
public function setSearchWord(string $word): void
|
||||
{
|
||||
$this->model->orLike($this->model->getTable() . "." . $this->model->getTitleField(), $word, 'both');
|
||||
}
|
||||
//날자검색
|
||||
public function index_condition_filterDate(string $start, string $end): void
|
||||
public function setDateFilter(string $start, string $end): void
|
||||
{
|
||||
$this->model->where(sprintf("%s.created_at >= '%s 00:00:00'", $this->model->getTable(), $start));
|
||||
$this->model->where(sprintf("%s.created_at <= '%s 23:59:59'", $this->model->getTable(), $end));
|
||||
|
||||
@ -8,7 +8,6 @@ use App\Entities\UserEntity;
|
||||
use App\Forms\UserForm;
|
||||
use App\Helpers\UserHelper;
|
||||
use App\Models\UserModel;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use RuntimeException;
|
||||
|
||||
class UserService extends CommonService
|
||||
@ -83,7 +82,7 @@ class UserService extends CommonService
|
||||
}
|
||||
//List 검색용
|
||||
//FormFilter 조건절 처리
|
||||
public function index_condition_filterField(string $field, mixed $filter_value): void
|
||||
public function setFilter(string $field, mixed $filter_value): void
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
@ -92,16 +91,16 @@ class UserService extends CommonService
|
||||
$this->model->where($where, null, false);
|
||||
break;
|
||||
default:
|
||||
parent::index_condition_filterField($field, $filter_value);
|
||||
parent::setFilter($field, $filter_value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//검색어조건절처리
|
||||
public function index_condition_filterWord(string $word): void
|
||||
public function setSearchWord(string $word): void
|
||||
{
|
||||
$this->model->orLike($this->model->getTable() . '.id', $word, 'both');
|
||||
$this->model->orLike($this->model->getTable() . "." . $this->model->getTitleField(), $word, 'both');
|
||||
$this->model->orLike($this->model->getTable() . '.email', $word, 'both');
|
||||
parent::index_condition_filterWord($word);
|
||||
parent::setSearchWord($word);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field) ?? ($viewDatas['formDatas'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,21 +0,0 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<th><?= lang("{$viewDatas['class_path']}.label.{$field}") ?></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entities'] as $entity): ?>
|
||||
<?php $viewDatas['entity'] = $entity; ?>
|
||||
<tr>
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<td><?= $viewDatas['service']->getHelper()->getFieldView($field, $entity->$field, $viewDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php $cnt++ ?>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1,70 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
|
||||
<!-- Layout Middle Start -->
|
||||
<table class="layout_middle">
|
||||
<tr>
|
||||
<td class="layout_left">
|
||||
<!-- Layout Left Start -->
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?>
|
||||
<!-- Layout Left End -->
|
||||
</td>
|
||||
<td class="layout_right">
|
||||
<!-- Layout Right Start -->
|
||||
<div class="layout_header"><?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?></div>
|
||||
<div id="container" class="layout_content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/index.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="index_body">
|
||||
<?= form_open(current_url(), ["method" => "get"]) ?>
|
||||
<nav class="index_top navbar navbar-expand-lg">
|
||||
<div class="container-fluid">
|
||||
<nav class="condition nav">
|
||||
조건:
|
||||
<?php foreach ($viewDatas['formFilters'] as $field): ?>
|
||||
<?= $viewDatas['service']->getHelper()->getListFilter($field, $viewDatas['index_filters'][$field] ?? old($field), $viewDatas) ?>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?= form_close() ?>
|
||||
<?= form_open(current_url(), ['id' => 'batchjob_form', 'method' => "post"]) ?>
|
||||
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="index_head_short_column">번호</th>
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['service']->getHelper()->getListLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<?php endforeach ?>
|
||||
<th class="index_head_short_column">작업</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entities'] as $entity): ?>
|
||||
<?php $viewDatas['entity'] = $entity; ?>
|
||||
<tr <?= $viewDatas['entity']->getStatus() === DEFAULTS['STATUS'] ? "" : 'class="table-danger"' ?>>
|
||||
<?php $num = $viewDatas['index_totalcount'] - (($viewDatas['index_page'] - 1) * $viewDatas['index_perpage'] + $cnt); ?>
|
||||
<td nowrap><?= $viewDatas['service']->getHelper()->getListButton('modify', $num, $viewDatas) ?></td>
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<td><?= $viewDatas['service']->getHelper()->getFieldView($field, $entity->$field, $viewDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
<td nowrap>
|
||||
<?= $viewDatas['service']->getHelper()->getListButton('view', '', $viewDatas) ?>
|
||||
<?= $viewDatas['service']->getHelper()->getListButton('delete', '', $viewDatas) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $cnt++ ?>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_bottom"); ?>
|
||||
<?= form_close() ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="layout_bottom"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?></div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,24 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field ?? null, $viewDatas) ?>
|
||||
<div><?= validation_show_error($field); ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,24 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field) ?? ($viewDatas['formDatas'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,55 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<!-- Layout Right Start -->
|
||||
<div id="container" class="layout_content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/index.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="index_body">
|
||||
<?= form_open(current_url(), ["method" => "get"]) ?>
|
||||
<nav class="index_top navbar navbar-expand-lg">
|
||||
<div class="container-fluid">
|
||||
<nav class="condition nav">
|
||||
조건:
|
||||
<?php foreach ($viewDatas['formFilters'] as $field): ?>
|
||||
<?= $viewDatas['service']->getHelper()->getListFilter($field, $viewDatas['index_filters'][$field] ?? old($field), $viewDatas) ?>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
</div>
|
||||
</nav>
|
||||
<?= form_close() ?>
|
||||
<?= form_open(current_url(), ['id' => 'batchjob_form', 'method' => "post"]) ?>
|
||||
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="index_head_short_column">번호</th>
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['service']->getHelper()->getListLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<?php endforeach ?>
|
||||
<th class="index_head_short_column">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entities'] as $entity): ?>
|
||||
<?php $viewDatas['entity'] = $entity; ?>
|
||||
<tr <?= $viewDatas['entity']->getStatus() === DEFAULTS['STATUS'] ? "" : 'class="table-danger"' ?>>
|
||||
<?php $num = $viewDatas['index_totalcount'] - (($viewDatas['index_page'] - 1) * $viewDatas['index_perpage'] + $cnt); ?>
|
||||
<td nowrap><?= $viewDatas['service']->getHelper()->getListButton('modify', $num, $viewDatas) ?></td>
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<td nowrap><?= $viewDatas['service']->getHelper()->getFieldView($field, $entity->$field, $viewDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
<td nowrap>
|
||||
<?= $viewDatas['service']->getHelper()->getListButton('view', '', $viewDatas) ?>
|
||||
<?= $viewDatas['service']->getHelper()->getListButton('delete', '', $viewDatas) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $cnt++ ?>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_bottom"); ?>
|
||||
<?= form_close() ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,24 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,17 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end" width="20%"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['service']->getHelper()->getFieldView($field, $viewDatas['entity']->$field, $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -3,11 +3,10 @@
|
||||
<div id="container" class="content">
|
||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, "", $viewDatas) ?></th>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $label, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['formDatas'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
@ -17,8 +16,7 @@
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?php if (session('message')): ?><div class="alert alert-info text-start"><?= session('message') ?></div><?php endif; ?>
|
||||
<?php if (session('message')): ?><div class="alert alert-danger text-start"><?= nl2br(session('message')) ?></div><?php endif; ?>
|
||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,9 +1,7 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<th><?= lang("{$viewDatas['class_path']}.label.{$field}") ?></th>
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($viewDatas['formFields'] as $field => $label): ?><th><?= $label ?></th><?php endforeach ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= session('message') ? $viewDatas['helper']->alertTrait(session('message')) : "" ?>
|
||||
<?php
|
||||
dd($viewDatas);
|
||||
$layouts = LAYOUTS[$viewDatas['layout']];
|
||||
$template = "templates" . DIRECTORY_SEPARATOR . "{$viewDatas['layout']}";
|
||||
?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($message = session('message')): ?><?php endif ?>
|
||||
<div class="layout_top"><?= $this->include("{$layouts['path']}/top"); ?></div>
|
||||
<table class="layout_middle">
|
||||
<tr>
|
||||
@ -21,7 +20,9 @@ $template = "templates" . DIRECTORY_SEPARATOR . "{$viewDatas['layout']}";
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="index_head_short_column">번호</th>
|
||||
<?php foreach ($viewDatas['indexFields'] as $field): ?><th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, lang("{$viewDatas['classPath']}.label.{$field}"), $viewDatas) ?></th><?php endforeach ?>
|
||||
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
|
||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $label, $viewDatas) ?></th>
|
||||
<?php endforeach ?>
|
||||
<th class="index_head_short_column">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -32,11 +33,11 @@ $template = "templates" . DIRECTORY_SEPARATOR . "{$viewDatas['layout']}";
|
||||
$viewDatas['entity'] = $entity;
|
||||
$isDefaultStatus = $entity->getStatus() === DEFAULTS['STATUS'];
|
||||
$rowClass = $isDefaultStatus ? "" : 'class="table-danger"';
|
||||
$num = $viewDatas['index_totalcount'] - (($viewDatas['index_page'] - 1) * $viewDatas['index_perpage'] + $cnt);
|
||||
$num = $viewDatas['index_totalcount'] - (($viewDatas['page'] - 1) * $viewDatas['perpage'] + $cnt);
|
||||
?>
|
||||
<tr <?= $rowClass ?>>
|
||||
<td nowrap><?= $viewDatas['helper']->getListButton('modify', $num, $viewDatas) ?></td>
|
||||
<?php foreach ($viewDatas['indexFields'] as $field): ?><td><?= $viewDatas['helper']->getFieldView($field, $entity->$field, $viewDatas) ?></td><?php endforeach ?>
|
||||
<?php foreach ($viewDatas['formFields'] as $field => $label): ?><td><?= $viewDatas['helper']->getFieldView($field, $entity->$field, $viewDatas) ?></td><?php endforeach ?>
|
||||
<td nowrap>
|
||||
<?= $viewDatas['helper']->getListButton('view', '', $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getListButton('delete', '', $viewDatas) ?>
|
||||
|
||||
@ -3,11 +3,10 @@
|
||||
<div id="container" class="content">
|
||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, "", $viewDatas) ?></th>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $label, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
@ -17,8 +16,7 @@
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?php if (session('message')): ?><div class="alert alert-info text-start"><?= session('message') ?></div><?php endif; ?>
|
||||
<?php if (session('message')): ?><div class="alert alert-danger text-start"><?= nl2br(session('message')) ?></div><?php endif; ?>
|
||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,18 +1,16 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="action_form">
|
||||
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end" width="20%"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['service']->getHelper()->getFieldView($field, $viewDatas['entity']->$field, $viewDatas) ?></td>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $label, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['helper']->getFieldView($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if (session('message')): ?><div class="alert alert-info text-start"><?= session('message') ?></div><?php endif; ?>
|
||||
<?php if (session('message')): ?><div class="alert alert-danger text-start"><?= nl2br(session('message')) ?></div><?php endif; ?>
|
||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,17 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('message')): echo $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['formFields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end" width="20%"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['service']->getHelper()->getFieldView($field, $viewDatas['entity']->$field, $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,4 +1,6 @@
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/user"><?= ICONS['MEMBER'] ?> 계정 관리</a>
|
||||
<a href="/admin/traffic"><?= ICONS['SETUP'] ?> 계정 관리</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/traffic"><?= ICONS['SETUP'] ?> 트래픽 관리</a>
|
||||
</div>
|
||||
@ -2,10 +2,10 @@
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><?= $viewDatas['helper']->getListButton('create', '', $viewDatas) ?></li>
|
||||
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
||||
<?php foreach ($viewDatas['batchjobFields'] as $field): ?>
|
||||
<?php foreach ($viewDatas['index_batchjobFields'] as $field): ?>
|
||||
<?= $viewDatas['helper']->getListFilter($field, null, $viewDatas, ['data-batchjob' => 'true']) ?>
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($viewDatas['batchjobButtons'] as $action => $label): ?>
|
||||
<?php foreach ($viewDatas['index_batchjobButtions'] as $action => $label): ?>
|
||||
<li class="nav-item"><?= $viewDatas['helper']->getListButton($action, $label, $viewDatas) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
@ -17,7 +17,7 @@
|
||||
function submitBatchJob() {
|
||||
var validate = false;
|
||||
//batchjob용 선택사항 검증
|
||||
<?php foreach ($viewDatas['batchjobFields'] as $field): ?>
|
||||
<?php foreach ($viewDatas['index_batchjobFields'] as $field): ?>
|
||||
var element = document.querySelector('[name="<?= $field ?>"][data-batchjob="true"]');
|
||||
if (element && element.value !== "") {
|
||||
validate = true;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<?= anchor(current_url() . '/download/excel', ICONS['EXCEL'], ["target" => "_self", "class" => "excel"]) ?>
|
||||
</nav>
|
||||
<nav class="pageinfo nav justify-content-end">
|
||||
Page:<?= $viewDatas['index_page'] ?? 1 ?>/<?= $viewDatas['index_totalpage'] ?>
|
||||
<?= form_dropdown('index_perpage', $viewDatas['index_pagination_options'], $viewDatas['index_perpage'], ['onChange' => 'this.form.submit()']) ?>
|
||||
Page:<?= $viewDatas['page'] ?? 1 ?>/<?= $viewDatas['index_totalpage'] ?>
|
||||
<?= form_dropdown('perpage', $viewDatas['index_pagination_options'], $viewDatas['perpage'], ['onChange' => 'this.form.submit()']) ?>
|
||||
/ 총:<?= $viewDatas['index_totalcount'] ?>
|
||||
</nav>
|
||||
Loading…
Reference in New Issue
Block a user