dbmsv4 init...1
This commit is contained in:
parent
a0021cc5f8
commit
6ab2ad8b9f
@ -38,7 +38,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
|||||||
$this->action_init_process($action, $formDatas);
|
$this->action_init_process($action, $formDatas);
|
||||||
$this->addViewDatas('formDatas', $formDatas);
|
$this->addViewDatas('formDatas', $formDatas);
|
||||||
return $this->create_form_result_process($action);
|
return $this->create_form_result_process($action);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,9 +68,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
|||||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||||
}
|
}
|
||||||
return $this->create_result_process($entity);
|
return $this->create_result_process($entity);
|
||||||
} catch (ValidationException $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,10 +102,10 @@ abstract class AbstractCRUDController extends AbstractWebController
|
|||||||
}
|
}
|
||||||
$this->addViewDatas('entity', $entity);
|
$this->addViewDatas('entity', $entity);
|
||||||
$action = __FUNCTION__;
|
$action = __FUNCTION__;
|
||||||
$this->action_init_process($action);
|
$this->action_init_process($action, $entity->toArray());
|
||||||
return $this->modify_form_result_process($action);
|
return $this->modify_form_result_process($action);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 수정폼 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,10 +135,8 @@ abstract class AbstractCRUDController extends AbstractWebController
|
|||||||
}
|
}
|
||||||
$this->addViewDatas('entity', $entity);
|
$this->addViewDatas('entity', $entity);
|
||||||
return $this->modify_result_process($entity);
|
return $this->modify_result_process($entity);
|
||||||
} catch (ValidationException $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 수정 오류:" . $e->getMessage());
|
||||||
} catch (\Exception $e) {
|
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +149,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
|||||||
|
|
||||||
protected function delete_result_process(CommonEntity $entity): string|RedirectResponse
|
protected function delete_result_process(CommonEntity $entity): string|RedirectResponse
|
||||||
{
|
{
|
||||||
return $this->action_redirect_process('info', "{$this->getTitle()}에서 {$entity->getTitle()} 삭제가 완료되었습니다.");
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$entity->getTitle()} 삭제가 완료되었습니다.");
|
||||||
}
|
}
|
||||||
final public function delete($uid): RedirectResponse
|
final public function delete($uid): RedirectResponse
|
||||||
{
|
{
|
||||||
@ -165,8 +161,8 @@ abstract class AbstractCRUDController extends AbstractWebController
|
|||||||
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
throw new RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 {$entityClass}만 가능");
|
||||||
}
|
}
|
||||||
return $this->delete_result_process($entity);
|
return $this->delete_result_process($entity);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 삭제 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,8 +198,8 @@ abstract class AbstractCRUDController extends AbstractWebController
|
|||||||
}
|
}
|
||||||
$this->addViewDatas('entity', $entity);
|
$this->addViewDatas('entity', $entity);
|
||||||
return $this->view_result_process($action);
|
return $this->view_result_process($action);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 상세보기 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,10 +94,12 @@ abstract class AbstractWebController extends Controller
|
|||||||
case 'critical':
|
case 'critical':
|
||||||
case 'alert':
|
case 'alert':
|
||||||
case 'emergency':
|
case 'emergency':
|
||||||
|
log_message($type, $message);
|
||||||
|
$result = redirect()->back()->withInput()->with('message', $message);
|
||||||
|
break;
|
||||||
case 'debug':
|
case 'debug':
|
||||||
case 'info':
|
case 'info':
|
||||||
case 'notice':
|
case 'notice':
|
||||||
log_message($type, $message);
|
|
||||||
default:
|
default:
|
||||||
$redirect_url = $redirect_url ?? $this->getAuthContext()->popPreviousUrl() ?? implode(DIRECTORY_SEPARATOR, $this->getActionPaths());
|
$redirect_url = $redirect_url ?? $this->getAuthContext()->popPreviousUrl() ?? implode(DIRECTORY_SEPARATOR, $this->getActionPaths());
|
||||||
$result = redirect()->to($redirect_url)->with('message', $message);
|
$result = redirect()->to($redirect_url)->with('message', $message);
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class ClientController extends CustomerController
|
|||||||
$this->addViewDatas('entity', $entity);
|
$this->addViewDatas('entity', $entity);
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? 'client');
|
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? 'client');
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
// return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
// return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -60,11 +60,13 @@ class ClientController extends CustomerController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$action = __FUNCTION__;
|
$action = __FUNCTION__;
|
||||||
$this->action_init_process($action);
|
$fields = ['history'];
|
||||||
$this->addViewDatas('entity', $this->service->modify($uid, $this->request->getPost()));
|
$this->service->getFormService()->setFormFields($fields);
|
||||||
|
$this->service->getFormService()->setFormRules($action, $fields);
|
||||||
|
$this->addViewDatas('entity', $this->service->modify($uid, $this->service->createDTO($this->request->getPost())));
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고설정이 완료되었습니다.");
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고설정이 완료되었습니다.");
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $e->getMessage();
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace App\Controllers\Admin\Customer;
|
namespace App\Controllers\Admin\Customer;
|
||||||
|
|
||||||
use App\Entities\Customer\ServiceEntity;
|
use App\Entities\Customer\ServiceEntity;
|
||||||
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
@ -35,4 +36,24 @@ class ServiceController extends CustomerController
|
|||||||
$formDatas['status'] = STATUS['AVAILABLE'];
|
$formDatas['status'] = STATUS['AVAILABLE'];
|
||||||
return $formDatas;
|
return $formDatas;
|
||||||
}
|
}
|
||||||
|
protected function index_process(string $action): void
|
||||||
|
{
|
||||||
|
//서비스별 미납 Count
|
||||||
|
$this->addViewDatas('unPaids', service('paymentservice')->getUnPaids('serviceinfo_uid'));
|
||||||
|
parent::index_process($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function history(int $uid): RedirectResponse|string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$action = __FUNCTION__;
|
||||||
|
$fields = ['history'];
|
||||||
|
$this->service->getFormService()->setFormFields($fields);
|
||||||
|
$this->service->getFormService()->setFormRules($action, $fields);
|
||||||
|
$this->addViewDatas('entity', $this->service->modify($uid, $this->service->createDTO($this->request->getPost())));
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고설정이 완료되었습니다.");
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 비고 오류:" . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace App\Controllers\Admin\Equipment;
|
namespace App\Controllers\Admin\Equipment;
|
||||||
|
|
||||||
use App\Entities\Equipment\ServerEntity;
|
use App\Entities\Equipment\ServerEntity;
|
||||||
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
@ -29,4 +30,9 @@ class ServerController extends EquipmentController
|
|||||||
$formDatas['code'] = sprintf("%d%dXX-M%d", date("y"), ceil((int)date("m") / 3), $this->service->getNextPK());
|
$formDatas['code'] = sprintf("%d%dXX-M%d", date("y"), ceil((int)date("m") / 3), $this->service->getNextPK());
|
||||||
return $formDatas;
|
return $formDatas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function modify_form_result_process(string $action): string|RedirectResponse
|
||||||
|
{
|
||||||
|
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? 'server');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,12 +29,16 @@ class ServerPartController extends EquipmentController
|
|||||||
$formDatas = parent::create_form_process($formDatas);
|
$formDatas = parent::create_form_process($formDatas);
|
||||||
$formDatas['serverinfo_uid'] = $this->request->getVar('serverinfo_uid') ?? throw new \Exception("ServerPart는 반드시 서버정보가 필요합니다.");
|
$formDatas['serverinfo_uid'] = $this->request->getVar('serverinfo_uid') ?? throw new \Exception("ServerPart는 반드시 서버정보가 필요합니다.");
|
||||||
$formDatas['type'] = $this->request->getVar('type') ?? throw new \Exception("ServerPart는 반드시 파트형식 필요합니다.");
|
$formDatas['type'] = $this->request->getVar('type') ?? throw new \Exception("ServerPart는 반드시 파트형식 필요합니다.");
|
||||||
|
$formDatas['cnt'] = 1;
|
||||||
//type : CS,IP이면 월비용 기본처리
|
//type : CS,IP이면 월비용 기본처리
|
||||||
switch ($formDatas['type']) {
|
switch ($formDatas['type']) {
|
||||||
case 'CS':
|
case 'CS':
|
||||||
case 'IP':
|
case 'IP':
|
||||||
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
$formDatas['billing'] = PAYMENT['BILLING']['ONETIME'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return $formDatas;
|
return $formDatas;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ use App\Entities\UserEntity;
|
|||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
abstract class AuthController extends AbstractWebController
|
abstract class AuthController extends AbstractWebController
|
||||||
@ -21,7 +20,7 @@ abstract class AuthController extends AbstractWebController
|
|||||||
{
|
{
|
||||||
return 'auth';
|
return 'auth';
|
||||||
}
|
}
|
||||||
protected function action_init_process(string $action): void
|
protected function action_init_process(string $action, array $formDatas = []): void
|
||||||
{
|
{
|
||||||
$this->service->action_init_process($action);
|
$this->service->action_init_process($action);
|
||||||
parent::action_init_process($action);
|
parent::action_init_process($action);
|
||||||
@ -39,7 +38,7 @@ abstract class AuthController extends AbstractWebController
|
|||||||
try {
|
try {
|
||||||
//초기화
|
//초기화
|
||||||
$this->action_init_process($action);
|
$this->action_init_process($action);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
log_message('error', $e->getMessage());
|
log_message('error', $e->getMessage());
|
||||||
session()->setFlashdata('message', $e->getMessage());
|
session()->setFlashdata('message', $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -62,7 +61,7 @@ abstract class AuthController extends AbstractWebController
|
|||||||
// 홈페이지로 리다이렉트
|
// 홈페이지로 리다이렉트
|
||||||
$redirect_url = $this->getAuthContext()->popPreviousUrl() ?? "/";
|
$redirect_url = $this->getAuthContext()->popPreviousUrl() ?? "/";
|
||||||
return redirect()->route($redirect_url)->with('message', MESSAGES['LOGOUT']);
|
return redirect()->route($redirect_url)->with('message', MESSAGES['LOGOUT']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
log_message("error", $e->getMessage());
|
log_message("error", $e->getMessage());
|
||||||
return redirect()->back()->withInput()->with('message', "로그아웃 중 오류가 발생했습니다.");
|
return redirect()->back()->withInput()->with('message', "로그아웃 중 오류가 발생했습니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,17 +41,14 @@ class Collector extends BaseController
|
|||||||
$success++;
|
$success++;
|
||||||
$message = "{$trafficEntity->getServerIP()} 트래픽 수집데이터 저장 완료 In: {$entity->getIn()} Kb/s / Out: {$entity->getOut()} Kb/s";
|
$message = "{$trafficEntity->getServerIP()} 트래픽 수집데이터 저장 완료 In: {$entity->getIn()} Kb/s / Out: {$entity->getOut()} Kb/s";
|
||||||
log_message('info', $message);
|
log_message('info', $message);
|
||||||
} catch (ValidationException $e) {
|
} catch (\Throwable $e) {
|
||||||
$error++;
|
|
||||||
log_message('error', "{$trafficEntity->getServerIP()} 트래픽 수집데이터 검증오류:{$e->getMessage()}");
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$error++;
|
$error++;
|
||||||
log_message('error', "{$trafficEntity->getServerIP()} 트래픽 수집데이터 저장 실패:{$e->getMessage()}");
|
log_message('error', "{$trafficEntity->getServerIP()} 트래픽 수집데이터 저장 실패:{$e->getMessage()}");
|
||||||
}
|
}
|
||||||
$total++;
|
$total++;
|
||||||
}
|
}
|
||||||
log_message('info', sprintf("성공:%s , 실패:%s , 총:%s 트래픽 수집 작업완료", $success, $error, $total));
|
log_message('info', sprintf("성공:%s , 실패:%s , 총:%s 트래픽 수집 작업완료", $success, $error, $total));
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
log_message('error', "트래픽 수집 작업오류:{$e->getMessage()}");
|
log_message('error', "트래픽 수집 작업오류:{$e->getMessage()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,17 +73,14 @@ abstract class CommonController extends AbstractCRUDController
|
|||||||
foreach ($uids as $uid) {
|
foreach ($uids as $uid) {
|
||||||
try {
|
try {
|
||||||
$entities[] = $this->batchjob_process($uid, $formDatas);
|
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||||
} catch (ValidationException $e) {
|
} catch (\Throwable $e) {
|
||||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
|
||||||
$errors[] = $e->getMessage();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||||
$errors[] = $e->getMessage();
|
$errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->batchjob_result_process($uids, $entities, $errors);
|
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄수정 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// --- 일괄 삭제 (Batch Job Delete) ---
|
// --- 일괄 삭제 (Batch Job Delete) ---
|
||||||
@ -127,13 +124,13 @@ abstract class CommonController extends AbstractCRUDController
|
|||||||
foreach ($uids as $uid) {
|
foreach ($uids as $uid) {
|
||||||
try {
|
try {
|
||||||
$entities[] = $this->batchjob_delete_process($uid);
|
$entities[] = $this->batchjob_delete_process($uid);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||||
$errors[] = $e->getMessage();
|
$errors[] = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,7 +227,6 @@ abstract class CommonController extends AbstractCRUDController
|
|||||||
// 현재 URL을 이전 URL 스택에 저장
|
// 현재 URL을 이전 URL 스택에 저장
|
||||||
$this->getAuthContext()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
$this->getAuthContext()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||||
$this->addViewDatas('uri', $this->request->getUri());
|
$this->addViewDatas('uri', $this->request->getUri());
|
||||||
|
|
||||||
// Paging 설정
|
// Paging 설정
|
||||||
$page = (int) $this->request->getVar('page') ?: 1;
|
$page = (int) $this->request->getVar('page') ?: 1;
|
||||||
$perpage = (int) $this->request->getVar('perpage') ?: intval(DEFAULTS['INDEX_PERPAGE'] ?? 10);
|
$perpage = (int) $this->request->getVar('perpage') ?: intval(DEFAULTS['INDEX_PERPAGE'] ?? 10);
|
||||||
@ -240,7 +236,6 @@ abstract class CommonController extends AbstractCRUDController
|
|||||||
$this->index_condition_process($action);
|
$this->index_condition_process($action);
|
||||||
$index_totalcount = $this->service->getTotalCount();
|
$index_totalcount = $this->service->getTotalCount();
|
||||||
$this->addViewDatas('index_totalcount', $index_totalcount);
|
$this->addViewDatas('index_totalcount', $index_totalcount);
|
||||||
|
|
||||||
// Pagination 설정
|
// Pagination 설정
|
||||||
$this->addViewDatas('index_pagination', $this->pagenation_process($index_totalcount, $page, $perpage));
|
$this->addViewDatas('index_pagination', $this->pagenation_process($index_totalcount, $page, $perpage));
|
||||||
$this->addViewDatas('index_pagination_options', $this->pagenation_options_process($index_totalcount, $perpage));
|
$this->addViewDatas('index_pagination_options', $this->pagenation_options_process($index_totalcount, $perpage));
|
||||||
@ -248,7 +243,6 @@ abstract class CommonController extends AbstractCRUDController
|
|||||||
$this->index_condition_process($action); // 조건절을 다시 호출하여 필터/검색어 유지
|
$this->index_condition_process($action); // 조건절을 다시 호출하여 필터/검색어 유지
|
||||||
$this->service->setLimit($perpage);
|
$this->service->setLimit($perpage);
|
||||||
$this->service->setOffset(($page - 1) * $perpage);
|
$this->service->setOffset(($page - 1) * $perpage);
|
||||||
|
|
||||||
// Entities 처리
|
// Entities 처리
|
||||||
$this->addViewDatas('entities', $this->index_entities_process());
|
$this->addViewDatas('entities', $this->index_entities_process());
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
@ -263,9 +257,7 @@ abstract class CommonController extends AbstractCRUDController
|
|||||||
return $this->index_result_process($action);
|
return $this->index_result_process($action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- 문서 다운로드 (Download) ---
|
// --- 문서 다운로드 (Download) ---
|
||||||
|
|
||||||
protected function downloadByDocumentType(string $document_type, mixed $loaded_data): array
|
protected function downloadByDocumentType(string $document_type, mixed $loaded_data): array
|
||||||
{
|
{
|
||||||
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "download";
|
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "download";
|
||||||
@ -329,8 +321,8 @@ abstract class CommonController extends AbstractCRUDController
|
|||||||
$action = __FUNCTION__;
|
$action = __FUNCTION__;
|
||||||
$this->action_init_process($action);
|
$this->action_init_process($action);
|
||||||
return $this->download_process($action, $output_type, $uid);
|
return $this->download_process($action, $output_type, $uid);
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
return $this->action_redirect_process('error', "{$this->getTitle()}에서 Download 오류:" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,10 @@ class ServerForm extends EquipmentForm
|
|||||||
public function getFormRule(string $action, string $field): string
|
public function getFormRule(string $action, string $field): string
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
|
case "switchinfo_uid":
|
||||||
|
$rule = "permit_empty|numeric";
|
||||||
|
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
|
||||||
|
break;
|
||||||
case "code":
|
case "code":
|
||||||
case "title":
|
case "title":
|
||||||
$rule = "required|trim|string";
|
$rule = "required|trim|string";
|
||||||
@ -22,13 +26,6 @@ class ServerForm extends EquipmentForm
|
|||||||
case "status":
|
case "status":
|
||||||
$rule = "required|trim|string";
|
$rule = "required|trim|string";
|
||||||
break;
|
break;
|
||||||
case "manufactur_at":
|
|
||||||
$rule = "required|valid_date";
|
|
||||||
break;
|
|
||||||
case "switch":
|
|
||||||
$rule = "permit_empty|trim|string";
|
|
||||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
|
|
||||||
break;
|
|
||||||
case "ip":
|
case "ip":
|
||||||
$rule = "permit_empty|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
|
$rule = "permit_empty|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6)
|
||||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
|
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : "";
|
||||||
@ -36,6 +33,9 @@ class ServerForm extends EquipmentForm
|
|||||||
case "os":
|
case "os":
|
||||||
$rule = "permit_empty|trim|string";
|
$rule = "permit_empty|trim|string";
|
||||||
break;
|
break;
|
||||||
|
case "manufactur_at":
|
||||||
|
$rule = "required|valid_date";
|
||||||
|
break;
|
||||||
case "format_at":
|
case "format_at":
|
||||||
$rule = "permit_empty|valid_date";
|
$rule = "permit_empty|valid_date";
|
||||||
break;
|
break;
|
||||||
@ -89,6 +89,11 @@ class ServerForm extends EquipmentForm
|
|||||||
$tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle();
|
$tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle();
|
||||||
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
|
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
|
||||||
}
|
}
|
||||||
|
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
|
||||||
|
if (!array_key_exists($formDatas[$field], $tempOptions)) {
|
||||||
|
$tempOptions[$formDatas[$field]] = $formDatas[$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
$options['options'] = $tempOptions;
|
$options['options'] = $tempOptions;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -41,8 +41,6 @@ class ServiceHelper extends CustomerHelper
|
|||||||
'serviceEntity' => $viewDatas['entity'],
|
'serviceEntity' => $viewDatas['entity'],
|
||||||
'template' => 'servicelist',
|
'template' => 'servicelist',
|
||||||
]);
|
]);
|
||||||
// $value = $viewDatas['formOptions'][$field]['options'][$value];
|
|
||||||
// $value = "<span class=\"serverparts\" style=\"cursor:pointer;\" onClick=\"copyServerPartToClipboard('{$value}')\" text-data=\"{$value}\">📋</span>{$value}";
|
|
||||||
break;
|
break;
|
||||||
case 'amount':
|
case 'amount':
|
||||||
case 'sale':
|
case 'sale':
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class ServerHelper extends EquipmentHelper
|
|||||||
case 'part':
|
case 'part':
|
||||||
$value = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
$value = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
'serverinfo_uid' => $viewDatas['entity']->getPK(),
|
'serverinfo_uid' => $viewDatas['entity']->getPK(),
|
||||||
'types' => SERVERPART['SERVER_PARTTYPES'],
|
'types' => SERVERPART['ALL_PARTTYPES'],
|
||||||
'template' => 'serverlist',
|
'template' => 'serverlist',
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
|
|||||||
37
app/Views/admin/server/modify_form.php
Normal file
37
app/Views/admin/server/modify_form.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?= $this->extend($viewDatas['layout']['layout']) ?>
|
||||||
|
<?= $this->section('content') ?>
|
||||||
|
<?= session('message') ? $viewDatas['helper']->alertTrait(session('message')) : ""; ?>
|
||||||
|
<div id="container" class="content">
|
||||||
|
<div class="form_top"><?= $this->include("{$viewDatas['layout']['template']}/form_content_top"); ?></div>
|
||||||
|
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th class="bg-light">서버정보[<?= $viewDatas['entity']->getCode() ?>]</th>
|
||||||
|
<th class="bg-light">추가정보</th>
|
||||||
|
</tr>
|
||||||
|
<td>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
|
||||||
|
<tr>
|
||||||
|
<th nowrap class="text-end bg-light" width="20%"><?= $viewDatas['helper']->getFieldLabel($field, $label, $viewDatas) ?></th>
|
||||||
|
<td nowrap class="text-start">
|
||||||
|
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?>
|
||||||
|
<div><?= validation_show_error($field); ?></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
<div class="text-center"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||||
|
<?= form_close(); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
|
'serverinfo_uid' => $viewDatas['entity']->getPK(),
|
||||||
|
'types' => SERVERPART['ALL_PARTTYPES']
|
||||||
|
]) ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="form_bottom"><?= $this->include("{$viewDatas['layout']['template']}/form_content_bottom"); ?></div>
|
||||||
|
</div>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
@ -1,13 +1,20 @@
|
|||||||
<?php $temps = []; ?>
|
<?php $temps = []; ?>
|
||||||
<?php foreach ($serverCellDatas['entities'] as $entity): ?>
|
<?php foreach ($serverCellDatas['entities'] as $entity): ?>
|
||||||
<?php $serverCellDatas['entity'] = $entity ?>
|
<?php
|
||||||
<?php $value = sprintf(
|
$serverCellDatas['entity'] = $entity;
|
||||||
"%s / %s / %s / %s",
|
$title = $entity->getCustomTitle();;
|
||||||
$entity->getCustomTitle(),
|
$serverinfos = [];
|
||||||
$serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUID(), $serverCellDatas),
|
$serverinfos[] = $serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUID(), $serverCellDatas);
|
||||||
$entity->getIP(),
|
$serverinfos[] = $serverCellDatas['helper']->getFieldView('ip', $entity->getIP(), $serverCellDatas);
|
||||||
$entity->getOS()
|
$serverinfos[] = $serverCellDatas['helper']->getFieldView('os', $entity->getOS(), $serverCellDatas);
|
||||||
) ?>
|
$serverinfos[] = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
<?php $temps[] = "<span class=\"serverparts\" style=\"cursor:pointer;\" onClick=\"copyServerPartToClipboard('{$value}')\" text-data=\"{$value}\">📋</span>{$value}" ?>
|
'serverinfo_uid' => $entity->getPK(),
|
||||||
|
'types' => SERVERPART['SERVICE_PARTTYPES'],
|
||||||
|
'template' => 'servicelist',
|
||||||
|
]);
|
||||||
|
$text = $title . " / " . implode(" / ", $serverinfos);
|
||||||
|
$html = $serverCellDatas['serverPartHelper']->getFieldView('SERVER', "", ['serverEntity' => $entity]) . " / " . implode(" / ", $serverinfos);
|
||||||
|
?>
|
||||||
|
<?php $temps[] = "<span class=\"serverparts\" style=\"cursor:pointer;\" onClick=\"copyServerPartToClipboard('{$text}')\" text-data=\"{$text}\">📋</span>{$html}" ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?= implode("<BR>", $temps) ?>
|
<?= implode("<BR>", $temps) ?>
|
||||||
@ -10,10 +10,9 @@
|
|||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php $view_texts = [] ?>
|
|
||||||
<?php foreach ($htmls as $type => $datas): ?><?php $view_texts[] = implode(',', $texts[$type]) ?><?php endforeach ?>
|
|
||||||
<?php $text = implode("/", $view_texts) ?>
|
|
||||||
<span class="serverparts" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">📋</span>
|
|
||||||
<?php $view_htmls = [] ?>
|
<?php $view_htmls = [] ?>
|
||||||
<?php foreach ($htmls as $type => $datas): ?><?php $view_htmls[] = implode(",", $datas) ?><?php endforeach ?>
|
<?php foreach ($htmls as $type => $datas): ?><?php $view_htmls[] = implode(",", $datas) ?><?php endforeach ?>
|
||||||
<?= implode("/", $view_htmls) ?>
|
<?php $view_texts = [] ?>
|
||||||
|
<?php foreach ($texts as $type => $datas): ?><?php $view_texts[] = implode(',', $datas) ?><?php endforeach ?>
|
||||||
|
<?php $text = implode(" / ", $view_texts) ?>
|
||||||
|
<span class="float-start serverparts" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">📋</span><?= implode(" / ", $view_htmls) ?>
|
||||||
13
app/Views/cells/serverpart/servicelist.php
Normal file
13
app/Views/cells/serverpart/servicelist.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php $texts = [] ?>
|
||||||
|
<?php foreach ($serverPartCellDatas['types'] as $type): ?>
|
||||||
|
<?php $texts[$type] = []; ?>
|
||||||
|
<?php foreach ($serverPartCellDatas['entities'][$type] as $entities): ?>
|
||||||
|
<?php foreach ($entities as $entity): ?>
|
||||||
|
<?php $serverPartCellDatas['entity'] = $entity ?>
|
||||||
|
<?php $texts[$type][] = $serverPartCellDatas['helper']->getFieldView($type, $entity->getPK(), $serverPartCellDatas, ['return' => 'onlyText']) ?>
|
||||||
|
<?php endforeach ?>
|
||||||
|
<?php endforeach ?>
|
||||||
|
<?php endforeach ?>
|
||||||
|
<?php $view_texts = [] ?>
|
||||||
|
<?php foreach ($texts as $type => $datas): ?><?php $view_texts[] = implode(',', $datas) ?><?php endforeach ?>
|
||||||
|
<?= implode(" / ", $view_texts) ?>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<?= $this->include("templates/common/" . (isset($viewDatas['modal_type']) ? $viewDatas['modal_type'] : 'modal_iframe')); ?>
|
||||||
Loading…
Reference in New Issue
Block a user