diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php
index 1ad6107..17ae172 100644
--- a/app/Controllers/Admin/Customer/ServiceController.php
+++ b/app/Controllers/Admin/Customer/ServiceController.php
@@ -101,9 +101,17 @@ class ServiceController extends CustomerController
protected function index_process(): array
{
$fields = [
- 'fields' => ['type', 'clientinfo_uid', 'rack', 'lineinfo_uid', 'serverinfo_uid', 'IP', 'CPU', 'RAM', 'DISK', 'SOFTWARE', 'DEFENCE', 'billing_at', 'start_at', 'status'],
+ 'fields' => ['clientinfo_uid', 'type', 'billing_at', 'rack', 'LINE', 'SERVER', 'IP', 'CPU', 'RAM', 'DISK', 'SOFTWARE', 'DEFENCE', 'start_at', 'status'],
];
$this->init('index', $fields);
- return parent::index_process();
+ // $this->modal_type = 'modal_fetch_v2'; //기본은 modal_iframe임
+ $entities = [];
+ // foreach (parent::index_process() as $entity) {
+ // $entity->setPartEntities("CPU", $this->getCpuService()->getPartEntities($entity));
+ // $entity->setPartEntities("RAM", $this->getRamService()->getPartEntities($entity));
+ // $entity->setPartEntities("DISK", $this->getDiskService()->getPartEntities($entity));
+ // $entities[] = $entity;
+ // }
+ return $entities;
}
}
diff --git a/app/Controllers/Admin/Equipment/Link/LinkController.php b/app/Controllers/Admin/Equipment/Link/LinkController.php
index 85578d9..a109fab 100644
--- a/app/Controllers/Admin/Equipment/Link/LinkController.php
+++ b/app/Controllers/Admin/Equipment/Link/LinkController.php
@@ -28,7 +28,6 @@ abstract class LinkController extends EquipmentController
{
switch ($action) {
case 'index':
- case 'view':
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . 'popup' . DIRECTORY_SEPARATOR . $action, ['viewDatas' => $this->getViewDatas()]);
break;
diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php
index 75981e9..f506b6d 100644
--- a/app/Controllers/Admin/UserController.php
+++ b/app/Controllers/Admin/UserController.php
@@ -55,21 +55,6 @@ class UserController extends AdminController
}
//Index,FieldForm관련.
- protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
- {
- switch ($action) {
- case 'create':
- case 'modify':
- $this->getHelper()->setViewDatas($this->getViewDatas());
- $result = view($this->view_path . 'view', ['viewDatas' => $this->getViewDatas()]);;
- break;
- default:
- $result = parent::getResultPageByActon($action, $message);
- break;
- }
- return $result;
- }
-
//View관련
protected function view_process($uid): mixed
{
diff --git a/app/Controllers/Auth/AuthController.php b/app/Controllers/Auth/AuthController.php
index 320563e..e8f31a2 100644
--- a/app/Controllers/Auth/AuthController.php
+++ b/app/Controllers/Auth/AuthController.php
@@ -36,19 +36,6 @@ abstract class AuthController extends CommonController
return $this->_helper;
}
- protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
- {
- switch ($action) {
- case 'login_form':
- $this->getHelper()->setViewDatas($this->getViewDatas());
- $result = view($this->view_path . $action, ['viewDatas' => $this->getViewDatas()]);
- break;
- default:
- $result = parent::getResultPageByActon($action, $message);
- break;
- }
- return $result;
- }
final public function getFields(): array
{
return ['id', 'passwd'];
diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php
index 4105e94..11dea87 100644
--- a/app/Controllers/CommonController.php
+++ b/app/Controllers/CommonController.php
@@ -162,12 +162,27 @@ abstract class CommonController extends BaseController
{
switch ($action) {
case 'create':
+ $segments = $this->request->getUri()->getSegments();
+ if (!empty($segments)) {
+ // 마지막 세그먼트 무조건 view로 교체
+ $segments[count($segments) - 1] = 'view';
+ }
+ $redirectPath = '/' . implode('/', $segments);
+ $result = redirect()->to($redirectPath . '/' . $this->entity->getPK());
+ // $result = view($this->view_path . 'view', ['viewDatas' => $this->getViewDatas()]);;
+ break;
case 'modify':
- $this->getHelper()->setViewDatas($this->getViewDatas());
- $result = view($this->view_path . 'view', ['viewDatas' => $this->getViewDatas()]);;
+ $segments = $this->request->getUri()->getSegments();
+ if (!empty($segments)) {
+ // 마지막 세그먼트 무조건 view로 교체
+ $segments[count($segments) - 2] = 'view';
+ }
+ $result = redirect()->to('/' . implode('/', $segments));
+ // $result = view($this->view_path . 'view', ['viewDatas' => $this->getViewDatas()]);;
break;
case 'create_form':
case 'modify_form':
+ case 'login_form':
case 'index':
case 'view':
$this->getHelper()->setViewDatas($this->getViewDatas());
@@ -186,8 +201,10 @@ abstract class CommonController extends BaseController
final public function create_form(): RedirectResponse|string
{
try {
- $this->init(__FUNCTION__);
+ // 현재 URL을 스택에 저장
+ // $this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
helper(['form']);
+ $this->init(__FUNCTION__);
$this->create_form_process();
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultPageByActon($this->action);
@@ -204,7 +221,6 @@ abstract class CommonController extends BaseController
$this->getService()->getModel()->transStart();
try {
$this->init(__FUNCTION__);
- helper(['form']);
//데이터 검증
$this->formDatas = $this->doValidate($this->action, $this->fields);
$this->entity = $this->create_process();
@@ -227,8 +243,10 @@ abstract class CommonController extends BaseController
final public function modify_form(mixed $uid): RedirectResponse|string
{
try {
- $this->init(__FUNCTION__);
+ // 현재 URL을 스택에 저장
+ // $this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
helper(['form']);
+ $this->init(__FUNCTION__);
$this->entity = $this->modify_form_process($uid);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultPageByActon($this->action);
@@ -248,7 +266,6 @@ abstract class CommonController extends BaseController
$this->getService()->getModel()->transStart();
try {
$this->init(__FUNCTION__);
- helper(['form']);
//데이터 검증
$this->formDatas = $this->doValidate($this->action, $this->fields);
$this->entity = $this->modify_process($uid);
@@ -425,9 +442,9 @@ abstract class CommonController extends BaseController
final public function view(string $uid): RedirectResponse|string
{
try {
+ helper(['form']);
$this->init(__FUNCTION__);
$this->entity = $this->view_process($uid);
- helper(['form']);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
@@ -523,14 +540,32 @@ abstract class CommonController extends BaseController
public function index()
{
try {
- $this->init(__FUNCTION__);
- $this->entities = $this->index_process();
// 현재 URL을 스택에 저장
$this->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
helper(['form']);
+ $this->init(__FUNCTION__);
+ // if (env('app.debug.index')) {
+ // echo "ClassName: " . $this->getService()->getClassName() . "
";
+ // echo "Title: " . $this->title . "
";
+ // echo "uri_path: " . $this->uri_path . "
";
+ // echo "view_path: " . $this->view_path . "
";
+ // echo "action: " . $this->action . "
";
+ // echo "fields: " . implode(",", $this->fields) . "
";
+ // // exit;
+ // }
+ $this->entities = $this->index_process();
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {
- return redirect()->back()->withInput()->with('error', $e->getMessage());
+ // if (env('app.debug.index')) {
+ // echo "Error ClassName: " . $this->getService()->getClassName() . "
";
+ // echo "Error Title: " . $this->title . "
";
+ // echo "Error uri_path: " . $this->uri_path . "
";
+ // echo "Error view_path: " . $this->view_path . "
";
+ // echo "Error action: " . $this->action . "
";
+ // echo "Error fields: " . implode(",", $this->fields) . "
";
+ // // exit;
+ // }
+ return redirect()->with('error', $e->getMessage());
}
}
diff --git a/app/Entities/CommonEntity.php b/app/Entities/CommonEntity.php
index ccb6aee..ea6e89c 100644
--- a/app/Entities/CommonEntity.php
+++ b/app/Entities/CommonEntity.php
@@ -29,6 +29,10 @@ abstract class CommonEntity extends Entity
}
final public function isMatched(string $field, string $value): bool
{
+ //Helper의 getListRowColor 함수에서 사용
+ if (!array_key_exists($field, $this->attributes)) {
+ return true;
+ };
return $this->attributes[$field] == $value;
}
final public function getUpdatedAt(): string|null
diff --git a/app/Services/Auth/AuthService.php b/app/Services/Auth/AuthService.php
index c34b329..87f4716 100644
--- a/app/Services/Auth/AuthService.php
+++ b/app/Services/Auth/AuthService.php
@@ -11,6 +11,7 @@ use CodeIgniter\Session\Session;
abstract class AuthService extends CommonService
{
private ?Session $_session = null;
+ private $url_stack_name = "url_stack";
protected function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
@@ -72,12 +73,12 @@ abstract class AuthService extends CommonService
final public function pushCurrentUrl(string $url): void
{
- $this->getSession()->set('url_stack', $url);
+ $this->getSession()->set($this->url_stack_name, $url);
}
final public function popPreviousUrl(): string
{
- $url = $this->getSession()->get('url_stack') ?? "";
+ $url = $this->getSession()->get($this->url_stack_name) ?? "";
if (!empty($url)) {
$this->pushCurrentUrl("");
return $url;
diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php
index bdff9ff..64c5dcf 100644
--- a/app/Services/CommonService.php
+++ b/app/Services/CommonService.php
@@ -35,7 +35,7 @@ abstract class CommonService
{
return $this->request;
}
- final public function addClassName(string $className): void
+ final protected function addClassName(string $className): void
{
$this->_classNames[] = $className;
}
diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php
index d65392d..c0a97b5 100644
--- a/app/Services/Customer/ServiceService.php
+++ b/app/Services/Customer/ServiceService.php
@@ -28,8 +28,6 @@ class ServiceService extends CustomerService
"clientinfo_uid",
"type",
"rack",
- "lineinfo_uid",
- "serverinfo_uid",
"billing_at",
"start_at",
"end_at",
@@ -38,7 +36,7 @@ class ServiceService extends CustomerService
}
public function getFilterFields(): array
{
- return ["clientinfo_uid", "lineinfo_uid", "serverinfo_uid", 'type', 'status'];
+ return ["clientinfo_uid", 'type', 'status'];
}
public function getBatchJobFields(): array
{