dbms_init...1
This commit is contained in:
parent
209661fd8d
commit
62883a4321
@ -161,6 +161,19 @@ $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('defence', ['namespace' => 'App\Controllers\Admin\Equipment'], 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'], function ($routes) {
|
||||
$routes->get('/', 'SoftwareController::index', []);
|
||||
$routes->get('create', 'SoftwareController::create_form');
|
||||
@ -174,5 +187,18 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'SoftwareController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'SoftwareController::download/$1');
|
||||
});
|
||||
$routes->group('serverpart', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'ServerPartController::index', []);
|
||||
$routes->get('create', 'ServerPartController::create_form');
|
||||
$routes->post('create', 'ServerPartController::create');
|
||||
$routes->get('modify/(:num)', 'ServerPartController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'ServerPartController::modify/$1');
|
||||
$routes->get('view/(:num)', 'ServerPartController::view/$1');
|
||||
$routes->get('delete/(:num)', 'ServerPartController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'ServerPartController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ServerPartController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ServerPartController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ServerPartController::download/$1');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -57,7 +57,7 @@ class ClientController extends CustomerController
|
||||
protected function view_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()->getTitleField(), 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
|
||||
'fields' => ['name', 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
|
||||
];
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
@ -65,7 +65,7 @@ class ClientController extends CustomerController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => [$this->getService()->getModel()->getTitleField(), 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
|
||||
'fields' => ['name', 'email', 'phone', 'role', 'account_balance', 'coupon_balance', 'point_balance', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
|
||||
@ -2,18 +2,19 @@
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ServicePartEntity;
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\PartService;
|
||||
use App\Services\Equipment\IpService;
|
||||
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Entities\Customer\ServicePartEntity;
|
||||
use App\Services\Customer\ServicePartService;
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\PartService;
|
||||
use App\Services\Equipment\IpService;
|
||||
|
||||
class ServiceController extends CustomerController
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
@ -23,13 +24,11 @@ class ServiceController extends CustomerController
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
$this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
// echo $this->view_path;
|
||||
// exit;
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
$this->individualStylesheets = ['server_partinfo.css'];;
|
||||
$this->individualStylesheets = ['server_partinfo.css'];
|
||||
$this->individualScripts = ['server_partinfo.js'];
|
||||
}
|
||||
public function getService(): ServiceService
|
||||
@ -67,106 +66,28 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
return $this->_ipService;
|
||||
}
|
||||
|
||||
//Index,FieldForm관련
|
||||
protected 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 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
$rule = "if_exist|permit_empty|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'SERVER':
|
||||
$options[$field] = $this->getServerService()->getFormFieldOption($field);
|
||||
break;
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
$options[$field] = $this->getPartService()->getFormFieldOption($field);
|
||||
break;
|
||||
case 'IP':
|
||||
$options[$field] = $this->getIPService()->getFormFieldOption($field);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'SERVER':
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
case 'IP':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setValidation($validation, $action, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function create_process(): mixed
|
||||
private function setPartEntity(ServiceEntity $entity): ServiceEntity
|
||||
{
|
||||
$entity = parent::create_process();
|
||||
//변경할 UIDS
|
||||
$cpu_uids = $this->request->getVar('CPU[]');
|
||||
if (!is_array($cpu_uids)) {
|
||||
throw new \Exception("CPU가 정의되지 않았습니다.");
|
||||
foreach ($this->getServicePartService()->getEntities(['serviceinfo_uid' => $entity->getPK()]) as $servicePartEntity) {
|
||||
$partEntity = $this->getPartService()->getEntity($servicePartEntity->getPartInfo());
|
||||
if ($partEntity) {
|
||||
$entity->addPartEntity($partEntity->getType(), $partEntity);
|
||||
}
|
||||
foreach ($cpu_uids as $uid) {
|
||||
$temps = ['serviceinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getService()->create($temps, new ServicePartEntity());
|
||||
}
|
||||
$ram_uids = $this->request->getVar('RAM[]');
|
||||
if (!is_array($ram_uids)) {
|
||||
throw new \Exception("RAM가 정의되지 않았습니다.");
|
||||
}
|
||||
foreach ($ram_uids as $uid) {
|
||||
$temps = ['serviceinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getService()->create($temps, new ServicePartEntity());
|
||||
}
|
||||
$disk_uids = $this->request->getVar('DISK[]');
|
||||
if (!is_array($disk_uids)) {
|
||||
throw new \Exception("DISK가 정의되지 않았습니다.");
|
||||
}
|
||||
foreach ($disk_uids as $uid) {
|
||||
$temps = ['serviceinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getService()->create($temps, new ServicePartEntity());
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'billing_at', 'start_at', 'end_at', 'status'],
|
||||
'fields' => ['type', 'model', 'IP', 'SERVER', 'CPU', 'RAM', 'DISK', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
$entities = parent::index_process();
|
||||
foreach ($entities as $key => $entity) {
|
||||
$entity->CPU = $this->getServerService()->getEntities(['serverinfo_uid' => $entity->getPK()]);
|
||||
$entity->RAM = $this->getServerService()->getEntities(['serverinfo_uid' => $entity->getPK()]);
|
||||
$entity->DISK = $this->getServerService()->getEntities(['serverinfo_uid' => $entity->getPK()]);
|
||||
$entities = [];
|
||||
foreach (parent::index_process() as $entity) {
|
||||
$entities[] = $this->setPartEntity($entity);
|
||||
}
|
||||
return $entities;
|
||||
}
|
||||
|
||||
93
app/Controllers/Admin/Customer/ServicePartController.php
Normal file
93
app/Controllers/Admin/Customer/ServicePartController.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Helpers\Customer\ServicePartHelper;
|
||||
use App\Services\Customer\ServicePartService;
|
||||
use App\Services\Equipment\PartService;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServicePartController extends CustomerController
|
||||
{
|
||||
private ?PartService $_partService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
}
|
||||
public function getService(): ServicePartService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServicePartService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): mixed
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new ServicePartHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
final public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'serverinfo_uid':
|
||||
$options[$field] = $this->getServiceService()->getFormFieldOption($field);
|
||||
break;
|
||||
case 'partinfo_uid':
|
||||
$options[$field] = $this->getPartService()->getFormFieldOption($field);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'index':
|
||||
case 'view':
|
||||
$this->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$result = view($this->view_path . "popup" . DIRECTORY_SEPARATOR . $action, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultPageByActon($action, $message);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
|
||||
protected function setOrderByForList()
|
||||
{
|
||||
//OrderBy 처리
|
||||
$this->getService()->getModel()->orderBy('serverinfo_uid', 'ASC', false);
|
||||
parent::setOrderByForList();
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['serverinfo_uid', 'type', 'partinfo_uid'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
55
app/Controllers/Admin/Equipment/DefenceController.php
Normal file
55
app/Controllers/Admin/Equipment/DefenceController.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\DefenceHelper;
|
||||
use App\Services\Equipment\DefenceService;
|
||||
|
||||
class DefenceController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
}
|
||||
public function getService(): DefenceService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new DefenceService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): mixed
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new DefenceHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function setOrderByForList()
|
||||
{
|
||||
//OrderBy 처리
|
||||
$this->getService()->getModel()->orderBy('INET_ATON(ip)', 'ASC', false);
|
||||
parent::setOrderByForList();
|
||||
}
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['type', 'ip', 'accountid', 'domain', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
@ -17,8 +17,8 @@ abstract class EquipmentController extends AdminController
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= 'device/';
|
||||
// $this->view_path .= "device" . DIRECTORY_SEPARATOR;
|
||||
$this->uri_path .= 'equipment/';
|
||||
// $this->view_path .= "equipment" . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
|
||||
@ -45,7 +45,7 @@ class IpController extends EquipmentController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['lineinfo_uid', $this->getService()->getModel()->getTitleField(), 'status', 'updated_at'],
|
||||
'fields' => ['lineinfo_uid', 'ip', 'status', 'updated_at'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
|
||||
@ -68,7 +68,7 @@ class LineController extends EquipmentController
|
||||
protected function view_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'bandwith', 'status', "start_at", 'created_at'],
|
||||
'fields' => ['clientinfo_uid', 'type', 'title', 'bandwith', 'status', "start_at", 'created_at'],
|
||||
];
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
@ -77,9 +77,10 @@ class LineController extends EquipmentController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'bandwith', 'status', "start_at", 'created_at'],
|
||||
'fields' => ['clientinfo_uid', 'type', 'title', 'bandwith', 'status', "start_at", 'created_at'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,13 +2,12 @@
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\PartHelper;
|
||||
use App\Services\Equipment\PartService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class PartController extends EquipmentController
|
||||
{
|
||||
@ -35,10 +34,17 @@ class PartController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function setOrderByForList()
|
||||
{
|
||||
//OrderBy 처리
|
||||
$this->getService()->getModel()->orderBy('type', 'ASC', false);
|
||||
parent::setOrderByForList();
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['type', $this->getService()->getModel()->getTitleField(), 'manufactur_at', 'status'],
|
||||
'fields' => ['type', 'model', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
|
||||
@ -2,24 +2,32 @@
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Equipment\PartService;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
|
||||
class ServerController extends EquipmentController
|
||||
{
|
||||
private ?PartService $_partService = null;
|
||||
private ?ServerPartService $_serverPartService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
$this->individualStylesheets = ['server_partinfo.css'];
|
||||
$this->individualScripts = ['server_partinfo.js'];
|
||||
}
|
||||
public function getService(): ServerService
|
||||
{
|
||||
@ -35,15 +43,42 @@ class ServerController extends EquipmentController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
final public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
final public function getServerPartService(): ServerPartService
|
||||
{
|
||||
if (!$this->_serverPartService) {
|
||||
$this->_serverPartService = new ServerPartService($this->request);
|
||||
}
|
||||
return $this->_serverPartService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
private function setPartEntity(ServerEntity $entity): ServerEntity
|
||||
{
|
||||
foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $serverPartEntity) {
|
||||
$partEntity = $this->getPartService()->getEntity($serverPartEntity->getPartInfo());
|
||||
if ($partEntity) {
|
||||
$entity->addPartEntity($partEntity->getType(), $partEntity);
|
||||
}
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['code', 'type', $this->getService()->getModel()->getTitleField(), 'manufactur_at', 'status'],
|
||||
'fields' => ['code', 'type', 'model', 'CPU', 'RAM', 'DISK', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
$entities = [];
|
||||
foreach (parent::index_process() as $entity) {
|
||||
$entities[] = $this->setPartEntity($entity);
|
||||
}
|
||||
return $entities;
|
||||
}
|
||||
}
|
||||
|
||||
93
app/Controllers/Admin/Equipment/ServerPartController.php
Normal file
93
app/Controllers/Admin/Equipment/ServerPartController.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Helpers\Equipment\ServerPartHelper;
|
||||
use App\Services\Equipment\PartService;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServerPartController extends EquipmentController
|
||||
{
|
||||
private ?PartService $_partService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
}
|
||||
public function getService(): ServerPartService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServerPartService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): mixed
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new ServerPartHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
final public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'serverinfo_uid':
|
||||
$options[$field] = $this->getServerService()->getFormFieldOption($field);
|
||||
break;
|
||||
case 'partinfo_uid':
|
||||
$options[$field] = $this->getPartService()->getFormFieldOption($field);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'index':
|
||||
case 'view':
|
||||
$this->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$result = view($this->view_path . "popup" . DIRECTORY_SEPARATOR . $action, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultPageByActon($action, $message);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
|
||||
protected function setOrderByForList()
|
||||
{
|
||||
//OrderBy 처리
|
||||
$this->getService()->getModel()->orderBy('serverinfo_uid', 'ASC', false);
|
||||
parent::setOrderByForList();
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['serverinfo_uid', 'type', 'partinfo_uid'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,7 @@ namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\SoftwareHelper;
|
||||
@ -38,7 +38,7 @@ class SoftwareController extends EquipmentController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['type', $this->getService()->getModel()->getTitleField(), 'status', 'description'],
|
||||
'fields' => ['type', 'model', 'status', 'description'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
|
||||
@ -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()->getTitleField(), 'status', 'created_at', 'content'],
|
||||
'fields' => ['user_uid', 'class_name', 'method_name', 'title', '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()->getTitleField(), 'status', 'created_at'],
|
||||
'fields' => ['user_uid', 'class_name', 'method_name', 'title', 'status', 'created_at'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
|
||||
@ -73,7 +73,7 @@ class UserController extends AdminController
|
||||
protected function view_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', $this->getService()->getModel()->getTitleField(), 'email', 'mobile', 'role', 'status'],
|
||||
'fields' => ['id', 'name', 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
@ -81,7 +81,7 @@ class UserController extends AdminController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['id', $this->getService()->getModel()->getTitleField(), 'email', 'mobile', 'role', 'status'],
|
||||
'fields' => ['id', 'name', 'email', 'mobile', 'role', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
|
||||
@ -144,7 +144,7 @@ abstract class CommonController extends BaseController
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$validation->setRule($field, $field, $rule ?? $this->getService()->getFieldRule($action, $field));
|
||||
$validation->setRule($field, $field, $rule ?? $this->getFieldRule($action, $field));
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ abstract class CommonEntity extends Entity
|
||||
$field = constant("static::PK");
|
||||
return $this->attributes[$field];
|
||||
}
|
||||
final public function getTitle(): string
|
||||
public function getTitle(): string
|
||||
{
|
||||
$field = constant("static::TITLE");
|
||||
return $this->attributes[$field];
|
||||
|
||||
@ -8,4 +8,14 @@ class ServicePartEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServicePartModel::PK;
|
||||
const TITLE = ServicePartModel::TITLE;
|
||||
|
||||
public function getServiceInfo()
|
||||
{
|
||||
return $this->attributes['erviceinfo_uid'];
|
||||
}
|
||||
|
||||
public function getPartInfo()
|
||||
{
|
||||
return $this->attributes['partinfo_uid'];
|
||||
}
|
||||
}
|
||||
|
||||
11
app/Entities/Equipment/DefenceEntity.php
Normal file
11
app/Entities/Equipment/DefenceEntity.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\DefenceModel;
|
||||
|
||||
class DefenceEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = DefenceModel::PK;
|
||||
const TITLE = DefenceModel::TITLE;
|
||||
}
|
||||
@ -8,4 +8,9 @@ class PartEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = PartModel::PK;
|
||||
const TITLE = PartModel::TITLE;
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->attributes['type'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,4 +8,21 @@ class ServerEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = ServerModel::PK;
|
||||
const TITLE = ServerModel::TITLE;
|
||||
public function getTitle(): string
|
||||
{
|
||||
return parent::getTitle() . " [{$this->attributes['model']}]";
|
||||
}
|
||||
public function getPartEntities(string $type): array
|
||||
{
|
||||
return $this->attributes[$type] ?? [];
|
||||
}
|
||||
|
||||
public function addPartEntity(string $type, PartEntity $partEntity): void
|
||||
{
|
||||
if (!isset($this->attributes[$type])) {
|
||||
$this->attributes[$type] = [];
|
||||
}
|
||||
$this->attributes[$type][] = $partEntity;
|
||||
// $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR);
|
||||
}
|
||||
}
|
||||
|
||||
21
app/Entities/Equipment/ServerPartEntity.php
Normal file
21
app/Entities/Equipment/ServerPartEntity.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\ServerPartModel;
|
||||
|
||||
class ServerPartEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = ServerPartModel::PK;
|
||||
const TITLE = ServerPartModel::TITLE;
|
||||
|
||||
public function getServerInfo()
|
||||
{
|
||||
return $this->attributes['serverinfo_uid'];
|
||||
}
|
||||
|
||||
public function getPartInfo()
|
||||
{
|
||||
return $this->attributes['partinfo_uid'];
|
||||
}
|
||||
}
|
||||
@ -38,11 +38,12 @@ class ServiceHelper extends CustomerHelper
|
||||
$form .= "</div></div>";
|
||||
$form .= "<div id=\"{$field}_list\" class=\"server_partinfo_items\" style=\"border:1px solid silver\"></div>";
|
||||
} else {
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$formOptions[$key] = $label;
|
||||
}
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
16
app/Helpers/Equipment/DefenceHelper.php
Normal file
16
app/Helpers/Equipment/DefenceHelper.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Equipment\DefenceModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class DefenceHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: DefenceModel::TITLE);
|
||||
}
|
||||
}
|
||||
@ -11,43 +11,4 @@ class EquipmentHelper extends CommonHelper
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
switch ($field) {
|
||||
case "serverinfo_uid":
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
$formOptions = array_merge(
|
||||
["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'],
|
||||
$viewDatas['field_options'][$field]
|
||||
);
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?? "";
|
||||
switch ($field) {
|
||||
case 'manufactur_at':
|
||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,4 +13,35 @@ class ServerHelper extends EquipmentHelper
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: ServerModel::TITLE);
|
||||
}
|
||||
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?? "";
|
||||
switch ($field) {
|
||||
case "CPU":
|
||||
case "RAM":
|
||||
case "DISK":
|
||||
$temps = [];
|
||||
foreach ($viewDatas['entity']->getPartEntities($field) as $partEntity) {
|
||||
$temps[] = "<div>" . $partEntity->getTitle() . "</div>";
|
||||
}
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$temps[] = form_label(
|
||||
'변경',
|
||||
$field,
|
||||
[
|
||||
"data-src" => "/admin/equipment/serverpart?type={$field}&serverinfo_uid={$viewDatas['entity']->getPK()}",
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
$value = implode("", $temps);
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
22
app/Helpers/Equipment/ServerPartHelper.php
Normal file
22
app/Helpers/Equipment/ServerPartHelper.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Equipment\ServerPartModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class ServerPartHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: ServerPartModel::TITLE);
|
||||
}
|
||||
|
||||
public function getListRowColor(mixed $entity, string $field = 'status', string $value = 'use'): string
|
||||
{
|
||||
return "";
|
||||
// return $entity->isMatched($field, $value) ? "" : 'class="table-danger"';
|
||||
}
|
||||
}
|
||||
28
app/Language/en/Equipment/Defence.php
Normal file
28
app/Language/en/Equipment/Defence.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "방어장비정보",
|
||||
'label' => [
|
||||
'type' => "종류",
|
||||
'ip' => "IP",
|
||||
'accountid' => "계정ID",
|
||||
'domain' => "도메인",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'VPC-CS',
|
||||
'status' => "use"
|
||||
],
|
||||
"TYPE" => [
|
||||
"VPC-CS" => "VPC-CS",
|
||||
"KT-CS" => "KT-CS",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용가능",
|
||||
"pause" => "일시정지",
|
||||
"occupied" => "사용중",
|
||||
],
|
||||
];
|
||||
@ -4,6 +4,7 @@ return [
|
||||
'label' => [
|
||||
'lineinfo_uid' => '회선정보',
|
||||
'ip' => "IP",
|
||||
'price' => "금액",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
|
||||
@ -6,6 +6,7 @@ return [
|
||||
'title' => "제목",
|
||||
'type' => "종류",
|
||||
'bandwith' => "CIDR대역",
|
||||
'price' => "금액",
|
||||
'status' => "상태",
|
||||
'start_at' => "개통일",
|
||||
'updated_at' => "수정일",
|
||||
|
||||
@ -4,9 +4,9 @@ return [
|
||||
'label' => [
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'manufactur_at' => "입고일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
|
||||
@ -5,15 +5,18 @@ return [
|
||||
'code' => "장비코드",
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'manufactur_at' => "입고일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
'CPU' => "CPU",
|
||||
'RAM' => "RAM",
|
||||
'DISK' => "DISK",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'RacKMount',
|
||||
'status' => "use"
|
||||
'status' => "use",
|
||||
],
|
||||
"TYPE" => [
|
||||
"Rack" => "RacKMount",
|
||||
@ -21,6 +24,17 @@ return [
|
||||
"MiniPC" => "MiniPC",
|
||||
"colocation" => "코로케이션",
|
||||
],
|
||||
"MODEL" => [
|
||||
"HP DL360 Gen 6" => "HP DL360 Gen 6",
|
||||
"HP DL360 Gen 7" => "HP DL360 Gen 7",
|
||||
"HP DL360 Gen 8" => "HP DL360 Gen 8",
|
||||
"HP DL360 Gen 9" => "HP DL360 Gen 9",
|
||||
"3,4,5세대 PC" => "3,4,5세대 PC",
|
||||
"6,7,8세대 PC" => "6,7,8세대 PC",
|
||||
"9,10,11세대 PC" => "9,10,11세대 PC",
|
||||
"12,13,14세대 PC" => "12,13,14세대 PC",
|
||||
"12,13,14세대 MiniPC" => "12,13,14세대 MiniPC",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용가능",
|
||||
"pause" => "일시정지",
|
||||
|
||||
18
app/Language/en/Equipment/ServerPart.php
Normal file
18
app/Language/en/Equipment/ServerPart.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "장비부품연결",
|
||||
'label' => [
|
||||
'type' => "종류",
|
||||
'serverinfo_uid' => "서버",
|
||||
'partinfo_uid' => "부품",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'CPU',
|
||||
],
|
||||
"TYPE" => [
|
||||
"CPU" => "CPU",
|
||||
"RAM" => "RAM",
|
||||
"DISK" => "DISK",
|
||||
],
|
||||
];
|
||||
@ -4,6 +4,7 @@ return [
|
||||
'label' => [
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
|
||||
47
app/Models/Equipment/DefenceModel.php
Normal file
47
app/Models/Equipment/DefenceModel.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Equipment\DefenceEntity;
|
||||
|
||||
class DefenceModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "defenceinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "ip";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = DefenceEntity::class;
|
||||
protected $allowedFields = [
|
||||
"type",
|
||||
"ip",
|
||||
"accountid",
|
||||
"domain",
|
||||
"description",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
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":
|
||||
case "type":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "ip":
|
||||
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
@ -34,9 +34,6 @@ class IpModel extends EquipmentModel
|
||||
case "ip":
|
||||
$rule = "required|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
|
||||
@ -37,7 +37,6 @@ class LineModel extends EquipmentModel
|
||||
case "title":
|
||||
case "bandwith":
|
||||
case "type":
|
||||
case "status":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -16,7 +16,6 @@ class PartModel extends EquipmentModel
|
||||
"type",
|
||||
"model",
|
||||
"description",
|
||||
"manufactur_at",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
@ -32,15 +31,8 @@ class PartModel extends EquipmentModel
|
||||
switch ($field) {
|
||||
case "model":
|
||||
case "type":
|
||||
case "status":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "manufactur_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
case "description":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
|
||||
@ -8,7 +8,7 @@ class ServerModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "serverinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "model";
|
||||
const TITLE = "code";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ServerEntity::class;
|
||||
@ -17,7 +17,6 @@ class ServerModel extends EquipmentModel
|
||||
"type",
|
||||
"model",
|
||||
"description",
|
||||
"manufactur_at",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
@ -32,17 +31,10 @@ class ServerModel extends EquipmentModel
|
||||
}
|
||||
switch ($field) {
|
||||
case "code":
|
||||
$rule = "required|trim|min_length[4]|max_length[20]";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
case "model":
|
||||
case "type":
|
||||
case "manufactur_at":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "description":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
|
||||
43
app/Models/Equipment/ServerPartModel.php
Normal file
43
app/Models/Equipment/ServerPartModel.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
|
||||
class ServerPartModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "serverinfos_partinfos";
|
||||
const PK = "uid";
|
||||
const TITLE = "uid";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ServerPartEntity::class;
|
||||
protected $allowedFields = [
|
||||
"type",
|
||||
"serverinfo_uid",
|
||||
"partinfo_uid",
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
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 "serverinfo_uid":
|
||||
case "partinfo_uid":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
@ -31,12 +31,8 @@ class SoftwareModel extends EquipmentModel
|
||||
switch ($field) {
|
||||
case "model":
|
||||
case "type":
|
||||
case "status":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "description":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
|
||||
@ -27,6 +27,34 @@ class ClientService extends CustomerService
|
||||
{
|
||||
return new ClientEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return ['name', 'email', 'phone', 'role'];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ['role', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
foreach ($this->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
// dd($options);
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function create(array $formDatas, mixed $entity = new ClientEntity()): ClientEntity
|
||||
{
|
||||
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
|
||||
@ -42,16 +70,4 @@ 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'];
|
||||
}
|
||||
}
|
||||
|
||||
46
app/Services/Customer/ServicePartService.php
Normal file
46
app/Services/Customer/ServicePartService.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
use App\Entities\Customer\ServicePartEntity;
|
||||
use App\Models\Customer\ServicePartModel;
|
||||
|
||||
class ServicePartService extends CustomerService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "ServicePart";
|
||||
}
|
||||
public function getModelClass(): ServicePartModel
|
||||
{
|
||||
return new ServicePartModel();
|
||||
}
|
||||
public function getEntityClass(): ServicePartEntity
|
||||
{
|
||||
return new ServicePartEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"serviceinfo_uid",
|
||||
"partinfo_uid",
|
||||
"billing_type",
|
||||
"amount",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["serviceinfo_uid", "type", "partinfo_uid"];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["type", "partinfo_uid"];
|
||||
}
|
||||
}
|
||||
48
app/Services/Equipment/DefenceService.php
Normal file
48
app/Services/Equipment/DefenceService.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Equipment\DefenceEntity;
|
||||
use App\Models\Equipment\DefenceModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Services\Equipment\EquipmentService;
|
||||
|
||||
class DefenceService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Defence";
|
||||
}
|
||||
public function getModelClass(): DefenceModel
|
||||
{
|
||||
return new DefenceModel();
|
||||
}
|
||||
public function getEntityClass(): DefenceEntity
|
||||
{
|
||||
return new DefenceEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"type",
|
||||
"ip",
|
||||
"accountid",
|
||||
"domain",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
}
|
||||
}
|
||||
@ -29,10 +29,10 @@ class LineService extends EquipmentService
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"start_at",
|
||||
"type",
|
||||
"title",
|
||||
"bandwith",
|
||||
"start_at",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
|
||||
@ -31,7 +31,6 @@ class PartService extends EquipmentService
|
||||
return [
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
|
||||
46
app/Services/Equipment/ServerPartService.php
Normal file
46
app/Services/Equipment/ServerPartService.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Services\Equipment\EquipmentService;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Models\Equipment\ServerPartModel;
|
||||
|
||||
class ServerPartService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "ServerPart";
|
||||
}
|
||||
public function getModelClass(): ServerPartModel
|
||||
{
|
||||
return new ServerPartModel();
|
||||
}
|
||||
public function getEntityClass(): ServerPartEntity
|
||||
{
|
||||
return new ServerPartEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"type",
|
||||
"serverinfo_uid",
|
||||
"partinfo_uid",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["serverinfo_uid", "type", "partinfo_uid"];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["type", "partinfo_uid"];
|
||||
}
|
||||
}
|
||||
@ -32,24 +32,23 @@ class ServerService extends EquipmentService
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
return ["type", 'model', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
return ["type", 'model', 'status'];
|
||||
}
|
||||
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'SERVER':
|
||||
case 'serverinfo_uid':
|
||||
foreach ($this->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<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>
|
||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
||||
<?php endforeach ?>
|
||||
<?= 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>
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,63 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
|
||||
<!-- Layout Middle Start -->
|
||||
<table class="layout_middle">
|
||||
<tr>
|
||||
<td class="layout_left">
|
||||
<!-- Layout Left Start -->
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?>
|
||||
<!-- Layout Left End -->
|
||||
</td>
|
||||
<td class="layout_right">
|
||||
<!-- Layout Right Start -->
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
|
||||
<div id="container" class="layout_content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/index.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="index_body">
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
|
||||
<?= form_open(current_url(), ['id' => 'batchjob_form', 'method' => "post"]) ?>
|
||||
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="index_head_short_column">번호</th>
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?></th>
|
||||
<?php endforeach ?>
|
||||
<th class="index_head_short_column">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entities'] as $entity): ?>
|
||||
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
|
||||
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
|
||||
<?php $viewDatas['entity'] = $entity; ?>
|
||||
<th><?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?></th>
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
<th><?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?></th>
|
||||
</tr>
|
||||
<?php $cnt++ ?>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_batchjob"); ?>
|
||||
<?= form_close() ?>
|
||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||
</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>
|
||||
</tr>
|
||||
</table>
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
<!-- Layout Middle End -->
|
||||
<div class="layout_bottom">
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,31 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<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>
|
||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
||||
<?php endforeach ?>
|
||||
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['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['entity']->$field, $viewDatas) ?>
|
||||
<div><?= validation_show_error($field); ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,16 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -1,103 +0,0 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<div class="layout_top"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/top'); ?></div>
|
||||
<!-- Layout Middle Start -->
|
||||
<table class="layout_middle">
|
||||
<tr>
|
||||
<td class="layout_left">
|
||||
<!-- Layout Left Start -->
|
||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu'); ?>
|
||||
<!-- Layout Left End -->
|
||||
</td>
|
||||
<td class="layout_right">
|
||||
<!-- Layout Right Start -->
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
|
||||
<div id="container" class="layout_content">
|
||||
<!-- RSS Feed Start -->
|
||||
<style>
|
||||
.news-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
width: 48%;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.news-item h3 {
|
||||
font-size: 18px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.news-item p {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
<div class="news-container" id="newsContainer"><!-- RSS 피드 항목들이 여기에 동적으로 추가됩니다 --></div>
|
||||
<script>
|
||||
// fetchRSS 함수 정의
|
||||
function fetchRSS() {
|
||||
fetch('/RSSFeed/getITWorld')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const newsContainer = document.getElementById('newsContainer');
|
||||
newsContainer.innerHTML = '';
|
||||
data.forEach(item => {
|
||||
const pubDate = new Date(item.pubDate);
|
||||
const newsItem = document.createElement('div');
|
||||
newsItem.className = 'news-item';
|
||||
|
||||
let imageUrl = item.imageUrl || extractImageFromContent(item.content);
|
||||
imageUrl = convertToAbsoluteUrl(imageUrl, item.link);
|
||||
|
||||
newsItem.innerHTML = `
|
||||
<h3><img src="${imageUrl || '/images/common/news.png'}" alt="${item.title}" style="width: 30px; height: 30px; object-fit: cover; margin-bottom: 10px;" onerror="this.onerror=null; this.src='/images/common/news.png';"><a href="${item.link}" target="_blank">${item.title}</a></h3>
|
||||
<p>${item.description}</p>
|
||||
<small>게시일: ${pubDate.toLocaleString()}</small>
|
||||
`;
|
||||
newsContainer.appendChild(newsItem);
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('RSS 피드를 가져오는 중 오류 발생:', error));
|
||||
}
|
||||
|
||||
function extractImageFromContent(content) {
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(content, 'text/html');
|
||||
const img = doc.querySelector('img');
|
||||
return img ? img.src : null;
|
||||
}
|
||||
|
||||
function convertToAbsoluteUrl(url, baseUrl) {
|
||||
if (!url) return null;
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||
return url;
|
||||
}
|
||||
const base = new URL(baseUrl);
|
||||
if (url.startsWith('/')) {
|
||||
return `${base.protocol}//${base.hostname}${url}`;
|
||||
}
|
||||
return `${base.protocol}//${base.hostname}${base.pathname.substring(0, base.pathname.lastIndexOf('/') + 1)}${url}`;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
fetchRSS();
|
||||
setInterval(fetchRSS, 3600000);
|
||||
});
|
||||
</script>
|
||||
<!-- RSS Feed End -->
|
||||
</div>
|
||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||
<!-- Layout Right End -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- Layout Middle End -->
|
||||
<div class="layout_bottom"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?></div>
|
||||
<?= $this->endSection() ?>
|
||||
43
app/Views/admin/popup/index.php
Normal file
43
app/Views/admin/popup/index.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<!-- Layout Right Start -->
|
||||
<div id="container" class="layout_content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/index.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="index_body">
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
|
||||
<?= form_open(current_url(), ['id' => 'batchjob_form', 'method' => "post"]) ?>
|
||||
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="index_head_short_column">번호</th>
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<th data-rtc-resizable="<?= $field ?>"><?= $viewDatas['helper']->getListLabel($field, $viewDatas) ?></th>
|
||||
<?php endforeach ?>
|
||||
<th class="index_head_short_column">작업</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $cnt = 0 ?>
|
||||
<?php foreach ($viewDatas['entities'] as $entity): ?>
|
||||
<tr <?= $viewDatas['helper']->getListRowColor($entity) ?>>
|
||||
<?php $viewDatas['cnt'] = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt); ?>
|
||||
<?php $viewDatas['entity'] = $entity; ?>
|
||||
<th><?= $viewDatas['helper']->getListButton('modify', $viewDatas) ?></th>
|
||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
||||
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
|
||||
<?php endforeach ?>
|
||||
<th><?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?></th>
|
||||
</tr>
|
||||
<?php $cnt++ ?>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?= form_close() ?>
|
||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||
</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>
|
||||
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
<!-- Layout Middle End -->
|
||||
<?= $this->endSection() ?>
|
||||
@ -17,6 +17,9 @@
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/part"><?= ICONS['SETUP'] ?>부품정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/defence"><?= ICONS['SETUP'] ?>방어정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/software"><?= ICONS['FLAG'] ?>Software정보</a>
|
||||
</div>
|
||||
|
||||
@ -37,3 +37,7 @@ function addComponentFromLabel(field, value, text) {
|
||||
|
||||
listDiv.appendChild(wrapper);
|
||||
}
|
||||
|
||||
function openPartPopup(field) {
|
||||
window.open('/admin/equipment/part/popup?type=' + encodeURIComponent(field), 'PartPopup', 'width=800,height=500,scrollbars=yes');
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user