dbmsv2 init...1
This commit is contained in:
parent
e6cc878f79
commit
bfad1960ba
@ -362,25 +362,10 @@ define('LAYOUTS', [
|
||||
//List의 Page당 갯수
|
||||
define('DEFAULT_LIST_PERPAGE', $_ENV['LIST_PERPAGE'] ?? $_SERVER['LIST_PERPAGE'] ?? 20);
|
||||
|
||||
//서비스별 아이템 타입
|
||||
define('SERVICE_ITEM_TYPES', $_ENV['SERVICEINFO_ITEM_TYPES']
|
||||
?? $_SERVER['SERVICEINFO_ITEM_TYPES']
|
||||
?? [
|
||||
"LINE" => "라인",
|
||||
"IP" => "IP주소",
|
||||
"SERVER" => "서버",
|
||||
"CPU" => "CPU",
|
||||
"RAM" => "메모리",
|
||||
"STORAGE" => "저장장치",
|
||||
"SOFTWARE" => "소프트웨어",
|
||||
"DEFENCE" => "방어(CS)",
|
||||
"DOMAIN" => "도메인",
|
||||
]);
|
||||
|
||||
//신규서비스 Interval
|
||||
define('SERVICE_NEW_INTERVAL', $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVICE_NEW_INTERVAL'] ?? 7);
|
||||
//미지급 Item_type
|
||||
define('SERVICE_UNPAID_ITEM_TYPE', $_ENV['SERVICE_UNPAID_ITEM_TYPE'] ?? $_SERVER['SERVICE_UNPAID_ITEM_TYPE'] ?? "SERVER");
|
||||
|
||||
//사이트 접두사 정의
|
||||
define(
|
||||
'SITE_PREFIX',
|
||||
[
|
||||
|
||||
@ -193,17 +193,17 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('download/(:alpha)', 'LineController::download/$1');
|
||||
});
|
||||
$routes->group('ip', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'IpController::index');
|
||||
$routes->get('create', 'IpController::create_form');
|
||||
$routes->post('create', 'IpController::create');
|
||||
$routes->get('modify/(:num)', 'IpController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'IpController::modify/$1');
|
||||
$routes->get('view/(:num)', 'IpController::view/$1');
|
||||
$routes->get('delete/(:num)', 'IpController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'IpController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'IpController::batchjob');
|
||||
$routes->post('batchjob_delete', 'IpController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'IpController::download/$1');
|
||||
$routes->get('/', 'IPController::index');
|
||||
$routes->get('create', 'IPController::create_form');
|
||||
$routes->post('create', 'IPController::create');
|
||||
$routes->get('modify/(:num)', 'IPController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'IPController::modify/$1');
|
||||
$routes->get('view/(:num)', 'IPController::view/$1');
|
||||
$routes->get('delete/(:num)', 'IPController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'IPController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'IPController::batchjob');
|
||||
$routes->post('batchjob_delete', 'IPController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'IPController::download/$1');
|
||||
});
|
||||
$routes->group('cs', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'CSController::index');
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Helpers\Equipment\IpHelper;
|
||||
use App\Services\Equipment\IpService;
|
||||
use App\Helpers\Equipment\IPHelper;
|
||||
use App\Services\Equipment\IPService;
|
||||
|
||||
use App\Services\Equipment\LineService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
@ -11,7 +11,7 @@ use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class IpController extends EquipmentController
|
||||
class IPController extends EquipmentController
|
||||
{
|
||||
private ?LineService $_lineService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -23,17 +23,17 @@ class IpController extends EquipmentController
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): IpService
|
||||
public function getService(): IPService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new IpService();
|
||||
$this->_service = new IPService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): IpHelper
|
||||
public function getHelper(): IPHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new IpHelper();
|
||||
$this->_helper = new IPHelper();
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
@ -20,6 +20,8 @@ class ServerController extends EquipmentController
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->partinfo_cnt_range = array_combine(range(1, 10), range(1, 10));
|
||||
$this->partinfo_extra_options = array_merge(["" => "RAID 선택"], lang("{$this->getService()->getClassName()}.EXTRAS"));
|
||||
}
|
||||
public function getService(): ServerService
|
||||
{
|
||||
@ -49,16 +51,10 @@ class ServerController extends EquipmentController
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//View부분
|
||||
protected function view_process(mixed $entity): void
|
||||
//생성
|
||||
protected function create_form_process(): void
|
||||
{
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$entity->setItemEntities(
|
||||
$item_type,
|
||||
$this->getService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
||||
);
|
||||
}
|
||||
//부모처리
|
||||
parent::view_process($entity);
|
||||
$this->setDefaultValue('code', $this->getService()->getLastestCode());
|
||||
parent::create_form_process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,18 +87,12 @@ class UserController extends AdminController
|
||||
{
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$fields = [
|
||||
$this->initAction(__FUNCTION__, [
|
||||
'formFields' => ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile'],
|
||||
];
|
||||
// $this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
$this->initAction(__FUNCTION__, $fields);
|
||||
//FieldRule정의
|
||||
foreach ($this->getFormFields() as $field) {
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
}
|
||||
]);
|
||||
helper(['form']);
|
||||
//filter_fields에 해당하는 값이 있을 경우 정의
|
||||
$this->setFilterValues();
|
||||
$this->setDefaultValues();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
@ -123,14 +117,9 @@ class UserController extends AdminController
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$fields = [
|
||||
$this->initAction(__FUNCTION__, [
|
||||
'formFields' => ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile'],
|
||||
];
|
||||
$this->initAction(__FUNCTION__, $fields);
|
||||
//FieldRule정의
|
||||
foreach ($this->getFormFields() as $field) {
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
}
|
||||
]);
|
||||
//입력값정의
|
||||
$formDatas = [];
|
||||
foreach ($this->getFormFields() as $field) {
|
||||
|
||||
@ -85,147 +85,79 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
return $this->_control['action'];
|
||||
}
|
||||
final protected function setFormFields(array $fields): void
|
||||
{
|
||||
$this->_control['form_fields'] = $fields;
|
||||
}
|
||||
final protected function getFormFields(): array
|
||||
{
|
||||
return $this->_control['form_fields'] ?? [];
|
||||
}
|
||||
final protected function setFieldRule(string $field, string $rule): void
|
||||
{
|
||||
if (!array_key_exists('field_rules', $this->_control)) {
|
||||
$this->_control['field_rules'] = [];
|
||||
}
|
||||
$this->_control['field_rules'][$field] = $rule;
|
||||
}
|
||||
final protected function setFieldRules(array $rules): void
|
||||
{
|
||||
$this->_control['field_rules'] = $rules;
|
||||
}
|
||||
final protected function getFieldRule(string $field): string
|
||||
{
|
||||
return $this->_control['field_rules'][$field] ?? [];
|
||||
}
|
||||
final protected function getFieldRules(): array
|
||||
{
|
||||
return $this->_control['field_rules'] ?? [];
|
||||
}
|
||||
final protected function setIndexFields(array $fields): void
|
||||
{
|
||||
$this->_control['index_fields'] = $fields;
|
||||
}
|
||||
final protected function getIndexFields(): array
|
||||
{
|
||||
return $this->_control['index_fields'] ?? [];
|
||||
}
|
||||
final protected function setViewFields(array $fields): void
|
||||
{
|
||||
$this->_control['view_fields'] = $fields;
|
||||
}
|
||||
final protected function getViewFields(): array
|
||||
{
|
||||
return $this->_control['view_fields'] ?? [];
|
||||
}
|
||||
final protected function setFilterFields(array $fields): void
|
||||
{
|
||||
$this->_control['filter_fields'] = $fields;
|
||||
}
|
||||
final protected function getFilterFields(): array
|
||||
{
|
||||
return $this->_control['filter_fields'] ?? [];
|
||||
}
|
||||
final protected function setBatchjobFields(array $fields): void
|
||||
{
|
||||
$this->_control['batchjob_fields'] = $fields;
|
||||
}
|
||||
final protected function getBatchjobFields(): array
|
||||
{
|
||||
return $this->_control['batchjob_fields'] ?? [];
|
||||
}
|
||||
final protected function setBatchjobButtions(array $fields): void
|
||||
final protected function setDefaultValue($field, $value)
|
||||
{
|
||||
$this->_control['batchjob_buttions'] = $fields;
|
||||
}
|
||||
final protected function getBatchjobButtions(): array
|
||||
{
|
||||
return $this->_control['batchjob_buttions'] ?? [];
|
||||
}
|
||||
final protected function setFilterFieldOption(string $field, array $options): void
|
||||
{
|
||||
if (!array_key_exists('filter_optons', $this->_control)) {
|
||||
$this->_control['filter_optons'] = [];
|
||||
if (!array_key_exists('default_values', $this->_control)) {
|
||||
$this->_control['default_values'] = [];
|
||||
}
|
||||
//Filter Options 초기화
|
||||
$this->_control['filter_optons'][$field] = [
|
||||
"" => new FormOptionEntity(["uid" => "", "title" => lang("{$this->getService()->getClassName()}.label.{$field}") . " 선택"])
|
||||
];
|
||||
foreach ($options as $option) {
|
||||
$this->_control['filter_optons'][$field][$option->getPK()] = $option;
|
||||
}
|
||||
// dd($this->_control['filter_optons'][$field]);
|
||||
$this->_control['default_values'][$field] = $value;
|
||||
}
|
||||
final protected function getFilterFieldOption(string $field): array
|
||||
final protected function setDefaultValues(): void
|
||||
{
|
||||
return $this->_control['filter_optons'][$field];
|
||||
}
|
||||
final protected function setFilterValues(): void
|
||||
{
|
||||
if (!array_key_exists('filter_values', $this->_control)) {
|
||||
$this->_control['filter_values'] = [];
|
||||
}
|
||||
foreach ($this->getFilterFields() as $field) {
|
||||
$this->_control['filter_values'][$field] = $this->request->getVar($field);
|
||||
$this->setDefaultValue($field, $this->request->getVar($field));
|
||||
}
|
||||
}
|
||||
final protected function getFilterValues(?string $field = null): mixed
|
||||
final protected function getDefaultValue(?string $field = null): mixed
|
||||
{
|
||||
if ($field === null) {
|
||||
return $this->_control['filter_values'] ?? [];
|
||||
return $this->_control['default_values'] ?? [];
|
||||
}
|
||||
return array_key_exists($field, $this->_control['filter_values']) ? $this->_control['filter_values'][$field] : null;
|
||||
return array_key_exists($field, $this->_control['default_values']) ? $this->_control['default_values'][$field] : null;
|
||||
}
|
||||
|
||||
protected function initAction(string $action, $fields = []): void
|
||||
final protected function initAction(string $action, $fields = []): void
|
||||
{ //각 Field 초기화
|
||||
$this->setAction($action);
|
||||
$this->setFormFields(array_key_exists('formFields', $fields) ? $fields['formFields'] : $this->getService()->getFormFields());
|
||||
foreach ($this->getFormFields() as $field) {
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
switch ($action) {
|
||||
case 'view':
|
||||
$fields = $this->_control['view_fields'] = array_key_exists('viewFields', $fields) ? $fields['viewFields'] : $this->getService()->getViewFields();
|
||||
break;
|
||||
case 'index':
|
||||
$fields = $this->_control['index_fields'] = array_key_exists('indexFields', $fields) ? $fields['indexFields'] : $this->getService()->getIndexFields();
|
||||
break;
|
||||
default:
|
||||
$fields = $this->_control['form_fields'] = array_key_exists('formFields', $fields) ? $fields['formFields'] : $this->getService()->getFormFields();
|
||||
break;
|
||||
}
|
||||
$this->setIndexFields(array_key_exists('indexFields', $fields) ? $fields['indexFields'] : $this->getService()->getIndexFields());
|
||||
$this->setViewFields(array_key_exists('viewFields', $fields) ? $fields['viewFields'] : $this->getService()->getViewFields());
|
||||
$this->setFilterFields(array_key_exists('filterFields', $fields) ? $fields['filterFields'] : $this->getService()->getFilterFields());
|
||||
$this->_control['field_rules'] = [];
|
||||
foreach ($fields as $field) {
|
||||
$this->_control['field_rules'][$field] = $this->getService()->getFormFieldRule($action, $field);
|
||||
}
|
||||
$this->_control['filter_fields'] = array_key_exists('filterFields', $fields) ? $fields['filterFields'] : $this->getService()->getFilterFields();
|
||||
$this->_control['filter_optons'] = [];
|
||||
foreach ($this->getFilterFields() as $field) {
|
||||
$this->setFilterFieldOption($field, $this->getFormFieldOption($field));
|
||||
$this->_control['filter_optons'][$field] = [];
|
||||
foreach ($this->getService()->getFormFieldOption($field) as $option) {
|
||||
$this->_control['filter_optons'][$field][$option->getPK()] = $option;
|
||||
}
|
||||
}
|
||||
$this->setBatchJobFields(array_key_exists('batchjobFields', $fields) ? $fields['batchjobFields'] : $this->getService()->getBatchJobFields());
|
||||
$this->setBatchJobButtions(array_key_exists('batchjobButtions', $fields) ? $fields['batchjobFields'] : $this->getService()->getBatchJobButtons());
|
||||
}
|
||||
protected function getFormFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
default:
|
||||
$rule = $this->getService()->getFormFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$options = $this->getService()->getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 field의 options 값이 array가 아닙니다.\n" . var_export($options, true));
|
||||
}
|
||||
return $options;
|
||||
$this->_control['batchjob_fields'] = array_key_exists('batchjobFields', $fields) ? $fields['batchjobFields'] : $this->getService()->getBatchJobFields();
|
||||
$this->_control['batchjob_buttions'] = array_key_exists('batchjobButtions', $fields) ? $fields['batchjobFields'] : $this->getService()->getBatchJobButtons();
|
||||
}
|
||||
protected function setValidation(Validation $validation, string $field, string $rule): Validation
|
||||
{
|
||||
@ -309,7 +241,7 @@ abstract class CommonController extends BaseController
|
||||
// $this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
$this->initAction(__FUNCTION__);
|
||||
//filter_fields에 해당하는 값이 있을 경우 정의
|
||||
$this->setFilterValues();
|
||||
$this->setDefaultValues();
|
||||
$this->create_form_process();
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
@ -357,7 +289,7 @@ abstract class CommonController extends BaseController
|
||||
// $this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
$this->initAction(__FUNCTION__);
|
||||
//filter_fields에 해당하는 값이 있을 경우 정의
|
||||
$this->setFilterValues();
|
||||
$this->setDefaultValues();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
@ -415,9 +347,7 @@ abstract class CommonController extends BaseController
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields([$field]);
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
$this->initAction(__FUNCTION__, ['formFields' => [$field]]);
|
||||
//입력값정의
|
||||
$formDatas = [$field => $this->request->getVar($field)];
|
||||
//기존 Entity 가져오기
|
||||
@ -474,11 +404,7 @@ abstract class CommonController extends BaseController
|
||||
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
|
||||
}
|
||||
//각 Field 초기화: 일괄작업은 선택된 조건항목 Field만 존재하므로 Field와 Rule을 정의
|
||||
$this->setAction(__FUNCTION__);
|
||||
$this->setFormFields([$selectedFields]);
|
||||
foreach ($selectedFields as $field) {
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
}
|
||||
$this->initAction(__FUNCTION__, ['formFields' => [$selectedFields]]);
|
||||
$this->batchjob_process($uids, $formDatas);
|
||||
$this->_db->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
@ -561,12 +487,8 @@ abstract class CommonController extends BaseController
|
||||
try {
|
||||
//각 Field 초기화
|
||||
$this->initAction(__FUNCTION__);
|
||||
//FieldRule정의
|
||||
foreach ($this->getViewFields() as $field) {
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
}
|
||||
//filter_fields에 해당하는 값이 있을 경우 정의
|
||||
$this->setFilterValues();
|
||||
$this->setDefaultValues();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
@ -585,12 +507,12 @@ abstract class CommonController extends BaseController
|
||||
//조건절 처리
|
||||
final protected function setConditionForList(): void
|
||||
{
|
||||
$this->setFilterValues();
|
||||
$this->setDefaultValues();
|
||||
//Filter 조건절 처리
|
||||
foreach ($this->getFilterFields() as $field) {
|
||||
$filter_value = $this->getFilterValues($field);
|
||||
if ($filter_value !== null && $filter_value !== '') {
|
||||
$this->getService()->setList_FormFilter($field, $filter_value);
|
||||
$default_value = $this->getDefaultValue($field);
|
||||
if ($default_value !== null && $default_value !== '') {
|
||||
$this->getService()->setList_FormFilter($field, $default_value);
|
||||
}
|
||||
}
|
||||
//검색어조건절 처리
|
||||
@ -648,9 +570,6 @@ abstract class CommonController extends BaseController
|
||||
$this->initAction(__FUNCTION__);
|
||||
//Return Url정의
|
||||
$this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
foreach ($this->getIndexFields() as $field) {
|
||||
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
|
||||
}
|
||||
// 현재 URL을 스택에 저장
|
||||
helper(['form']);
|
||||
//조건절 처리
|
||||
|
||||
@ -12337,18 +12337,18 @@
|
||||
"tableId": "8GYAVBvZGaMFeq3QuXk_B",
|
||||
"name": "extra",
|
||||
"comment": "추가정보(RAID등)",
|
||||
"dataType": "JSON",
|
||||
"dataType": "VARCHAR(50)",
|
||||
"default": "",
|
||||
"options": 0,
|
||||
"ui": {
|
||||
"keys": 0,
|
||||
"widthName": 60,
|
||||
"widthComment": 96,
|
||||
"widthDataType": 60,
|
||||
"widthDataType": 75,
|
||||
"widthDefault": 60
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1755486793127,
|
||||
"updateAt": 1755757819522,
|
||||
"createAt": 1755486722061
|
||||
}
|
||||
},
|
||||
|
||||
@ -403,7 +403,7 @@ CREATE TABLE `serverinfo_partinfo` (
|
||||
`serviceinfo_uid` int(11) DEFAULT NULL COMMENT '서비스정보',
|
||||
`billing_method` varchar(20) NOT NULL COMMENT '청구방법(month,onetime)',
|
||||
`cnt` tinyint(4) NOT NULL DEFAULT 1 COMMENT '갯수',
|
||||
`extra` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '추가정보(RAID등)',
|
||||
`extra` varchar(50) NULL DEFAULT NULL COMMENT '추가정보(RAID등)',
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`uid`),
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -17,7 +17,7 @@ abstract class CommonEntity extends Entity
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
public function getPK(): string
|
||||
public function getPK(): int|string|null
|
||||
{
|
||||
$field = constant("static::PK");
|
||||
return $this->attributes[$field];
|
||||
|
||||
@ -12,4 +12,9 @@ class PartEntity extends EquipmentEntity
|
||||
const STATUS_OCCUPIED = "occupied";
|
||||
const STATUS_FORBIDDEN = "forbidden";
|
||||
const DEFAULT_STATUS = self::STATUS_AVAILABLE;
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->attributes['type'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,19 +210,24 @@ class CommonHelper
|
||||
}
|
||||
|
||||
// header.php에서 getFieldForm_Helper사용
|
||||
protected function form_dropdown_disabled(string $field, mixed $value, array $formOptions, array $extras = [], mixed $disabledKey = null): string
|
||||
protected function form_dropdown_disabled(string $field, mixed $value, array $viewDatas, array $extras = [], mixed $disabledKey = null): string
|
||||
{
|
||||
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
||||
$extra = "";
|
||||
foreach ($extras as $option_tag => $option_value) {
|
||||
$extra = sprintf(" %s=\"%s\"", $option_tag, htmlspecialchars($option_value, ENT_QUOTES, 'UTF-8'));
|
||||
foreach ($extras as $extra_tag => $extra_value) {
|
||||
$extra .= sprintf(" %s=\"%s\"", $extra_tag, htmlspecialchars($extra_value, ENT_QUOTES, 'UTF-8'));
|
||||
}
|
||||
// 필터 옵션이 없으면 빈 배열로 초기화
|
||||
if (!array_key_exists($field, $viewDatas['control']['filter_optons'])) {
|
||||
return $field; // 필터 옵션이 없으면 빈 문자열 반환
|
||||
}
|
||||
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
||||
$html = sprintf("<select name=\"%s\" %s>", $field, $extra);
|
||||
foreach ($formOptions as $key => $filterEntity) {
|
||||
$html .= "<option value=\"\">" . lang("{$viewDatas['class_path']}.label.{$field}") . " 선택" . "</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $entity) {
|
||||
$isSelected = $key == $value ? ' selected' : '';
|
||||
// disabledKey가 설정되어 있으면 해당 키를 disabled로 설정
|
||||
$isDisabled = $disabledKey !== null && $filterEntity->getStatus() === $disabledKey ? ' disabled' : '';
|
||||
$html .= sprintf("<option value=\"%s\"%s%s>%s</option>", $key, $isSelected, $isDisabled, $filterEntity->getTitle());
|
||||
$isDisabled = $disabledKey !== null && $entity->getStatus() === $disabledKey ? ' disabled' : '';
|
||||
$html .= sprintf("<option value=\"%s\"%s%s>%s</option>", $key, $isSelected, $isDisabled, $entity->getTitle());
|
||||
}
|
||||
$html .= '</select>';
|
||||
return $html;
|
||||
@ -253,7 +258,7 @@ class CommonHelper
|
||||
}
|
||||
$form = implode(" ", $forms);
|
||||
} else {
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas, $extras);
|
||||
}
|
||||
break;
|
||||
case 'issue_at':
|
||||
@ -261,8 +266,6 @@ class CommonHelper
|
||||
case 'billing_at':
|
||||
case 'start_at':
|
||||
case 'end_at':
|
||||
case 'manufactur_at':
|
||||
case 'format_at':
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
|
||||
@ -279,15 +282,12 @@ class CommonHelper
|
||||
case 'clientinfo_uid':
|
||||
case 'serviceinfo_uid':
|
||||
case 'serverinfo_uid':
|
||||
case 'partinfo_uid':
|
||||
case 'ipinfo_uid':
|
||||
case 'csinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['filter_fields'])) {
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas, $extras);
|
||||
} else {
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
}
|
||||
@ -295,7 +295,6 @@ class CommonHelper
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
||||
{
|
||||
switch ($field) {
|
||||
@ -342,6 +341,20 @@ class CommonHelper
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
if (!array_key_exists($field, $viewDatas['control']['filter_optons'])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 정의되지 않았습니다.");
|
||||
}
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
$options = ["" => lang("{$viewDatas['class_path']}.label.{$field}") . " 선택"];
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $entity) {
|
||||
$options[$key] = $entity->getTitle();
|
||||
}
|
||||
return form_dropdown($field, $options, $value, $extras);;
|
||||
}
|
||||
public function getListLabel(string $field, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
|
||||
@ -10,4 +10,22 @@ abstract class CustomerHelper extends CommonHelper
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
case 'old_clientinfo_uid':
|
||||
case 'clientinfo_uid':
|
||||
case 'serviceinfo_uid':
|
||||
case 'serverinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ class ServiceHelper extends CustomerHelper
|
||||
switch ($field) {
|
||||
case 'switchinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
|
||||
@ -10,4 +10,22 @@ abstract class EquipmentHelper extends CommonHelper
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
case 'old_clientinfo_uid':
|
||||
case 'clientinfo_uid':
|
||||
case 'serviceinfo_uid':
|
||||
case 'serverinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,4 +11,61 @@ class ServerHelper extends EquipmentHelper
|
||||
parent::__construct();
|
||||
$this->setTitleField(field: ServerModel::TITLE);
|
||||
}
|
||||
private function getPartFormOption(string $field, array $viewDatas): array
|
||||
{
|
||||
$options = ["" => lang("{$viewDatas['class_path']}.label.{$field}") . " 선택"];
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $entity) {
|
||||
$options[$key] = $entity->getTitle();
|
||||
}
|
||||
// foreach ($viewDatas['control']['filter_optons'][$field] as $key => $entity) {
|
||||
// if (!array_key_exists($entity->getType(), $options)) {
|
||||
// $options[$entity->getType()] = [];
|
||||
// }
|
||||
// $options[$entity->getType()][$key] = $entity->getTitle();
|
||||
// }
|
||||
return $options;
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'manufactur_at':
|
||||
case 'format_at':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
break;
|
||||
case 'partinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = form_dropdown($field, $this->getPartFormOption($field, $viewDatas), $value, $extras);
|
||||
$form .= " 갯수 " . form_dropdown("{$field}_cnt", $viewDatas['partinfo_cnt_range'], $value ?? 1);
|
||||
$form .= " 옵션 " . form_dropdown("{$field}_extra", $viewDatas['partinfo_extra_options'], $value ?? 1);
|
||||
break;
|
||||
case 'ipinfo_uid':
|
||||
case 'csinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_disabled($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'cs_uid':
|
||||
case 'ipinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
case 'partinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = form_dropdown($field, $this->getPartFormOption($field, $viewDatas), $value, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,9 +12,9 @@ return [
|
||||
],
|
||||
"TYPE" => [
|
||||
"CPU" => "CPU",
|
||||
"RAM" => "RAM",
|
||||
"DISK" => "DISK",
|
||||
"SOFTWARE" => "SOFTWARE",
|
||||
"RAM" => "메모리",
|
||||
"DISK" => "저장장치",
|
||||
"SOFTWARE" => "소프트웨어",
|
||||
],
|
||||
"STATUS" => [
|
||||
'available' => "사용가능",
|
||||
|
||||
@ -19,6 +19,14 @@ return [
|
||||
"ipinfo_uid" => "IP정보",
|
||||
"csinfo_uid" => "CS정보",
|
||||
],
|
||||
"TITLE" => [
|
||||
'HP DL360 Gen6' => "HP DL360 Gen6",
|
||||
"HP DL360 Gen7" => "HP DL360 Gen7",
|
||||
"HP DL360 Gen8" => "HP DL360 Gen8",
|
||||
"HP DL360 Gen9" => "HP DL360 Gen9",
|
||||
"HP DL360 Gen10" => "HP DL360 Gen10",
|
||||
"Hitach HA3000" => "Hitach HA3000",
|
||||
],
|
||||
"TYPE" => [
|
||||
'hp' => "HP",
|
||||
"del" => "DELL",
|
||||
@ -29,4 +37,11 @@ return [
|
||||
'occupied' => "서비스중",
|
||||
'forbidden' => "사용불가",
|
||||
],
|
||||
"EXTRAS" => [
|
||||
'RAID0' => "RAID0",
|
||||
'RAID1' => "RAID1",
|
||||
'RAID5' => "RAID5",
|
||||
'RAID6' => "RAID6",
|
||||
'RAID10' => "RAID10",
|
||||
],
|
||||
];
|
||||
|
||||
@ -84,7 +84,7 @@ abstract class CommonModel extends Model
|
||||
// 수동입력인 경우
|
||||
if (!$this->useAutoIncrement) {
|
||||
$rule = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[" . $this->getTable() . "." . $field . "]" : "";
|
||||
} else {
|
||||
$rule = "required|numeric";
|
||||
}
|
||||
@ -92,6 +92,10 @@ abstract class CommonModel extends Model
|
||||
case $this->getTitleField():
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "code":
|
||||
$rule = "required|regex_match[/^[a-zA-Z0-9\-]+$/]|min_length[4]|max_length[20]";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[" . $this->getTable() . "." . $field . "]" : "";
|
||||
break;
|
||||
case 'picture':
|
||||
$rule = "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},300]|max_dims[{$field},2048,768]";
|
||||
break;
|
||||
@ -240,7 +244,7 @@ abstract class CommonModel extends Model
|
||||
|
||||
//List 검색용
|
||||
//FormFilter 조건절 처리
|
||||
final public function setList_FormFilter(string $field, mixed $filter_value): void {}
|
||||
final public function setList_FormFilter(string $field, mixed $default_value): void {}
|
||||
//검색어조건절처리
|
||||
final public function setList_WordFilter(string $word): void {}
|
||||
//날자검색
|
||||
|
||||
@ -31,10 +31,6 @@ abstract class CustomerModel extends CommonModel
|
||||
$rule = "required|trim|string";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[" . $this->getTable() . "." . $field . "]" : "";
|
||||
break;
|
||||
case "code":
|
||||
$rule = "required|trim|alpha_numeric|min_length[4]|max_length[20]";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[" . $this->getTable() . "." . $field . "]" : "";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "permit_empty|trim|string";
|
||||
break;
|
||||
|
||||
@ -21,10 +21,6 @@ abstract class EquipmentModel extends CommonModel
|
||||
$rule = "required|trim|string";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[" . $this->getTable() . "." . $field . "]" : "";
|
||||
break;
|
||||
case "code":
|
||||
$rule = "required|trim|alpha_numeric|min_length[4]|max_length[20]";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[" . $this->getTable() . "." . $field . "]" : "";
|
||||
break;
|
||||
case "clientinfo_uid":
|
||||
case "serviceinfo_uid":
|
||||
case "serverinfo_uid":
|
||||
|
||||
@ -57,4 +57,12 @@ class ServerModel extends EquipmentModel
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
|
||||
//create용 장비코드 마지막번호 가져오기
|
||||
final public function getLastestCode(int $default = 1): string
|
||||
{
|
||||
$entity = $this->selectMax($this->primaryKey)->first();
|
||||
$pk = (int) ($entity->getPK() ?? $default); // 정수로 강제 변환
|
||||
return sprintf("%s-M%03d", date('ymd'), $pk);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +132,6 @@ abstract class CommonService
|
||||
foreach (lang($this->getClassName() . '.' . strtoupper($field)) as $key => $value) {
|
||||
$options[$key] = new FormOptionEntity(['uid' => $key, 'title' => $value]);
|
||||
}
|
||||
// dd($options);
|
||||
break;
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
@ -196,12 +195,12 @@ abstract class CommonService
|
||||
$this->getModel()->offset($offset);
|
||||
}
|
||||
//FormFilter 조건절 처리
|
||||
public function setList_FormFilter(string $field, mixed $filter_value): void
|
||||
public function setList_FormFilter(string $field, mixed $default_value): void
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
//일반검색
|
||||
$this->getModel()->where("{$this->getModel()->getTable()}.{$field}", $filter_value);
|
||||
$this->getModel()->where("{$this->getModel()->getTable()}.{$field}", $default_value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,16 +105,16 @@ class ClientService extends CustomerService
|
||||
|
||||
//List 검색용
|
||||
//FormFilter 조건절 처리
|
||||
public function setList_FormFilter(string $field, mixed $filter_value): void
|
||||
public function setList_FormFilter(string $field, mixed $default_value): void
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
$where = "FIND_IN_SET(" . $this->getModel()->escape($filter_value) . ", {$this->getModel()->getTable()}.{$field}) > 0";
|
||||
$where = "FIND_IN_SET(" . $this->getModel()->escape($default_value) . ", {$this->getModel()->getTable()}.{$field}) > 0";
|
||||
//FIND_IN_SET()은 MySQL 함수이므로 CodeIgniter가 이를 일반 컬럼명으로 착각하고 escape하게 되면 오류가 발생합니다. 따라서 ->where($sql, null, false)로 명시하여 escape를 꺼줘야 정상 작동
|
||||
$this->getModel()->where($where, null, false);
|
||||
break;
|
||||
default:
|
||||
parent::setList_FormFilter($field, $filter_value);
|
||||
parent::setList_FormFilter($field, $default_value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,22 +21,19 @@ class ServerService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"serviceinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"title",
|
||||
"partinfo_uid",
|
||||
"price",
|
||||
"manufactur_at",
|
||||
"format_at",
|
||||
"status",
|
||||
"partinfo_uid",
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['clientinfo_uid', 'serviceinfo_uid', 'type', 'status', 'partinfo_uid', 'ipinfo_uid', 'csinfo_uid'];
|
||||
return ['clientinfo_uid', 'serviceinfo_uid', 'type', 'title', 'status', 'partinfo_uid'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
@ -75,11 +72,13 @@ class ServerService extends EquipmentService
|
||||
case 'partinfo_uid':
|
||||
$options = $this->getPartService()->getEntities(['status' => PartEntity::STATUS_AVAILABLE]);
|
||||
break;
|
||||
case 'ipinfo_uid':
|
||||
$options = $this->getIPService()->getEntities(['status' => IPEntity::STATUS_AVAILABLE]);
|
||||
case 'ipinfo_uid': //수정때문에 전체가 필요
|
||||
// $options = $this->getIPService()->getEntities(['status' => IPEntity::STATUS_AVAILABLE]);
|
||||
$options = $this->getIPService()->getEntities();
|
||||
break;
|
||||
case 'csinfo_uid':
|
||||
$options = $this->getCSService()->getEntities(['status' => CSEntity::STATUS_AVAILABLE]);
|
||||
case 'csinfo_uid': //수정때문에 전체가 필요
|
||||
// $options = $this->getCSService()->getEntities(['status' => CSEntity::STATUS_AVAILABLE]);
|
||||
$options = $this->getCSService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
@ -87,6 +86,11 @@ class ServerService extends EquipmentService
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//create용 장비코드 마지막번호 가져오기
|
||||
final public function getLastestCode(int $default = 1): string
|
||||
{
|
||||
return $this->getModel()->getLastestCode($default);
|
||||
}
|
||||
//List 검색용
|
||||
//OrderBy 처리
|
||||
public function setOrderBy(mixed $field = null, mixed $value = null): void
|
||||
|
||||
@ -31,7 +31,7 @@ class SwitchService extends EquipmentService
|
||||
}
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return ['code', 'clientinfo_uid', 'serviceinfo_uid', 'serverinfo_uid', 'status'];
|
||||
return ['code', 'status', 'clientinfo_uid', 'serviceinfo_uid', 'serverinfo_uid'];
|
||||
}
|
||||
//기본기능
|
||||
//FieldForm관련용
|
||||
|
||||
@ -54,16 +54,16 @@ class UserService extends CommonService
|
||||
}
|
||||
//List 검색용
|
||||
//FormFilter 조건절 처리
|
||||
public function setList_FormFilter(string $field, mixed $filter_value): void
|
||||
public function setList_FormFilter(string $field, mixed $default_value): void
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
$where = "FIND_IN_SET(" . $this->getModel()->escape($filter_value) . ", {$this->getModel()->getTable()}.{$field}) > 0";
|
||||
$where = "FIND_IN_SET(" . $this->getModel()->escape($default_value) . ", {$this->getModel()->getTable()}.{$field}) > 0";
|
||||
//FIND_IN_SET()은 MySQL 함수이므로 CodeIgniter가 이를 일반 컬럼명으로 착각하고 escape하게 되면 오류가 발생합니다. 따라서 ->where($sql, null, false)로 명시하여 escape를 꺼줘야 정상 작동
|
||||
$this->getModel()->where($where, null, false);
|
||||
break;
|
||||
default:
|
||||
parent::setList_FormFilter($field, $filter_value);
|
||||
parent::setList_FormFilter($field, $default_value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['filter_values'][$field] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['default_values'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['filter_values'][$field] ?? null), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['control']['default_values'][$field] ?? null), $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entities'] as $entity): ?>
|
||||
<?php $viewDatas['entity'] = $entity; ?>
|
||||
<tr <?= $viewDatas['entity']->getStatus() === $viewDatas['entity']::DEFAULT_STATUS ? "" : 'class="table-danger"' ?>>
|
||||
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
|
||||
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
|
||||
<td nowrap><?= $viewDatas['helper']->getListButton('modify', '', $viewDatas) ?></td>
|
||||
<?php foreach ($viewDatas['control']['index_fields'] as $field): ?>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<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['control']['batchjob_fields'] as $field): ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, null, $viewDatas, ['data-batchjob' => 'true']) ?>
|
||||
<?= $viewDatas['helper']->getListFilter($field, null, $viewDatas, ['data-batchjob' => 'true']) ?>
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($viewDatas['control']['batchjob_buttions'] as $action => $label): ?>
|
||||
<li class="nav-item"><?= $viewDatas['helper']->getListButton($action, $label, $viewDatas) ?></li>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<nav class="condition nav">
|
||||
조건:
|
||||
<?php foreach ($viewDatas['control']['filter_fields'] as $field): ?>
|
||||
<?= $viewDatas['helper']->getFieldForm($field, $viewDatas['control']['filter_values'][$field] ?? old($field), $viewDatas, ['id' => $field, 'index_content_top_filter' => 'true']) ?>
|
||||
<?= $viewDatas['helper']->getListFilter($field, $viewDatas['control']['default_values'][$field] ?? old($field), $viewDatas, ['id' => $field]) ?>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<nav class="search nav justify-content-center">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user