trafficmonitor init...2
This commit is contained in:
parent
c44abcceb4
commit
c2abd37cf6
@ -25,18 +25,6 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
|
||||
}
|
||||
|
||||
final public function create_form(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||
return $this->create_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected function create_process(): CommonEntity
|
||||
{
|
||||
// POST 데이터를 DTO 객체로 변환 (getPost()는 POST 요청 본문만 가져옵니다.)
|
||||
@ -49,20 +37,7 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
return $this->action_modal_process("{$this->getTitle()}에서 {$entity->getTitle()} 생성이 완료되었습니다.");
|
||||
}
|
||||
|
||||
final public function create(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->action_init_process(__FUNCTION__);
|
||||
return $this->create_result_process($this->create_process());
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// --- 수정 (Modify) ---
|
||||
|
||||
protected function modify_form_process($uid): CommonEntity
|
||||
{
|
||||
if (!$uid) {
|
||||
@ -80,18 +55,6 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
|
||||
}
|
||||
|
||||
final public function modify_form($uid): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->addViewDatas('entity', $this->modify_form_process($uid));
|
||||
return $this->modify_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected function modify_process($uid): CommonEntity
|
||||
{
|
||||
// POST 데이터를 DTO 객체로 변환
|
||||
@ -104,18 +67,6 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
return $this->action_modal_process("{$this->getTitle()}에서 {$entity->getTitle()} 수정이 완료되었습니다.");
|
||||
}
|
||||
|
||||
final public function modify($uid): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->action_init_process(__FUNCTION__);
|
||||
return $this->modify_result_process($this->modify_process($uid));
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// --- 삭제 (Delete) ---
|
||||
|
||||
protected function delete_process($uid): CommonEntity
|
||||
@ -128,15 +79,6 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
return $this->action_redirect_process('info', "{$this->getTitle()}에서 {$entity->getTitle()} 삭제가 완료되었습니다.");
|
||||
}
|
||||
|
||||
final public function delete($uid): RedirectResponse
|
||||
{
|
||||
try {
|
||||
return $this->delete_result_process($this->delete_process($uid));
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// --- 상세보기 (View) ---
|
||||
|
||||
protected function view_process($uid): CommonEntity
|
||||
@ -155,16 +97,4 @@ abstract class AbstractCRUDController extends AbstractWebController
|
||||
{
|
||||
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
|
||||
}
|
||||
|
||||
final public function view($uid): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->addViewDatas('entity', $this->view_process($uid));
|
||||
return $this->view_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,11 @@
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Entities\CollectorEntity;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CollectorController extends AdminController
|
||||
@ -50,60 +53,163 @@ class CollectorController extends AdminController
|
||||
$this->service->getFormService()->setBatchjobButtons($batchjobButtons);
|
||||
parent::action_init_process($action);
|
||||
}
|
||||
protected function create_process(): CollectorEntity
|
||||
public function create_form(): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::create_process();
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||
return $this->create_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
public function create(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->create_process();
|
||||
if (!$entity instanceof CollectorEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CollectorEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
return $this->create_result_process($entity);
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function modify_form_process($uid): CollectorEntity
|
||||
}
|
||||
public function modify_form($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::modify_form_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_form_process($uid);
|
||||
if (!$entity instanceof CollectorEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CollectorEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function modify_process($uid): CollectorEntity
|
||||
}
|
||||
public function modify($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::modify_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_process($uid);
|
||||
if (!$entity instanceof CollectorEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CollectorEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_result_process($entity);
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function delete_process($uid): CollectorEntity
|
||||
}
|
||||
public function delete($uid): RedirectResponse
|
||||
{
|
||||
$entity = parent::delete_process($uid);
|
||||
try {
|
||||
$entity = $this->delete_process($uid);
|
||||
if (!$entity instanceof CollectorEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CollectorEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
return $this->delete_result_process($entity);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function view_process($uid): CollectorEntity
|
||||
}
|
||||
public function view($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::view_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->view_process($uid);
|
||||
if (!$entity instanceof CollectorEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CollectorEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->view_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function batchjob_process($uid, array $formDatas): CollectorEntity
|
||||
}
|
||||
public function batchjob(): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::batchjob_process($uid, $formDatas);
|
||||
if (!$entity instanceof CollectorEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CollectorEntity만 가능");
|
||||
try {
|
||||
// 사전작업 및 데이터 추출 초기화
|
||||
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||
$this->service->getFormService()->setFormFields($selectedFields);
|
||||
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||
} catch (ValidationException $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function batchjob_delete_process($uid): CollectorEntity
|
||||
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function batchjob_delete(): string|RedirectResponse
|
||||
{
|
||||
$entity = $this->service->delete($uid);
|
||||
if (!$entity instanceof CollectorEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 CollectorEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
try {
|
||||
$uids = $this->batchjob_delete_pre_process();
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_delete_process($uid);
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function index(): string|ResponseInterface
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->index_process($action);
|
||||
$this->index_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
session()->setFlashdata('message', $e->getMessage());
|
||||
}
|
||||
return $this->index_result_process($action);
|
||||
}
|
||||
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
return $this->download_process($action, $output_type, $uid);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
//기본 함수 작업
|
||||
//Custom 추가 함수
|
||||
}
|
||||
|
||||
@ -3,8 +3,11 @@
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Entities\MylogEntity;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class MylogController extends AdminController
|
||||
@ -46,60 +49,163 @@ class MylogController extends AdminController
|
||||
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
||||
parent::action_init_process($action);
|
||||
}
|
||||
protected function create_process(): MylogEntity
|
||||
public function create_form(): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::create_process();
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||
return $this->create_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
public function create(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->create_process();
|
||||
if (!$entity instanceof MylogEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
return $this->create_result_process($entity);
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function modify_form_process($uid): MylogEntity
|
||||
}
|
||||
public function modify_form($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::modify_form_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_form_process($uid);
|
||||
if (!$entity instanceof MylogEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function modify_process($uid): MylogEntity
|
||||
}
|
||||
public function modify($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::modify_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_process($uid);
|
||||
if (!$entity instanceof MylogEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_result_process($entity);
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function delete_process($uid): MylogEntity
|
||||
}
|
||||
public function delete($uid): RedirectResponse
|
||||
{
|
||||
$entity = parent::delete_process($uid);
|
||||
try {
|
||||
$entity = $this->delete_process($uid);
|
||||
if (!$entity instanceof MylogEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
return $this->delete_result_process($entity);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function view_process($uid): MylogEntity
|
||||
}
|
||||
public function view($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::view_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->view_process($uid);
|
||||
if (!$entity instanceof MylogEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->view_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function batchjob_process($uid, array $formDatas): MylogEntity
|
||||
}
|
||||
public function batchjob(): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::batchjob_process($uid, $formDatas);
|
||||
if (!$entity instanceof MylogEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
|
||||
try {
|
||||
// 사전작업 및 데이터 추출 초기화
|
||||
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||
$this->service->getFormService()->setFormFields($selectedFields);
|
||||
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||
} catch (ValidationException $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function batchjob_delete_process($uid): MylogEntity
|
||||
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function batchjob_delete(): string|RedirectResponse
|
||||
{
|
||||
$entity = $this->service->delete($uid);
|
||||
if (!$entity instanceof MylogEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 MylogEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
try {
|
||||
$uids = $this->batchjob_delete_pre_process();
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_delete_process($uid);
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function index(): string|ResponseInterface
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->index_process($action);
|
||||
$this->index_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
session()->setFlashdata('message', $e->getMessage());
|
||||
}
|
||||
return $this->index_result_process($action);
|
||||
}
|
||||
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
return $this->download_process($action, $output_type, $uid);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
//기본 함수 작업
|
||||
//Custom 추가 함수
|
||||
}
|
||||
|
||||
@ -3,8 +3,11 @@
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Entities\TrafficEntity;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class TrafficController extends AdminController
|
||||
@ -47,62 +50,166 @@ class TrafficController extends AdminController
|
||||
$this->service->getFormService()->setActionButtons($actionButtons);
|
||||
parent::action_init_process($action);
|
||||
}
|
||||
protected function create_process(): TrafficEntity
|
||||
public function create_form(): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::create_process();
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||
return $this->create_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
public function create(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->create_process();
|
||||
if (!$entity instanceof TrafficEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 TrafficEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
return $this->create_result_process($entity);
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function modify_form_process($uid): TrafficEntity
|
||||
}
|
||||
public function modify_form($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::modify_form_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_form_process($uid);
|
||||
if (!$entity instanceof TrafficEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 TrafficEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function modify_process($uid): TrafficEntity
|
||||
}
|
||||
public function modify($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::modify_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_process($uid);
|
||||
if (!$entity instanceof TrafficEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 TrafficEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_result_process($entity);
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function delete_process($uid): TrafficEntity
|
||||
}
|
||||
public function delete($uid): RedirectResponse
|
||||
{
|
||||
$entity = parent::delete_process($uid);
|
||||
try {
|
||||
$entity = $this->delete_process($uid);
|
||||
if (!$entity instanceof TrafficEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 TrafficEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
return $this->delete_result_process($entity);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function view_process($uid): TrafficEntity
|
||||
}
|
||||
public function view($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::view_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->view_process($uid);
|
||||
if (!$entity instanceof TrafficEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 TrafficEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->view_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function batchjob_process($uid, array $formDatas): TrafficEntity
|
||||
}
|
||||
public function batchjob(): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::batchjob_process($uid, $formDatas);
|
||||
if (!$entity instanceof TrafficEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 TrafficEntity만 가능");
|
||||
try {
|
||||
// 사전작업 및 데이터 추출 초기화
|
||||
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||
$this->service->getFormService()->setFormFields($selectedFields);
|
||||
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||
} catch (ValidationException $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function batchjob_delete_process($uid): TrafficEntity
|
||||
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function batchjob_delete(): string|RedirectResponse
|
||||
{
|
||||
$entity = $this->service->delete($uid);
|
||||
if (!$entity instanceof TrafficEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 TrafficEntity만 가능");
|
||||
try {
|
||||
$uids = $this->batchjob_delete_pre_process();
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_delete_process($uid);
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function index(): string|ResponseInterface
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->index_process($action);
|
||||
$this->index_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
session()->setFlashdata('message', $e->getMessage());
|
||||
}
|
||||
return $this->index_result_process($action);
|
||||
}
|
||||
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
return $this->download_process($action, $output_type, $uid);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
//기본 함수 작업
|
||||
|
||||
//Custom 추가 함수
|
||||
public function dashboard($uid): string
|
||||
{
|
||||
$entity = $this->service->getEntity($uid);
|
||||
|
||||
@ -3,8 +3,11 @@
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserController extends AdminController
|
||||
@ -48,60 +51,163 @@ class UserController extends AdminController
|
||||
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
||||
parent::action_init_process($action);
|
||||
}
|
||||
protected function create_process(): UserEntity
|
||||
public function create_form(): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::create_process();
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->addViewDatas('formDatas', $this->create_form_process());
|
||||
return $this->create_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
public function create(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->create_process();
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
return $this->create_result_process($entity);
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function modify_form_process($uid): UserEntity
|
||||
}
|
||||
public function modify_form($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::modify_form_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_form_process($uid);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_form_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function modify_process($uid): UserEntity
|
||||
}
|
||||
public function modify($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::modify_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->modify_process($uid);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->modify_result_process($entity);
|
||||
} catch (ValidationException $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function delete_process($uid): UserEntity
|
||||
}
|
||||
public function delete($uid): RedirectResponse
|
||||
{
|
||||
$entity = parent::delete_process($uid);
|
||||
try {
|
||||
$entity = $this->delete_process($uid);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
return $this->delete_result_process($entity);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function view_process($uid): UserEntity
|
||||
}
|
||||
public function view($uid): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::view_process($uid);
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$entity = $this->view_process($uid);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
$this->addViewDatas('entity', $entity);
|
||||
return $this->view_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 상세보기 오류:" . $e->getMessage());
|
||||
}
|
||||
protected function batchjob_process($uid, array $formDatas): UserEntity
|
||||
}
|
||||
public function batchjob(): string|RedirectResponse
|
||||
{
|
||||
$entity = parent::batchjob_process($uid, $formDatas);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
|
||||
try {
|
||||
// 사전작업 및 데이터 추출 초기화
|
||||
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||
$this->service->getFormService()->setFormFields($selectedFields);
|
||||
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||
} catch (ValidationException $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function batchjob_delete_process($uid): UserEntity
|
||||
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function batchjob_delete(): string|RedirectResponse
|
||||
{
|
||||
$entity = $this->service->delete($uid);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \RuntimeException(__METHOD__ . "에서 오류발생:Return Type은 UserEntity만 가능");
|
||||
}
|
||||
return $entity;
|
||||
try {
|
||||
$uids = $this->batchjob_delete_pre_process();
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_delete_process($uid);
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function index(): string|ResponseInterface
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
$this->index_process($action);
|
||||
$this->index_result_process($action);
|
||||
} catch (\Exception $e) {
|
||||
session()->setFlashdata('message', $e->getMessage());
|
||||
}
|
||||
return $this->index_result_process($action);
|
||||
}
|
||||
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
return $this->download_process($action, $output_type, $uid);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
//기본 함수 작업
|
||||
//Custom 추가 함수
|
||||
}
|
||||
|
||||
@ -5,8 +5,6 @@ namespace App\Controllers;
|
||||
use App\Entities\CommonEntity;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\Validation\Exceptions\ValidationException;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
|
||||
@ -87,7 +85,7 @@ abstract class CommonController extends AbstractCRUDController
|
||||
/**
|
||||
* Service에서 엔티티 목록을 가져와 처리합니다. (Override 가능)
|
||||
*/
|
||||
protected function index_process(array $entities = []): array
|
||||
protected function index_entities_process(array $entities = []): array
|
||||
{
|
||||
foreach ($this->service->getEntities() as $entity) {
|
||||
$entities[] = $entity;
|
||||
@ -95,9 +93,6 @@ abstract class CommonController extends AbstractCRUDController
|
||||
return $entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTML View 출력을 처리합니다. (Override 가능)
|
||||
*/
|
||||
protected function index_result_process(string $action): string
|
||||
{
|
||||
return $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
|
||||
@ -106,12 +101,10 @@ abstract class CommonController extends AbstractCRUDController
|
||||
/**
|
||||
* 인덱스(목록) 페이지의 메인 로직입니다.
|
||||
*/
|
||||
final public function index(): string|ResponseInterface
|
||||
protected function index_process(string $action): void
|
||||
{
|
||||
$action = __FUNCTION__;
|
||||
try {
|
||||
// 초기화
|
||||
$this->action_init_process($action);
|
||||
// 현재 URL을 이전 URL 스택에 저장
|
||||
$this->getAuthContext()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
$this->addViewDatas('uri', $this->request->getUri());
|
||||
|
||||
// Paging 설정
|
||||
@ -135,18 +128,9 @@ abstract class CommonController extends AbstractCRUDController
|
||||
$this->service->setOffset(($page - 1) * $perpage);
|
||||
|
||||
// Entities 처리
|
||||
$this->addViewDatas('entities', $this->index_process());
|
||||
$this->addViewDatas('entities', $this->index_entities_process());
|
||||
helper(['form']);
|
||||
$this->addViewDatas('formDatas', $this->request->getVar() ?? []);
|
||||
} catch (\Exception $e) {
|
||||
session()->setFlashdata('message', $e->getMessage());
|
||||
}
|
||||
|
||||
// 현재 URL을 이전 URL 스택에 저장
|
||||
$this->getAuthContext()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
|
||||
// HTML 뷰 렌더링
|
||||
return $this->index_result_process($action);
|
||||
}
|
||||
|
||||
// --- 일괄 작업 (Batch Job) ---
|
||||
@ -192,38 +176,6 @@ abstract class CommonController extends AbstractCRUDController
|
||||
));
|
||||
}
|
||||
|
||||
final public function batchjob(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
// 사전작업 및 데이터 추출
|
||||
list($uids, $selectedFields, $formDatas) = $this->batchjob_pre_process();
|
||||
|
||||
// 초기화
|
||||
$this->service->getFormService()->setFormFields($selectedFields);
|
||||
$this->service->getFormService()->setFormRules(__FUNCTION__, $selectedFields);
|
||||
$this->service->getFormService()->setFormFilters($selectedFields);
|
||||
$this->service->getFormService()->setFormOptions($selectedFields);
|
||||
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_process($uid, $formDatas);
|
||||
} catch (ValidationException $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 검증오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 수정 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
return $this->batchjob_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄작업처리 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// --- 일괄 삭제 (Batch Job Delete) ---
|
||||
|
||||
protected function batchjob_delete_pre_process(): array
|
||||
@ -257,27 +209,6 @@ abstract class CommonController extends AbstractCRUDController
|
||||
return $this->service->delete($uid);
|
||||
}
|
||||
|
||||
final public function batchjob_delete(): string|RedirectResponse
|
||||
{
|
||||
try {
|
||||
$uids = $this->batchjob_delete_pre_process();
|
||||
$entities = [];
|
||||
$errors = [];
|
||||
|
||||
foreach ($uids as $uid) {
|
||||
try {
|
||||
$entities[] = $this->batchjob_delete_process($uid);
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "{$this->getTitle()}에서 {$uid} 삭제 오류:" . $e->getMessage());
|
||||
$errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
return $this->batchjob_delete_result_process($uids, $entities, $errors);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 일괄삭제 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// --- 문서 다운로드 (Download) ---
|
||||
|
||||
protected function downloadByDocumentType(string $document_type, mixed $loaded_data): array
|
||||
@ -308,7 +239,7 @@ abstract class CommonController extends AbstractCRUDController
|
||||
helper(['form']);
|
||||
// 전체 목록을 다운로드하므로, 목록 조건절을 처리합니다.
|
||||
$this->index_condition_process($action);
|
||||
$this->addViewDatas('entities', $this->index_process());
|
||||
$this->addViewDatas('entities', $this->index_entities_process());
|
||||
|
||||
// HTML로 렌더링된 내용을 가져옵니다.
|
||||
$html = $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
|
||||
@ -337,18 +268,4 @@ abstract class CommonController extends AbstractCRUDController
|
||||
}
|
||||
return $this->response->download($full_path, null)->setFileName($file_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 최종 다운로드 액션입니다.
|
||||
*/
|
||||
final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
$action = __FUNCTION__;
|
||||
try {
|
||||
$this->action_init_process($action);
|
||||
return $this->download_process($action, $output_type, $uid);
|
||||
} catch (\Exception $e) {
|
||||
return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user