dbms_init...1
This commit is contained in:
parent
fabf52cd86
commit
4fc7d9407e
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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'];
|
||||
|
||||
@ -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() . "<BR>";
|
||||
// echo "Title: " . $this->title . "<BR>";
|
||||
// echo "uri_path: " . $this->uri_path . " <BR>";
|
||||
// echo "view_path: " . $this->view_path . "<BR>";
|
||||
// echo "action: " . $this->action . "<BR>";
|
||||
// echo "fields: " . implode(",", $this->fields) . "<BR>";
|
||||
// // 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() . "<BR>";
|
||||
// echo "Error Title: " . $this->title . "<BR>";
|
||||
// echo "Error uri_path: " . $this->uri_path . " <BR>";
|
||||
// echo "Error view_path: " . $this->view_path . "<BR>";
|
||||
// echo "Error action: " . $this->action . "<BR>";
|
||||
// echo "Error fields: " . implode(",", $this->fields) . "<BR>";
|
||||
// // exit;
|
||||
// }
|
||||
return redirect()->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user