dbms_init...1
This commit is contained in:
parent
28d084871d
commit
4f7a047fb5
@ -106,38 +106,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'ServiceController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ServiceController::download/$1');
|
||||
});
|
||||
$routes->group('link', ['namespace' => 'App\Controllers\Admin\Customer\Link'], function ($routes) {
|
||||
$routes->group('cpu', ['namespace' => 'App\Controllers\Admin\Customer\Link'], function ($routes) {
|
||||
$routes->get('/', 'CpuController::index', []);
|
||||
$routes->get('create', 'CpuController::create_form');
|
||||
$routes->post('create', 'CpuController::create');
|
||||
$routes->get('modify/(:num)', 'CpuController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'CpuController::modify/$1');
|
||||
$routes->get('view/(:num)', 'CpuController::view/$1');
|
||||
$routes->get('delete/(:num)', 'CpuController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'CpuController::toggle/$1/$2');
|
||||
});
|
||||
$routes->group('ram', ['namespace' => 'App\Controllers\Admin\Customer\Link'], function ($routes) {
|
||||
$routes->get('/', 'RamController::index', []);
|
||||
$routes->get('create', 'RamController::create_form');
|
||||
$routes->post('create', 'RamController::create');
|
||||
$routes->get('modify/(:num)', 'RamController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'RamController::modify/$1');
|
||||
$routes->get('view/(:num)', 'RamController::view/$1');
|
||||
$routes->get('delete/(:num)', 'RamController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'RamController::toggle/$1/$2');
|
||||
});
|
||||
$routes->group('disk', ['namespace' => 'App\Controllers\Admin\Customer\Link'], function ($routes) {
|
||||
$routes->get('/', 'DiskController::index', []);
|
||||
$routes->get('create', 'DiskController::create_form');
|
||||
$routes->post('create', 'DiskController::create');
|
||||
$routes->get('modify/(:num)', 'DiskController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'DiskController::modify/$1');
|
||||
$routes->get('view/(:num)', 'DiskController::view/$1');
|
||||
$routes->get('delete/(:num)', 'DiskController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'DiskController::toggle/$1/$2');
|
||||
});
|
||||
});
|
||||
});
|
||||
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
@ -238,6 +206,68 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
});
|
||||
});
|
||||
$routes->group('link', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
|
||||
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
|
||||
$routes->get('/', 'LineController::index', []);
|
||||
$routes->get('create', 'LineController::create_form');
|
||||
$routes->post('create', 'LineController::create');
|
||||
$routes->get('modify/(:num)', 'LineController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'LineController::modify/$1');
|
||||
$routes->get('view/(:num)', 'LineController::view/$1');
|
||||
$routes->get('delete/(:num)', 'LineController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'LineController::toggle/$1/$2');
|
||||
});
|
||||
$routes->group('ip', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], 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->group('defence', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
|
||||
$routes->get('/', 'DefenceController::index', []);
|
||||
$routes->get('create', 'DefenceController::create_form');
|
||||
$routes->post('create', 'DefenceController::create');
|
||||
$routes->get('modify/(:num)', 'DefenceController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'DefenceController::modify/$1');
|
||||
$routes->get('view/(:num)', 'DefenceController::view/$1');
|
||||
$routes->get('delete/(:num)', 'DefenceController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'DefenceController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'DefenceController::batchjob');
|
||||
$routes->post('batchjob_delete', 'DefenceController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'DefenceController::download/$1');
|
||||
});
|
||||
$routes->group('software', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
|
||||
$routes->get('/', 'SoftwareController::index', []);
|
||||
$routes->get('create', 'SoftwareController::create_form');
|
||||
$routes->post('create', 'SoftwareController::create');
|
||||
$routes->get('modify/(:num)', 'SoftwareController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'SoftwareController::modify/$1');
|
||||
$routes->get('view/(:num)', 'SoftwareController::view/$1');
|
||||
$routes->get('delete/(:num)', 'SoftwareController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'SoftwareController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'SoftwareController::batchjob');
|
||||
$routes->post('batchjob_delete', 'SoftwareController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'SoftwareController::download/$1');
|
||||
});
|
||||
$routes->group('domain', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
|
||||
$routes->get('/', 'DomainController::index', []);
|
||||
$routes->get('create', 'DomainController::create_form');
|
||||
$routes->post('create', 'DomainController::create');
|
||||
$routes->get('modify/(:num)', 'DomainController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'DomainController::modify/$1');
|
||||
$routes->get('view/(:num)', 'DomainController::view/$1');
|
||||
$routes->get('delete/(:num)', 'DomainController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'DomainController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'DomainController::batchjob');
|
||||
$routes->post('batchjob_delete', 'DomainController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'DomainController::download/$1');
|
||||
});
|
||||
$routes->group('cpu', ['namespace' => 'App\Controllers\Admin\Equipment\Link'], function ($routes) {
|
||||
$routes->get('/', 'CpuController::index', []);
|
||||
$routes->get('create', 'CpuController::create_form');
|
||||
|
||||
@ -3,95 +3,15 @@
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Controllers\Admin\AdminController;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\LineService;
|
||||
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class EquipmentController extends AdminController
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
private ?LineService $_lineService = null;
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?ServiceService $_serviceService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService($this->request);
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
final public function getServiceService(): ServiceService
|
||||
{
|
||||
if (!$this->_serviceService) {
|
||||
$this->_serviceService = new ServiceService($this->request);
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
|
||||
final public function getLineService(): LineService
|
||||
{
|
||||
if (!$this->_lineService) {
|
||||
$this->_lineService = new LineService($this->request);
|
||||
}
|
||||
return $this->_lineService;
|
||||
}
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService($this->request);
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
|
||||
protected function getFormFieldOption(string $field, array $options): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
$temps = [];
|
||||
foreach ($this->getClientService()->getEntities() as $entity) {
|
||||
$temps[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options[$field] = $temps;
|
||||
// dd($options);
|
||||
break;
|
||||
case 'serviceinfo_uid':
|
||||
$temps = [];
|
||||
foreach ($this->getServiceService()->getEntities() as $entity) {
|
||||
$temps[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options[$field] = $temps;
|
||||
// dd($options);
|
||||
break;
|
||||
case 'lineinfo_uid':
|
||||
$temps = [];
|
||||
foreach ($this->getLineService()->getEntities() as $entity) {
|
||||
$temps[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options[$field] = $temps;
|
||||
// dd($options);
|
||||
break;
|
||||
case 'serverinfo_uid':
|
||||
$temps = [];
|
||||
foreach ($this->getServerService()->getEntities() as $entity) {
|
||||
$temps[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options[$field] = $temps;
|
||||
// dd($options);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
|
||||
57
app/Controllers/Admin/Equipment/Link/DefenceController.php
Normal file
57
app/Controllers/Admin/Equipment/Link/DefenceController.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Link;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\Link\DefenceHelper;
|
||||
use App\Services\Equipment\Link\DefenceService;
|
||||
use App\Services\Equipment\Part\DefenceService as PartService;
|
||||
|
||||
class DefenceController extends LinkController
|
||||
{
|
||||
protected ?PartService $_partService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): DefenceService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new DefenceService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): DefenceHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new DefenceHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['serverinfo_uid', 'defenceinfo_uid'],
|
||||
];
|
||||
// dd($fields);
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
57
app/Controllers/Admin/Equipment/Link/DomainController.php
Normal file
57
app/Controllers/Admin/Equipment/Link/DomainController.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Link;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\Link\DomainHelper;
|
||||
use App\Services\Equipment\Link\DomainService;
|
||||
use App\Services\Equipment\Part\DomainService as PartService;
|
||||
|
||||
class DomainController extends LinkController
|
||||
{
|
||||
protected ?PartService $_partService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): DomainService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new DomainService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): DomainHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new DomainHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['serverinfo_uid', 'domaininfo_uid'],
|
||||
];
|
||||
// dd($fields);
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
57
app/Controllers/Admin/Equipment/Link/IpController.php
Normal file
57
app/Controllers/Admin/Equipment/Link/IpController.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Link;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\Link\IpHelper;
|
||||
use App\Services\Equipment\Link\IpService;
|
||||
use App\Services\Equipment\Part\IpService as PartService;
|
||||
|
||||
class IpController extends LinkController
|
||||
{
|
||||
protected ?PartService $_partService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): IpService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new IpService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): IpHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new IpHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['serverinfo_uid', 'ipinfo_uid'],
|
||||
];
|
||||
// dd($fields);
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
57
app/Controllers/Admin/Equipment/Link/LineController.php
Normal file
57
app/Controllers/Admin/Equipment/Link/LineController.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Link;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\Link\LineHelper;
|
||||
use App\Services\Equipment\Link\LineService;
|
||||
use App\Services\Equipment\Part\LineService as PartService;
|
||||
|
||||
class LineController extends LinkController
|
||||
{
|
||||
protected ?PartService $_partService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): LineService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new LineService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): LineHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new LineHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['serverinfo_uid', 'lineinfo_uid'],
|
||||
];
|
||||
// dd($fields);
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
@ -9,12 +9,22 @@ use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Equipment\ServerService;
|
||||
|
||||
abstract class LinkController extends EquipmentController
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService($this->request);
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
abstract public function getPartService(): mixed;
|
||||
|
||||
protected function setOrderByForList()
|
||||
@ -41,6 +51,14 @@ abstract class LinkController extends EquipmentController
|
||||
protected function getFormFieldOption(string $field, array $options): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'serverinfo_uid':
|
||||
$temps = [];
|
||||
foreach ($this->getServerService()->getEntities() as $entity) {
|
||||
$temps[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options[$field] = $temps;
|
||||
// dd($options);
|
||||
break;
|
||||
case 'cpuinfo_uid':
|
||||
case 'raminfo_uid':
|
||||
case 'diskinfo_uid':
|
||||
|
||||
57
app/Controllers/Admin/Equipment/Link/SoftwareController.php
Normal file
57
app/Controllers/Admin/Equipment/Link/SoftwareController.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment\Link;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\Link\SoftwareHelper;
|
||||
use App\Services\Equipment\Link\SoftwareService;
|
||||
use App\Services\Equipment\Part\SoftwareService as PartService;
|
||||
|
||||
class SoftwareController extends LinkController
|
||||
{
|
||||
protected ?PartService $_partService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): SoftwareService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new SoftwareService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): SoftwareHelper
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new SoftwareHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['serverinfo_uid', 'softwareinfo_uid'],
|
||||
];
|
||||
// dd($fields);
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\DefenceHelper;
|
||||
use App\Services\Equipment\DefenceService;
|
||||
use App\Helpers\Equipment\Part\DefenceHelper;
|
||||
use App\Services\Equipment\Part\DefenceService;
|
||||
|
||||
class DefenceController extends EquipmentController
|
||||
class DefenceController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\IpHelper;
|
||||
use App\Services\Equipment\IpService;
|
||||
use App\Helpers\Equipment\Part\IpHelper;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
|
||||
class IpController extends EquipmentController
|
||||
class IpController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -1,18 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
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;
|
||||
use App\Entities\Equipment\Part\LineEntity;
|
||||
use App\Helpers\Equipment\Part\LineHelper;
|
||||
use App\Services\Equipment\Part\LineService;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
|
||||
class LineController extends EquipmentController
|
||||
class LineController extends PartController
|
||||
{
|
||||
private ?IpService $_ipService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
namespace App\Controllers\Admin\Equipment\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\SoftwareHelper;
|
||||
use App\Services\Equipment\SoftwareService;
|
||||
use App\Helpers\Equipment\Part\SoftwareHelper;
|
||||
use App\Services\Equipment\Part\SoftwareService;
|
||||
|
||||
class SoftwareController extends EquipmentController
|
||||
class SoftwareController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
@ -2,22 +2,28 @@
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Services\Equipment\Link\CpuService;
|
||||
use App\Services\Equipment\Link\DiskService;
|
||||
|
||||
use App\Services\Equipment\Link\RamService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Equipment\Link\CpuService;
|
||||
use App\Services\Equipment\Link\RamService;
|
||||
use App\Services\Equipment\Link\DiskService;
|
||||
use App\Services\Equipment\Link\LINEService;
|
||||
use App\Services\Equipment\Link\IpService;
|
||||
use App\Services\Equipment\Link\DefenceService;
|
||||
use App\Services\Equipment\Link\SoftwareService;
|
||||
use App\Services\Equipment\Link\DomainService;
|
||||
|
||||
|
||||
class ServerController extends EquipmentController
|
||||
{
|
||||
private ?CpuService $_cpuService = null;
|
||||
private ?RamService $_ramService = null;
|
||||
private ?DiskService $_diskService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
private $_adapterService = [];
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -41,26 +47,69 @@ class ServerController extends EquipmentController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
final public function getCpuService(): CpuService
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_cpuService) {
|
||||
$this->_cpuService = new CpuService($this->request);
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService($this->request);
|
||||
}
|
||||
return $this->_cpuService;
|
||||
return $this->_clientService;
|
||||
}
|
||||
final public function getRamService(): RamService
|
||||
final public function getAdapterService(string $key): mixed
|
||||
{
|
||||
if (!$this->_ramService) {
|
||||
$this->_ramService = new RamService($this->request);
|
||||
if (!array_key_exists($key, $this->_adapterService)) {
|
||||
switch ($key) {
|
||||
case 'CPU':
|
||||
$this->_adapterService[$key] = new CpuService();
|
||||
break;
|
||||
case 'RAM':
|
||||
$this->_adapterService[$key] = new RamService();
|
||||
break;
|
||||
case 'DISK':
|
||||
$this->_adapterService[$key] = new DiskService();
|
||||
break;
|
||||
case 'LINE':
|
||||
$this->_adapterService[$key] = new LineService();
|
||||
break;
|
||||
case 'IP':
|
||||
$this->_adapterService[$key] = new IpService();
|
||||
break;
|
||||
case 'DEFENCE':
|
||||
$this->_adapterService[$key] = new DefenceService();
|
||||
break;
|
||||
case 'SOFTWARE':
|
||||
$this->_adapterService[$key] = new SoftwareService();
|
||||
break;
|
||||
case 'DOMAIN':
|
||||
$this->_adapterService[$key] = new DomainService();
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("Unknown adapter service key: {$key}");
|
||||
}
|
||||
}
|
||||
return $this->_ramService;
|
||||
return $this->_adapterService[$key];
|
||||
}
|
||||
final public function getDiskService(): DiskService
|
||||
protected function getFormFieldOption(string $field, array $options): array
|
||||
{
|
||||
if (!$this->_diskService) {
|
||||
$this->_diskService = new DiskService($this->request);
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
$temps = [];
|
||||
foreach ($this->getClientService()->getEntities() as $entity) {
|
||||
$temps[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options[$field] = $temps;
|
||||
break;
|
||||
case 'lineinfo_uid':
|
||||
$temps = [];
|
||||
foreach ($this->getLineService()->getEntities() as $entity) {
|
||||
$temps[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
$options[$field] = $temps;
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $this->_diskService;
|
||||
return $options;
|
||||
}
|
||||
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
||||
{
|
||||
@ -83,11 +132,12 @@ class ServerController extends EquipmentController
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
// $this->modal_type = 'modal_fetch_v2'; //기본은 modal_iframe임
|
||||
$this->adapterFields = ['LINE', 'IP', 'CPU', 'RAM', 'DISK', 'DEFENCE', 'SOFTWARE', 'DOMAIN'];
|
||||
$entities = [];
|
||||
foreach (parent::index_process() as $entity) {
|
||||
$entity->setPartEntities("CPU", $this->getCpuService()->getAdapterEntities($entity));
|
||||
$entity->setPartEntities("RAM", $this->getRamService()->getAdapterEntities($entity));
|
||||
$entity->setPartEntities("DISK", $this->getDiskService()->getAdapterEntities($entity));
|
||||
foreach ($this->adapterFields as $field) {
|
||||
$entity->setPartEntities($field, $this->getAdapterService($field)->getAdapterEntities($entity));
|
||||
}
|
||||
$entities[] = $entity;
|
||||
}
|
||||
return $entities;
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
"settings": {
|
||||
"width": 4000,
|
||||
"height": 4000,
|
||||
"scrollTop": -2838.7381,
|
||||
"scrollLeft": -1765.3486,
|
||||
"zoomLevel": 0.82,
|
||||
"scrollTop": -2807.42,
|
||||
"scrollLeft": -1213.1454,
|
||||
"zoomLevel": 0.79,
|
||||
"show": 511,
|
||||
"database": 4,
|
||||
"databaseName": "",
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\DefenceModel;
|
||||
|
||||
class DefenceEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = DefenceModel::PK;
|
||||
const TITLE = DefenceModel::TITLE;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\DomainModel;
|
||||
|
||||
class DomainEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = DomainModel::PK;
|
||||
const TITLE = DomainModel::TITLE;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\IpModel;
|
||||
|
||||
class IpEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = IpModel::PK;
|
||||
const TITLE = IpModel::TITLE;
|
||||
}
|
||||
11
app/Entities/Equipment/Part/DefenceEntity.php
Normal file
11
app/Entities/Equipment/Part/DefenceEntity.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\Part\DefenceModel;
|
||||
|
||||
class DefenceEntity extends PartEntity
|
||||
{
|
||||
const PK = DefenceModel::PK;
|
||||
const TITLE = DefenceModel::TITLE;
|
||||
}
|
||||
11
app/Entities/Equipment/Part/DomainEntity.php
Normal file
11
app/Entities/Equipment/Part/DomainEntity.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\Part\DomainModel;
|
||||
|
||||
class DomainEntity extends PartEntity
|
||||
{
|
||||
const PK = DomainModel::PK;
|
||||
const TITLE = DomainModel::TITLE;
|
||||
}
|
||||
11
app/Entities/Equipment/Part/IpEntity.php
Normal file
11
app/Entities/Equipment/Part/IpEntity.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\Part\IpModel;
|
||||
|
||||
class IpEntity extends PartEntity
|
||||
{
|
||||
const PK = IpModel::PK;
|
||||
const TITLE = IpModel::TITLE;
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
namespace App\Entities\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\LineModel;
|
||||
use App\Models\Equipment\Part\LineModel;
|
||||
|
||||
class LineEntity extends EquipmentEntity
|
||||
class LineEntity extends PartEntity
|
||||
{
|
||||
const PK = LineModel::PK;
|
||||
const TITLE = LineModel::TITLE;
|
||||
11
app/Entities/Equipment/Part/SoftwareEntity.php
Normal file
11
app/Entities/Equipment/Part/SoftwareEntity.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\Part\SoftwareModel;
|
||||
|
||||
class SoftwareEntity extends PartEntity
|
||||
{
|
||||
const PK = SoftwareModel::PK;
|
||||
const TITLE = SoftwareModel::TITLE;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\SoftwareModel;
|
||||
|
||||
class SoftwareEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = SoftwareModel::PK;
|
||||
const TITLE = SoftwareModel::TITLE;
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
namespace App\Helpers\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\DefenceModel;
|
||||
use App\Models\Equipment\Part\DefenceModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class DefenceHelper extends EquipmentHelper
|
||||
class DefenceHelper extends PartHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
16
app/Helpers/Equipment/Part/DomainHelper.php
Normal file
16
app/Helpers/Equipment/Part/DomainHelper.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\Part\DomainModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class DomainHelper extends PartHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: DomainModel::TITLE);
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
namespace App\Helpers\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\IpModel;
|
||||
use App\Models\Equipment\Part\IpModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class IpHelper extends EquipmentHelper
|
||||
class IpHelper extends PartHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
namespace App\Helpers\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\LineModel;
|
||||
use App\Models\Equipment\Part\LineModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class LineHelper extends EquipmentHelper
|
||||
class LineHelper extends PartHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
namespace App\Helpers\Equipment\Part;
|
||||
|
||||
use App\Models\Equipment\SoftwareModel;
|
||||
use App\Models\Equipment\Part\SoftwareModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class SoftwareHelper extends EquipmentHelper
|
||||
class SoftwareHelper extends PartHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -13,6 +13,25 @@ class ServerHelper extends EquipmentHelper
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: ServerModel::TITLE);
|
||||
}
|
||||
public function getFieldLabel(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case "LINE":
|
||||
case "IP":
|
||||
case "CPU":
|
||||
case "RAM":
|
||||
case "DISK":
|
||||
case "DEFENCE":
|
||||
case "SOFTWARE":
|
||||
case "DOMAIN":
|
||||
$label = form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
|
||||
break;
|
||||
default:
|
||||
$label = parent::getFieldLabel($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
// public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
// {
|
||||
// if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||
@ -40,9 +59,14 @@ class ServerHelper extends EquipmentHelper
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?? "";
|
||||
switch ($field) {
|
||||
case "LINE":
|
||||
case "IP":
|
||||
case "CPU":
|
||||
case "RAM":
|
||||
case "DISK":
|
||||
case "DEFENCE":
|
||||
case "SOFTWARE":
|
||||
case "DOMAIN":
|
||||
$temps = [];
|
||||
foreach ($viewDatas['entity']->getPartEntities($field) as $partEntity) {
|
||||
$temps[] = "<div>" . $partEntity->getTitle() . "</div>";
|
||||
|
||||
17
app/Language/en/Equipment/Part/Domain.php
Normal file
17
app/Language/en/Equipment/Part/Domain.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "Domain정보",
|
||||
'label' => [
|
||||
'domain' => "도메인",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
"STATUS" => [
|
||||
'default' => "사용가능",
|
||||
"pause" => "일시정지",
|
||||
"occupied" => "사용중",
|
||||
],
|
||||
];
|
||||
@ -11,9 +11,14 @@ return [
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
'LINE' => "회선",
|
||||
'IP' => "IP",
|
||||
'CPU' => "CPU",
|
||||
'RAM' => "RAM",
|
||||
'DISK' => "DISK",
|
||||
'DEFENCE' => "방어",
|
||||
'SOFTWARE' => "소프트웨어",
|
||||
'DOMAIN' => "도메인",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'RacKMount',
|
||||
|
||||
@ -12,8 +12,32 @@ class CpuModel extends PartModel
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = CpuEntity::class;
|
||||
protected $allowedFields = [
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
final 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 "model":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
namespace App\Models\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\DefenceEntity;
|
||||
use App\Entities\Equipment\Part\DefenceEntity;
|
||||
|
||||
class DefenceModel extends EquipmentModel
|
||||
class DefenceModel extends PartModel
|
||||
{
|
||||
const TABLE = "defenceinfo";
|
||||
const PK = "uid";
|
||||
@ -12,8 +12,32 @@ class DiskModel extends PartModel
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = DiskEntity::class;
|
||||
protected $allowedFields = [
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
final 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 "model":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
namespace App\Models\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\DomainEntity;
|
||||
use App\Entities\Equipment\Part\DomainEntity;
|
||||
|
||||
class DomainModel extends EquipmentModel
|
||||
class DomainModel extends PartModel
|
||||
{
|
||||
const TABLE = "lineinfo";
|
||||
const PK = "uid";
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
namespace App\Models\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\IpEntity;
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
|
||||
class IpModel extends EquipmentModel
|
||||
class IpModel extends PartModel
|
||||
{
|
||||
const TABLE = "ipinfo";
|
||||
const PK = "uid";
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
namespace App\Models\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\LineEntity;
|
||||
use App\Entities\Equipment\Part\LineEntity;
|
||||
|
||||
class LineModel extends EquipmentModel
|
||||
class LineModel extends PartModel
|
||||
{
|
||||
const TABLE = "lineinfo";
|
||||
const PK = "uid";
|
||||
@ -6,32 +6,8 @@ use App\Models\Equipment\EquipmentModel;
|
||||
|
||||
abstract class PartModel extends EquipmentModel
|
||||
{
|
||||
protected $allowedFields = [
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
final 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 "model":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,8 +13,32 @@ class RamModel extends PartModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = RamEntity::class;
|
||||
|
||||
protected $allowedFields = [
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
final 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 "model":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
namespace App\Models\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\SoftwareEntity;
|
||||
use App\Entities\Equipment\Part\SoftwareEntity;
|
||||
|
||||
class SoftwareModel extends EquipmentModel
|
||||
class SoftwareModel extends PartModel
|
||||
{
|
||||
const TABLE = "softwareinfo";
|
||||
const PK = "uid";
|
||||
@ -6,7 +6,7 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
use App\Entities\Equipment\Link\DefenceEntity;
|
||||
use App\Models\Equipment\Link\DefenceModel;
|
||||
use App\Services\Equipment\DefenceService as AdapterService;
|
||||
use App\Services\Equipment\Part\DefenceService as AdapterService;
|
||||
|
||||
class DefenceService extends LinkService
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
use App\Entities\Equipment\Link\DomainEntity;
|
||||
use App\Models\Equipment\Link\DomainModel;
|
||||
use App\Services\Equipment\DomainService as AdapterService;
|
||||
use App\Services\Equipment\Part\DomainService as AdapterService;
|
||||
|
||||
class DomainService extends LinkService
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
use App\Entities\Equipment\Link\IpEntity;
|
||||
use App\Models\Equipment\Link\IpModel;
|
||||
use App\Services\Equipment\IpService as AdapterService;
|
||||
use App\Services\Equipment\Part\IpService as AdapterService;
|
||||
|
||||
class IpService extends LinkService
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
use App\Entities\Equipment\Link\LineEntity;
|
||||
use App\Models\Equipment\Link\LineModel;
|
||||
use App\Services\Equipment\LineService as AdapterService;
|
||||
use App\Services\Equipment\Part\LineService as AdapterService;
|
||||
|
||||
class LineService extends LinkService
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
use App\Entities\Equipment\Link\SoftwareEntity;
|
||||
use App\Models\Equipment\Link\SoftwareModel;
|
||||
use App\Services\Equipment\SoftwareService as AdapterService;
|
||||
use App\Services\Equipment\Part\SoftwareService as AdapterService;
|
||||
|
||||
class SoftwareService extends LinkService
|
||||
{
|
||||
|
||||
@ -17,7 +17,7 @@ class CpuService extends PartService
|
||||
}
|
||||
public function getModelClass(): CpuModel
|
||||
{
|
||||
return new CpuModel;
|
||||
return new CpuModel();
|
||||
}
|
||||
public function getEntityClass(): CpuEntity
|
||||
{
|
||||
@ -27,4 +27,20 @@ class CpuService extends PartService
|
||||
{
|
||||
return new LinkService($this->request);
|
||||
}
|
||||
final public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
final public function getFilterFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
final public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
namespace App\Services\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\DefenceEntity;
|
||||
use App\Models\Equipment\DefenceModel;
|
||||
use App\Entities\Equipment\Part\DefenceEntity;
|
||||
use App\Models\Equipment\Part\DefenceModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Services\Equipment\EquipmentService;
|
||||
|
||||
class DefenceService extends EquipmentService
|
||||
class DefenceService extends PartService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -17,7 +17,7 @@ class DiskService extends PartService
|
||||
}
|
||||
public function getModelClass(): DiskModel
|
||||
{
|
||||
return new DiskModel;
|
||||
return new DiskModel();
|
||||
}
|
||||
public function getEntityClass(): DiskEntity
|
||||
{
|
||||
@ -27,4 +27,20 @@ class DiskService extends PartService
|
||||
{
|
||||
return new LinkService($this->request);
|
||||
}
|
||||
final public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
final public function getFilterFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
final public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
namespace App\Services\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\DomainEntity;
|
||||
use App\Models\Equipment\DomainModel;
|
||||
use App\Entities\Equipment\Part\DomainEntity;
|
||||
use App\Models\Equipment\Part\DomainModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class DomainService extends EquipmentService
|
||||
class DomainService extends PartService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
namespace App\Services\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\IpEntity;
|
||||
use App\Models\Equipment\IpModel;
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
use App\Models\Equipment\Part\IpModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class IpService extends EquipmentService
|
||||
class IpService extends PartService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
namespace App\Services\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\LineEntity;
|
||||
use App\Models\Equipment\LineModel;
|
||||
use App\Entities\Equipment\Part\LineEntity;
|
||||
use App\Models\Equipment\Part\LineModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class LineService extends EquipmentService
|
||||
class LineService extends PartService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -12,20 +12,4 @@ abstract class PartService extends EquipmentService
|
||||
parent::__construct($request);
|
||||
$this->addClassName('Part');
|
||||
}
|
||||
final public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
final public function getFilterFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
final public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,4 +27,20 @@ class RamService extends PartService
|
||||
{
|
||||
return new LinkService($this->request);
|
||||
}
|
||||
final public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
final public function getFilterFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
final public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
namespace App\Services\Equipment\Part;
|
||||
|
||||
use App\Entities\Equipment\SoftwareEntity;
|
||||
use App\Models\Equipment\SoftwareModel;
|
||||
use App\Entities\Equipment\Part\SoftwareEntity;
|
||||
use App\Models\Equipment\Part\SoftwareModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class SoftwareService extends EquipmentService
|
||||
class SoftwareService extends PartService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
@ -44,14 +44,14 @@
|
||||
<td colspan="8">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<tr>
|
||||
<td><?= $viewDatas['helper']->getFieldView('LINE', $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('IP', $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('CPU', $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('RAM', $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('DISK', $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('DEFENCE', $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('SOFTWARE', $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('DOMAIN', $viewDatas) ?></td>
|
||||
<?php foreach ($viewDatas['adapterFields'] as $field): ?>
|
||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php foreach ($viewDatas['adapterFields'] as $field): ?>
|
||||
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user