dbms_init...1
This commit is contained in:
parent
d89354b487
commit
d5803e18ba
@ -94,8 +94,8 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->get('download/(:alpha)', 'PointController::download/$1');
|
||||
});
|
||||
});
|
||||
$routes->group('device', ['namespace' => 'App\Controllers\Admin\Device'], function ($routes) {
|
||||
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Device'], function ($routes) {
|
||||
$routes->group('device', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'LineController::index', []);
|
||||
$routes->get('create', 'LineController::create_form');
|
||||
$routes->post('create', 'LineController::create');
|
||||
@ -108,7 +108,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'LineController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'LineController::download/$1');
|
||||
});
|
||||
$routes->group('ip', ['namespace' => 'App\Controllers\Admin\Device'], function ($routes) {
|
||||
$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');
|
||||
@ -121,7 +121,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'IpController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'IpController::download/$1');
|
||||
});
|
||||
$routes->group('network', ['namespace' => 'App\Controllers\Admin\Device'], function ($routes) {
|
||||
$routes->group('network', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'NetworkController::index', []);
|
||||
$routes->get('create', 'NetworkController::create_form');
|
||||
$routes->post('create', 'NetworkController::create');
|
||||
@ -134,7 +134,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'NetworkController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'NetworkController::download/$1');
|
||||
});
|
||||
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Device'], function ($routes) {
|
||||
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'ServerController::index', []);
|
||||
$routes->get('create', 'ServerController::create_form');
|
||||
$routes->post('create', 'ServerController::create');
|
||||
@ -147,7 +147,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'ServerController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ServerController::download/$1');
|
||||
});
|
||||
$routes->group('part', ['namespace' => 'App\Controllers\Admin\Device'], function ($routes) {
|
||||
$routes->group('part', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'PartController::index', []);
|
||||
$routes->get('create', 'PartController::create_form');
|
||||
$routes->post('create', 'PartController::create');
|
||||
@ -160,7 +160,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'PartController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'PartController::download/$1');
|
||||
});
|
||||
$routes->group('software', ['namespace' => 'App\Controllers\Admin\Device'], function ($routes) {
|
||||
$routes->group('software', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'SoftwareController::index', []);
|
||||
$routes->get('create', 'SoftwareController::create_form');
|
||||
$routes->post('create', 'SoftwareController::create');
|
||||
|
||||
@ -37,10 +37,6 @@ class ClientController extends CustomerController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['name', 'email', 'phone', 'role'];
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
{
|
||||
@ -92,7 +88,7 @@ class ClientController extends CustomerController
|
||||
protected function view_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::TITLE, 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
|
||||
'fields' => [$this->getService()->getModel()->getTitleField(), 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
|
||||
];
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
@ -100,7 +96,7 @@ class ClientController extends CustomerController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()::TITLE, 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
|
||||
'fields' => [$this->getService()->getModel()->getTitleField(), 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
|
||||
@ -1,19 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Device;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Controllers\Admin\AdminController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Device\LineService;
|
||||
use App\Services\Device\ServerService;
|
||||
use App\Services\Equipment\LineService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Customer\ClientService;
|
||||
|
||||
abstract class DeviceController extends AdminController
|
||||
abstract class EquipmentController extends AdminController
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?LineService $_lineService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -34,17 +36,19 @@ abstract class DeviceController extends AdminController
|
||||
}
|
||||
return $this->_lineService;
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService($this->request);
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'serverinfo_uid':
|
||||
$options[$field] = $this->getServerService()->getFormFieldOption($field);
|
||||
// echo $this->getUserModel()->getLastQuery();
|
||||
// dd($options);
|
||||
break;
|
||||
case 'lineinfo_uid':
|
||||
$options[$field] = $this->getLineService()->getFormFieldOption($field);
|
||||
case 'clientinfo_uid':
|
||||
$options[$field] = $this->getClientService()->getFormFieldOption($field);
|
||||
// echo $this->getUserModel()->getLastQuery();
|
||||
// dd($options);
|
||||
break;
|
||||
@ -54,5 +58,4 @@ abstract class DeviceController extends AdminController
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Device;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Device\IpHelper;
|
||||
use App\Services\Device\IpService;
|
||||
use App\Helpers\Equipment\IpHelper;
|
||||
use App\Services\Equipment\IpService;
|
||||
|
||||
class IpController extends DeviceController
|
||||
class IpController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -35,11 +35,19 @@ class IpController extends DeviceController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function setOrcerByForList()
|
||||
{
|
||||
//OrderBy 처리
|
||||
$this->getService()->getModel()->orderBy('INET_ATON(ip)', 'ASC', false);
|
||||
parent::setOrcerByForList();
|
||||
}
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['lineinfo_uid', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'updated_at'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Device;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Entities\Device\LineEntity;
|
||||
use App\Helpers\Device\LineHelper;
|
||||
use App\Services\Device\LineService;
|
||||
use App\Services\Device\IpService;
|
||||
use App\Entities\Device\IpEntity;
|
||||
use App\Entities\Equipment\LineEntity;
|
||||
use App\Helpers\Equipment\LineHelper;
|
||||
use App\Services\Equipment\LineService;
|
||||
use App\Services\Equipment\IpService;
|
||||
use App\Entities\Equipment\IpEntity;
|
||||
|
||||
class LineController extends DeviceController
|
||||
class LineController extends EquipmentController
|
||||
{
|
||||
private ?IpService $_ipService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Device;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Device\NetworkHelper;
|
||||
use App\Services\Device\NetworkService;
|
||||
use App\Helpers\Equipment\NetworkHelper;
|
||||
use App\Services\Equipment\NetworkService;
|
||||
|
||||
class NetworkController extends DeviceController
|
||||
class NetworkController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -35,18 +35,13 @@ class NetworkController extends DeviceController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
protected function index_process(): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setValidation($validation, $action, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
$fields = [
|
||||
'fields' => ['code', 'clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Device;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Device\PartHelper;
|
||||
use App\Services\Device\PartService;
|
||||
use App\Helpers\Equipment\PartHelper;
|
||||
use App\Services\Equipment\PartService;
|
||||
|
||||
class PartController extends DeviceController
|
||||
class PartController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Device;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Device\ServerHelper;
|
||||
use App\Services\Device\ServerService;
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Services\Equipment\ServerService;
|
||||
|
||||
class ServerController extends DeviceController
|
||||
class ServerController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -35,18 +35,13 @@ class ServerController extends DeviceController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
protected function index_process(): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setValidation($validation, $action, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
$fields = [
|
||||
'fields' => ['code', 'clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Device;
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Device\SoftwareHelper;
|
||||
use App\Services\Device\SoftwareService;
|
||||
use App\Helpers\Equipment\SoftwareHelper;
|
||||
use App\Services\Equipment\SoftwareService;
|
||||
|
||||
class SoftwareController extends DeviceController
|
||||
class SoftwareController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -66,7 +66,7 @@ class MyLogController extends AdminController
|
||||
protected function view_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['user_uid', 'class_name', 'method_name', $this->getService()->getModel()::TITLE, 'status', 'created_at', 'content'],
|
||||
'fields' => ['user_uid', 'class_name', 'method_name', $this->getService()->getModel()->getTitleField(), 'status', 'created_at', 'content'],
|
||||
];
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
@ -74,7 +74,7 @@ class MyLogController extends AdminController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['user_uid', 'class_name', 'method_name', $this->getService()->getModel()::TITLE, 'status', 'created_at'],
|
||||
'fields' => ['user_uid', 'class_name', 'method_name', $this->getService()->getModel()->getTitleField(), 'status', 'created_at'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
|
||||
@ -54,11 +54,6 @@ class UserController extends AdminController
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'];
|
||||
}
|
||||
|
||||
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
||||
{
|
||||
switch ($action) {
|
||||
@ -78,7 +73,7 @@ class UserController extends AdminController
|
||||
protected function view_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
|
||||
'fields' => ['id', $this->getService()->getModel()->getTitleField(), 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
@ -86,7 +81,7 @@ class UserController extends AdminController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
|
||||
'fields' => ['id', $this->getService()->getModel()->getTitleField(), 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Device;
|
||||
|
||||
use App\Models\Device\NetworkModel;
|
||||
|
||||
class NetworkEntity extends DeviceEntity
|
||||
{
|
||||
const PK = NetworkModel::PK;
|
||||
const TITLE = NetworkModel::TITLE;
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Device;
|
||||
|
||||
use App\Models\Device\RackModel;
|
||||
|
||||
class RackEntity extends DeviceEntity
|
||||
{
|
||||
const PK = RackModel::PK;
|
||||
const TITLE = RackModel::TITLE;
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Device;
|
||||
|
||||
use App\Models\Device\ServerModel;
|
||||
|
||||
class ServerEntity extends DeviceEntity
|
||||
{
|
||||
const PK = ServerModel::PK;
|
||||
const TITLE = ServerModel::TITLE;
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Device;
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
|
||||
abstract class DeviceEntity extends CommonEntity
|
||||
abstract class EquipmentEntity extends CommonEntity
|
||||
{
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Device;
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Device\IpModel;
|
||||
use App\Models\Equipment\IpModel;
|
||||
|
||||
class IpEntity extends DeviceEntity
|
||||
class IpEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = IpModel::PK;
|
||||
const TITLE = IpModel::TITLE;
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Device;
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Device\LineModel;
|
||||
use App\Models\Equipment\LineModel;
|
||||
|
||||
class LineEntity extends DeviceEntity
|
||||
class LineEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = LineModel::PK;
|
||||
const TITLE = LineModel::TITLE;
|
||||
11
app/Entities/Equipment/NetworkEntity.php
Normal file
11
app/Entities/Equipment/NetworkEntity.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\NetworkModel;
|
||||
|
||||
class NetworkEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = NetworkModel::PK;
|
||||
const TITLE = NetworkModel::TITLE;
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Device;
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Device\PartModel;
|
||||
use App\Models\Equipment\PartModel;
|
||||
|
||||
class PartEntity extends DeviceEntity
|
||||
class PartEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = PartModel::PK;
|
||||
const TITLE = PartModel::TITLE;
|
||||
11
app/Entities/Equipment/ServerEntity.php
Normal file
11
app/Entities/Equipment/ServerEntity.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\ServerModel;
|
||||
|
||||
class ServerEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = ServerModel::PK;
|
||||
const TITLE = ServerModel::TITLE;
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Device;
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Device\SoftwareModel;
|
||||
use App\Models\Equipment\SoftwareModel;
|
||||
|
||||
class SoftwareEntity extends DeviceEntity
|
||||
class SoftwareEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = SoftwareModel::PK;
|
||||
const TITLE = SoftwareModel::TITLE;
|
||||
@ -244,11 +244,12 @@ class CommonHelper
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
case 'manufactur_at':
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
case 'description':
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' tinymce' : 'tinymce';
|
||||
$form = form_textarea($field, $value ?? "", ['id' => $field, 'class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
default:
|
||||
@ -311,6 +312,7 @@ class CommonHelper
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
case 'manufactur_at':
|
||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Device;
|
||||
|
||||
use App\Models\Device\NetworkModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class NetworkHelper extends DeviceHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: NetworkModel::TITLE);
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Device;
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Helpers\CommonHelper;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class DeviceHelper extends CommonHelper
|
||||
class EquipmentHelper extends CommonHelper
|
||||
{
|
||||
protected function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Device;
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Device\IpModel;
|
||||
use App\Models\Equipment\IpModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class IpHelper extends DeviceHelper
|
||||
class IpHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Device;
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Device\LineModel;
|
||||
use App\Models\Equipment\LineModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class LineHelper extends DeviceHelper
|
||||
class LineHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
34
app/Helpers/Equipment/NetworkHelper.php
Normal file
34
app/Helpers/Equipment/NetworkHelper.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Equipment\NetworkModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class NetworkHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: NetworkModel::TITLE);
|
||||
}
|
||||
|
||||
// public function getListButton(string $action, array $viewDatas, array $extras = []): string
|
||||
// {
|
||||
// switch ($action) {
|
||||
// case 'create':
|
||||
// $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
// $action = anchor(
|
||||
// current_url() . '/' . $action . '?' . $this->request->getUri()->getQuery(),
|
||||
// '입력',
|
||||
// $extras
|
||||
// );
|
||||
// break;
|
||||
// default:
|
||||
// $action = parent::getListButton($action, $viewDatas, $extras);
|
||||
// break;
|
||||
// }
|
||||
// return $action;
|
||||
// }
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Device;
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Device\PartModel;
|
||||
use App\Models\Equipment\PartModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class PartHelper extends DeviceHelper
|
||||
class PartHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Device;
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Device\ServerModel;
|
||||
use App\Models\Equipment\ServerModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class ServerHelper extends DeviceHelper
|
||||
class ServerHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Device;
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Device\SoftwareModel;
|
||||
use App\Models\Equipment\SoftwareModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class SoftwareHelper extends DeviceHelper
|
||||
class SoftwareHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -2,9 +2,10 @@
|
||||
return [
|
||||
'title' => "네트워크장비정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "소유자명",
|
||||
'code' => "코드",
|
||||
'type' => "종류",
|
||||
'model' => "제목",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
@ -18,7 +19,9 @@ return [
|
||||
"TYPE" => [
|
||||
"L2" => "L2",
|
||||
"L3" => "L3",
|
||||
"Backbone" => "Backbone",
|
||||
"L4" => "L4",
|
||||
"Router" => "Router",
|
||||
"colocation" => "코로케이션",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용",
|
||||
34
app/Language/en/Equipment/Server.php
Normal file
34
app/Language/en/Equipment/Server.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "서버장비정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "소유자명",
|
||||
'code' => "코드",
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'manufactur_at' => "제조일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'L2',
|
||||
'status' => "use"
|
||||
],
|
||||
"TYPE" => [
|
||||
"normal" => "일반",
|
||||
"kcs" => "KCS",
|
||||
"vpc" => "VPC",
|
||||
"jcs" => "JCS",
|
||||
"VPN" => "VPN",
|
||||
"defence" => "방어",
|
||||
"colocation" => "코로케이션",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용",
|
||||
"pause" => "수리중",
|
||||
"occupied" => "사용중",
|
||||
],
|
||||
];
|
||||
@ -50,8 +50,6 @@ abstract class CommonModel extends Model
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
abstract public function getFilterFields(): array;
|
||||
abstract public function getBatchJobFields(): array;
|
||||
final public function getTable(): string
|
||||
{
|
||||
return constant("static::TABLE");
|
||||
@ -207,6 +205,8 @@ abstract class CommonModel extends Model
|
||||
foreach (array_keys($formDatas) as $field) {
|
||||
$entity->$field = $this->convertEntityData($field, $formDatas);
|
||||
}
|
||||
//수정일추가
|
||||
$entity->updated_at = date("Y-m-d H:i:s");
|
||||
LogCollector::debug("[{$entity->getPK()}/{$entity->getTitle()}] 변경 후 내용");
|
||||
LogCollector::debug(var_export($entity->toArray(), true));
|
||||
return $this->save_process($entity);
|
||||
|
||||
@ -18,19 +18,12 @@ class AccountModel extends CustomerModel
|
||||
"alias",
|
||||
"title",
|
||||
"amount",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -20,20 +20,13 @@ class ClientModel extends CustomerModel
|
||||
"account_balance",
|
||||
"coupon_balance",
|
||||
"point_balance",
|
||||
"status"
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -17,19 +17,12 @@ class CouponModel extends CustomerModel
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -17,19 +17,12 @@ class PointModel extends CustomerModel
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Device;
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Models\CommonModel;
|
||||
|
||||
abstract class DeviceModel extends CommonModel
|
||||
abstract class EquipmentModel extends CommonModel
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Device;
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Device\IpEntity;
|
||||
use App\Entities\Equipment\IpEntity;
|
||||
|
||||
class IpModel extends DeviceModel
|
||||
class IpModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "ipinfo";
|
||||
const PK = "uid";
|
||||
@ -17,19 +17,12 @@ class IpModel extends DeviceModel
|
||||
"ip",
|
||||
"price",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["lineinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Device;
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Device\LineEntity;
|
||||
use App\Entities\Equipment\LineEntity;
|
||||
|
||||
class LineModel extends DeviceModel
|
||||
class LineModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "lineinfo";
|
||||
const PK = "uid";
|
||||
@ -18,19 +18,12 @@ class LineModel extends DeviceModel
|
||||
"bandwith",
|
||||
"price",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Device;
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Device\NetworkEntity;
|
||||
use App\Entities\Equipment\NetworkEntity;
|
||||
|
||||
class NetworkModel extends DeviceModel
|
||||
class NetworkModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "networkinfo";
|
||||
const PK = "uid";
|
||||
@ -13,31 +13,28 @@ class NetworkModel extends DeviceModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = NetworkEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"price",
|
||||
"description",
|
||||
"status",
|
||||
"description",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
$rule = "if_exist|numeric";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
@ -45,6 +42,9 @@ class NetworkModel extends DeviceModel
|
||||
case "model":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|in_list[L2,L3,L4,Router]";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[use,pause,occupied]";
|
||||
break;
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Device;
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Device\PartEntity;
|
||||
use App\Entities\Equipment\PartEntity;
|
||||
|
||||
class PartModel extends DeviceModel
|
||||
class PartModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "partinfo";
|
||||
const PK = "uid";
|
||||
@ -17,19 +17,12 @@ class PartModel extends DeviceModel
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
@ -1,35 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Device;
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Device\ServerEntity;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
|
||||
class ServerModel extends DeviceModel
|
||||
class ServerModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "serverinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "title";
|
||||
const TITLE = "model";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ServerEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"description",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
@ -37,14 +34,26 @@ class ServerModel extends DeviceModel
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
case "amount":
|
||||
$rule = "if_exist|numeric";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "title":
|
||||
case "code":
|
||||
case "model":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|in_list[normal,kcs,vpc,jcs,vpn,defence,clocation]";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[in,out]";
|
||||
$rule = "required|in_list[use,pause,occupied]";
|
||||
break;
|
||||
case "description":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
case "manufactur_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Device;
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Device\SoftwareEntity;
|
||||
use App\Entities\Equipment\SoftwareEntity;
|
||||
|
||||
class SoftwareModel extends DeviceModel
|
||||
class SoftwareModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "serverinfo";
|
||||
const PK = "uid";
|
||||
@ -17,19 +17,12 @@ class SoftwareModel extends DeviceModel
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
@ -19,20 +19,13 @@ class MyLogModel extends CommonModel
|
||||
"method_name",
|
||||
"title",
|
||||
"content",
|
||||
"status"
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['user_uid', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -20,20 +20,13 @@ class UserModel extends CommonModel
|
||||
"email",
|
||||
"mobile",
|
||||
"role",
|
||||
"status"
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -22,7 +22,8 @@ class UserSNSModel extends CommonModel
|
||||
"name",
|
||||
"email",
|
||||
"detail",
|
||||
"status"
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@ -36,6 +36,19 @@ class GoogleService extends AuthService
|
||||
return new UserEntity();
|
||||
}
|
||||
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['id', 'passwd'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function checkUser(string $access_code): UserEntity
|
||||
{
|
||||
try {
|
||||
|
||||
@ -24,6 +24,21 @@ class LocalService extends AuthService
|
||||
{
|
||||
return new UserEntity();
|
||||
}
|
||||
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['id', 'passwd'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
public function checkUser(array $formDatas): UserEntity
|
||||
{
|
||||
$entity = $this->getEntity(['id' => $formDatas['id']]);
|
||||
|
||||
@ -18,6 +18,9 @@ abstract class CommonService
|
||||
abstract public function getModelClass(): mixed;
|
||||
abstract public function getEntityClass(): mixed;
|
||||
abstract public function getClassName(): string;
|
||||
abstract public function getFields(): array;
|
||||
abstract public function getFilterFields(): array;
|
||||
abstract public function getBatchJobFields(): array;
|
||||
final public function __get($name)
|
||||
{
|
||||
if (!array_key_exists($name, $this->_serviceDatas)) {
|
||||
@ -44,18 +47,6 @@ abstract class CommonService
|
||||
}
|
||||
return $this->_model;
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return $this->getModel()->getFields();
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return $this->getModel()->getFilterFields();
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return $this->getModel()->getBatchJobFields();
|
||||
}
|
||||
final public function getEntity(mixed $where, $isThrow = true): mixed
|
||||
{
|
||||
$entity = is_array($where) ? $this->getModel()->where($where)->first() : $this->getModel()->find($where);
|
||||
|
||||
@ -25,4 +25,22 @@ class AccountService extends CustomerService
|
||||
{
|
||||
return new AccountEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
"alias",
|
||||
"title",
|
||||
"amount"
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,4 +42,16 @@ class ClientService extends CustomerService
|
||||
// die(var_export($formDatas, true));
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['name', 'email', 'phone', 'role'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,4 +25,21 @@ class CouponService extends CustomerService
|
||||
{
|
||||
return new CouponEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,4 +25,21 @@ class PointService extends CustomerService
|
||||
{
|
||||
return new PointEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
"title",
|
||||
"amount"
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Device;
|
||||
|
||||
use App\Entities\Device\NetworkEntity;
|
||||
use App\Models\Device\NetworkModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class NetworkService extends DeviceService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Network";
|
||||
}
|
||||
public function getModelClass(): NetworkModel
|
||||
{
|
||||
return new NetworkModel();
|
||||
}
|
||||
public function getEntityClass(): NetworkEntity
|
||||
{
|
||||
return new NetworkEntity();
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Device;
|
||||
|
||||
use App\Entities\Device\ServerEntity;
|
||||
use App\Models\Device\ServerModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Services\Device\DeviceService; // Ensure this path is correct and the class exists or create the class if missing
|
||||
|
||||
class ServerService extends DeviceService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Server";
|
||||
}
|
||||
public function getModelClass(): ServerModel
|
||||
{
|
||||
return new ServerModel();
|
||||
}
|
||||
public function getEntityClass(): ServerEntity
|
||||
{
|
||||
return new ServerEntity();
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Device;
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Services\CommonService;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
abstract class DeviceService extends CommonService
|
||||
abstract class EquipmentService extends CommonService
|
||||
{
|
||||
protected function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
@ -13,6 +13,6 @@ abstract class DeviceService extends CommonService
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return "Device";
|
||||
return "Equipment";
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Device;
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Device\IpEntity;
|
||||
use App\Models\Device\IpModel;
|
||||
use App\Entities\Equipment\IpEntity;
|
||||
use App\Models\Equipment\IpModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class IpService extends DeviceService
|
||||
class IpService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -25,4 +25,21 @@ class IpService extends DeviceService
|
||||
{
|
||||
return new IpEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"lineinfo_uid",
|
||||
"ip",
|
||||
"price",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["lineinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Device;
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Device\LineEntity;
|
||||
use App\Models\Device\LineModel;
|
||||
use App\Entities\Equipment\LineEntity;
|
||||
use App\Models\Equipment\LineModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class LineService extends DeviceService
|
||||
class LineService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -25,4 +25,22 @@ class LineService extends DeviceService
|
||||
{
|
||||
return new LineEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"type",
|
||||
"title",
|
||||
"bandwith",
|
||||
"price",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
48
app/Services/Equipment/NetworkService.php
Normal file
48
app/Services/Equipment/NetworkService.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Equipment\NetworkEntity;
|
||||
use App\Models\Equipment\NetworkModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class NetworkService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Network";
|
||||
}
|
||||
public function getModelClass(): NetworkModel
|
||||
{
|
||||
return new NetworkModel();
|
||||
}
|
||||
public function getEntityClass(): NetworkEntity
|
||||
{
|
||||
return new NetworkEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'status'];
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Device;
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Device\PartEntity;
|
||||
use App\Models\Device\PartModel;
|
||||
use App\Entities\Equipment\PartEntity;
|
||||
use App\Models\Equipment\PartModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class PartService extends DeviceService
|
||||
class PartService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -25,4 +25,21 @@ class PartService extends DeviceService
|
||||
{
|
||||
return new PartEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
50
app/Services/Equipment/ServerService.php
Normal file
50
app/Services/Equipment/ServerService.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Models\Equipment\ServerModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Services\Equipment\EquipmentService; // Ensure this path is correct and the class exists or create the class if missing
|
||||
|
||||
class ServerService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Server";
|
||||
}
|
||||
public function getModelClass(): ServerModel
|
||||
{
|
||||
return new ServerModel();
|
||||
}
|
||||
public function getEntityClass(): ServerEntity
|
||||
{
|
||||
return new ServerEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'type', 'status'];
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Device;
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Device\SoftwareEntity;
|
||||
use App\Models\Device\SoftwareModel;
|
||||
use App\Entities\Equipment\SoftwareEntity;
|
||||
use App\Models\Equipment\SoftwareModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class SoftwareService extends DeviceService
|
||||
class SoftwareService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -25,4 +25,21 @@ class SoftwareService extends DeviceService
|
||||
{
|
||||
return new SoftwareEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
@ -27,6 +27,26 @@ class MyLogService extends CommonService
|
||||
return new MyLogEntity();
|
||||
}
|
||||
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"user_uid",
|
||||
"class_name",
|
||||
"method_name",
|
||||
"title",
|
||||
"content",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['user_uid', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
|
||||
public function save($service, string $method, AuthService $myauth, string $title): MyLogEntity
|
||||
{
|
||||
$formDatas = [
|
||||
|
||||
@ -26,4 +26,25 @@ class UserSNSService extends CommonService
|
||||
{
|
||||
return new UserSNSEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"site",
|
||||
"user_uid",
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"detail",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,20 @@ class UserService extends CommonService
|
||||
{
|
||||
return new UserEntity();
|
||||
}
|
||||
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['id', 'passwd', 'confirmpassword', $this->getModel()->getTitleField(), 'email', 'mobile', 'role'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
|
||||
public function create(array $formDatas, mixed $entity = null): UserEntity
|
||||
{
|
||||
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
|
||||
|
||||
@ -1,41 +1,25 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
|
||||
<body>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field), $viewDatas) ?>
|
||||
<div><?= validation_show_error($field); ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?php if (session()->has('error')): ?><div class="alert alert-info text-start"><?= nl2br(session('error')) ?></div><?php endif; ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field), $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>
|
||||
<!-- <script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<script>
|
||||
tinymce.init({
|
||||
selector: 'textarea#description', // Replace this CSS selector to match the placeholder element for TinyMCE
|
||||
license_key: 'gpl',
|
||||
// inline: true,
|
||||
plugins: 'advlist autolink lists link image charmap preview anchor',
|
||||
toolbar: 'undo redo | accordion accordionremove | importword exportword exportpdf | math | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl',
|
||||
menubar: 'file edit view insert format tools table help'
|
||||
});
|
||||
</script> -->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -47,12 +47,12 @@
|
||||
<?= form_close() ?>
|
||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||
</div>
|
||||
<div class="index_bottom"><?= $this->include("templates/common/modal_fetch"); ?></div>
|
||||
<div class="index_bottom"><?= $this->include("templates/common/" . (isset($viewDatas['modal_type']) ? $viewDatas['modal_type'] : 'modal_fetch')); ?></div>
|
||||
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
|
||||
</div>
|
||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||
<!-- Layout Right End -->
|
||||
</td>
|
||||
</td>SSS
|
||||
</tr>
|
||||
</table>
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<div id="container" class="content">
|
||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
||||
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
@ -18,17 +20,6 @@
|
||||
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?php if (session()->has('error')): ?><div class="alert alert-info text-start"><?= nl2br(session('error')) ?></div><?php endif; ?>
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
</div>
|
||||
<!-- <script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<script>
|
||||
tinymce.init({
|
||||
selector: 'textarea#description', // Replace this CSS selector to match the placeholder element for TinyMCE
|
||||
license_key: 'gpl',
|
||||
// inline: true,
|
||||
plugins: 'advlist autolink lists link image charmap preview anchor',
|
||||
toolbar: 'undo redo | accordion accordionremove | importword exportword exportpdf | math | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl',
|
||||
menubar: 'file edit view insert format tools table help'
|
||||
});
|
||||
</script> -->
|
||||
<?= $this->endSection() ?>
|
||||
@ -20,6 +20,7 @@
|
||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@ -1,11 +1,5 @@
|
||||
<!-- 처음 호출할때 사용법
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="시작URL">시작</button>
|
||||
-->
|
||||
<!-- 동적으로 ifram src 바꾸고싶을때
|
||||
<span data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="바꾸고싶은URL" style="cursor:pointer;">바꾸기</span>
|
||||
-->
|
||||
<div id="index_action_form" class="index_action_form modal fade" tabindex="-1" aria-labelledby="modal_label"
|
||||
aria-hidden="true">
|
||||
<!-- 모달 HTML -->
|
||||
<div id="index_action_form" class="index_action_form modal fade" tabindex="-1" aria-labelledby="modal_label" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -18,8 +12,7 @@
|
||||
<!-- 여기에 동적으로 콘텐츠가 로드됩니다 -->
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"
|
||||
onClick="window.location.reload()">닫기</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" onClick="window.location.reload()">닫기</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -29,58 +22,49 @@
|
||||
const modal = document.getElementById('index_action_form');
|
||||
const modalBody = document.getElementById('modal-body-content');
|
||||
|
||||
// 콘텐츠 로드 함수
|
||||
async function loadContent(url) {
|
||||
try {
|
||||
//console.log('콘텐츠 로딩 시작:', url);
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP 오류! 상태: ${response.status}`);
|
||||
}
|
||||
const content = await response.text();
|
||||
//console.log('받은 콘텐츠:', content.substring(0, 100) + '...'); // 콘텐츠의 처음 100자만 로그
|
||||
modalBody.innerHTML = content;
|
||||
try {
|
||||
// ✅ form.js 로딩
|
||||
await loadScript('/js/<?= $viewDatas['layout'] ?>/form.js');
|
||||
//console.log('form.js 로드 완료');
|
||||
if (typeof window.initializeForm === 'function') {
|
||||
//console.log('initializeForm 함수 실행');
|
||||
window.initializeForm();
|
||||
} else {
|
||||
//console.log('initializeForm 함수를 찾을 수 없음');
|
||||
}
|
||||
} catch (scriptError) {
|
||||
console.error('스크립트 로드 중 오류 발생:', scriptError);
|
||||
}
|
||||
|
||||
//console.log('추가 스크립트 실행 시작');
|
||||
// 스크립트 로딩 순서 보장 및 실행
|
||||
const scripts = modalBody.getElementsByTagName('script');
|
||||
for (let script of scripts) {
|
||||
if (script.src) {
|
||||
//console.log('외부 스크립트 로드:', script.src);
|
||||
const newScript = document.createElement('script');
|
||||
newScript.src = script.src;
|
||||
document.body.appendChild(newScript);
|
||||
await loadScript(script.src); // 외부 스크립트 순차적으로 로드
|
||||
} else {
|
||||
//console.log('인라인 스크립트 실행');
|
||||
eval(script.innerHTML);
|
||||
eval(script.innerHTML); // 인라인 스크립트 실행
|
||||
}
|
||||
}
|
||||
//console.log('setupFormSubmission 실행');
|
||||
setupFormSubmission();
|
||||
|
||||
setupFormSubmission(); // 폼 제출 이벤트 핸들러 재설정
|
||||
} catch (error) {
|
||||
console.error('콘텐츠 로드 중 오류 발생:', error);
|
||||
modalBody.innerHTML = '<p>콘텐츠를 로드하는 중 오류가 발생했습니다. 다시 시도해 주세요.</p>';
|
||||
}
|
||||
}
|
||||
|
||||
// 외부 스크립트 동적으로 로드하는 함수
|
||||
function loadScript(src) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const script = document.createElement('script');
|
||||
script.src = src;
|
||||
script.onload = () => resolve();
|
||||
script.onerror = () => reject(new Error(`스크립트 로드 실패: ${src}`));
|
||||
document.body.appendChild(script);
|
||||
});
|
||||
}
|
||||
|
||||
// 폼 제출 처리
|
||||
function setupFormSubmission() {
|
||||
//console.log('setupFormSubmission 시작');
|
||||
const form = modalBody.querySelector('form');
|
||||
if (form) {
|
||||
//console.log('폼 찾음:', form);
|
||||
form.addEventListener('submit', async (e) => {
|
||||
//console.log('폼 제출 이벤트 발생');
|
||||
e.preventDefault();
|
||||
const formData = new FormData(form);
|
||||
try {
|
||||
@ -102,14 +86,12 @@
|
||||
setupFormSubmission(); // 새로운 폼에 대해 다시 이벤트 리스너 설정
|
||||
}
|
||||
} else {
|
||||
// HTML 응답 처리
|
||||
const htmlContent = await response.text();
|
||||
modalBody.innerHTML = htmlContent;
|
||||
|
||||
// HTML에 포함된 스크립트 실행
|
||||
const scripts = modalBody.getElementsByTagName('script');
|
||||
for (let script of scripts) {
|
||||
eval(script.innerHTML);
|
||||
eval(script.innerHTML); // 인라인 스크립트 실행
|
||||
}
|
||||
|
||||
setupFormSubmission(); // 새로운 폼에 대해 다시 이벤트 리스너 설정
|
||||
@ -119,11 +101,10 @@
|
||||
modalBody.innerHTML = '<p>데이터 저장 중 오류가 발생했습니다. 다시 시도해 주세요.</p>';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//console.log('폼을 찾을 수 없음');
|
||||
}
|
||||
}
|
||||
|
||||
// 모달 열릴 때 콘텐츠 로딩
|
||||
modal.addEventListener('show.bs.modal', (event) => {
|
||||
const button = event.relatedTarget;
|
||||
const url = button.getAttribute('data-src');
|
||||
@ -135,30 +116,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
// 모달 닫힐 때 콘텐츠 초기화
|
||||
modal.addEventListener('hidden.bs.modal', () => {
|
||||
modalBody.innerHTML = '';
|
||||
});
|
||||
|
||||
function loadScript(src) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const script = document.createElement('script');
|
||||
script.src = src;
|
||||
script.onload = () => {
|
||||
//console.log(`스크립트 로드 완료: ${src}`);
|
||||
resolve();
|
||||
};
|
||||
script.onerror = () => reject(new Error(`스크립트 로드 실패: ${src}`));
|
||||
document.body.appendChild(script);
|
||||
});
|
||||
}
|
||||
|
||||
// 모달이 완전히 표시된 후 form.js 초기화 함수 호출
|
||||
document.getElementById('index_action_form').addEventListener('shown.bs.modal', function() {
|
||||
if (typeof window.initializeForm === 'function') {
|
||||
//console.log('모달 표시 후 initializeForm 함수 실행');
|
||||
window.initializeForm();
|
||||
} else {
|
||||
//console.log('모달 표시 후에도 initializeForm 함수를 찾을 수 없음');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -1,119 +1,34 @@
|
||||
(function() {
|
||||
//console.log('form.js가 로드되었습니다.');
|
||||
|
||||
function initializeModalComponents(modal) {
|
||||
//console.log('모달 컴포넌트 초기화 시작');
|
||||
|
||||
// 약간의 지연을 주어 모달이 완전히 렌더링되도록 함
|
||||
setTimeout(() => {
|
||||
initializeCalendar(modal);
|
||||
initializeSelectField(modal);
|
||||
initializeTinyMCE(modal);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function initializeCalendar(container) {
|
||||
const calendarInputs = container.querySelectorAll('.calender');
|
||||
if (calendarInputs.length > 0) {
|
||||
//console.log('달력 초기화 시작');
|
||||
$(calendarInputs).datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
yearRange: "-10:+0",
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
//console.log('달력 초기화 완료');
|
||||
}
|
||||
}
|
||||
|
||||
function initializeSelectField(container) {
|
||||
const selectFields = container.querySelectorAll('.select-field');
|
||||
if (selectFields.length > 0 && typeof $.fn.select2 !== 'undefined') {
|
||||
//console.log('선택 필드 초기화 시작');
|
||||
$(selectFields).select2({
|
||||
theme: "classic",
|
||||
width: 'style',
|
||||
dropdownAutoWidth: true,
|
||||
dropdownParent: $('#index_action_form'),
|
||||
containerCssClass: 'text-start', // 왼쪽 정렬을 위한 클래스 추가
|
||||
dropdownCssClass: 'text-start' // 드롭다운 메뉴도 왼쪽 정렬
|
||||
});
|
||||
//console.log('선택 필드 초기화 완료');
|
||||
}
|
||||
}
|
||||
|
||||
function initializeTinyMCE(container) {
|
||||
const textareas = container.querySelectorAll('textarea.tinymce');
|
||||
if (textareas.length > 0 && typeof tinymce !== 'undefined') {
|
||||
//console.log('TinyMCE 초기화 시작');
|
||||
tinymce.init({
|
||||
selector: textareas,
|
||||
plugins: ['code', 'image', 'preview', 'table', 'emoticons', 'autoresize'],
|
||||
height: 600,
|
||||
automatic_uploads: false,
|
||||
images_upload_url: '/tinymce_upload.php',
|
||||
images_upload_handler: function (blobInfo, success, failure) {
|
||||
var xhr, formData;
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.withCredentials = false;
|
||||
xhr.open('POST', '/tinymce_upload.php');
|
||||
xhr.onload = function () {
|
||||
var json;
|
||||
if (xhr.status != 200) {
|
||||
failure('HTTP Error: ' + xhr.status);
|
||||
return;
|
||||
}
|
||||
json = JSON.parse(xhr.responseText);
|
||||
if (!json || typeof json.file_path != 'string') {
|
||||
failure('Invalid JSON: ' + xhr.responseText);
|
||||
return;
|
||||
}
|
||||
success(json.file_path);
|
||||
};
|
||||
formData = new FormData();
|
||||
formData.append('file', blobInfo.blob(), blobInfo.filename());
|
||||
xhr.send(formData);
|
||||
},
|
||||
setup: function(editor) {
|
||||
editor.on('init', function() {
|
||||
//console.log('TinyMCE 에디터 초기화 완료');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// MutationObserver 설정
|
||||
const observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
if (mutation.type === 'childList') {
|
||||
const addedNodes = mutation.addedNodes;
|
||||
for (let i = 0; i < addedNodes.length; i++) {
|
||||
if (addedNodes[i].nodeType === 1 && addedNodes[i].matches('.modal')) {
|
||||
//console.log('새로운 모달이 추가되었습니다.');
|
||||
initializeModalComponents(addedNodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
//class가 calender인 inputbox용,날짜field용
|
||||
if (document.querySelector(".calender")) {
|
||||
$(".calender").datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
yearRange: "-10:+0",
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
});
|
||||
|
||||
// 전체 문서에 대해 MutationObserver 시작
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
|
||||
// 모달 표시 이벤트 리스너
|
||||
document.body.addEventListener('shown.bs.modal', function(event) {
|
||||
//console.log('모달이 표시되었습니다.');
|
||||
initializeModalComponents(event.target);
|
||||
});
|
||||
|
||||
// 페이지 로드 시 전체 문서에 대해 초기화 실행
|
||||
//console.log('페이지 로드 시 초기화 시작');
|
||||
initializeModalComponents(document.body);
|
||||
|
||||
// 전역 스코프에 함수 노출
|
||||
window.initializeForm = function() {
|
||||
//console.log('initializeForm 함수가 호출되었습니다.');
|
||||
initializeModalComponents(document.body);
|
||||
};
|
||||
})();
|
||||
}
|
||||
if (document.querySelector(".tinymce")) {
|
||||
// HTML 문서가 표준 모드로 렌더링되고 있는지 확인
|
||||
if (document.compatMode !== "CSS1Compat") {
|
||||
console.error("문서가 표준 모드가 아닙니다.");
|
||||
return;
|
||||
}
|
||||
tinymce.init({
|
||||
selector: 'textarea',
|
||||
license_key: 'gpl',
|
||||
height: 250,
|
||||
plugins: 'advlist autolink lists link image charmap preview anchor',
|
||||
toolbar: 'undo redo blocks fontfamily fontsize forecolor backcolor | bold italic underline strikethrough | align numlist bullist | link image | table media | code fullscreen preview',
|
||||
menubar: 'file edit view insert format tools table help'
|
||||
});
|
||||
}
|
||||
if (document.querySelector(".select-field")) {
|
||||
//class가 select-field인 SelectBox용
|
||||
$(".select-field").select2({
|
||||
theme: "classic",
|
||||
width: 'style',
|
||||
dropdownAutoWidth: true
|
||||
});
|
||||
}
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user