cfmgrv4/app/Controllers/Admin/AdminController.php
2025-03-13 11:25:45 +09:00

108 lines
4.6 KiB
PHP

<?php
namespace App\Controllers\Admin;
use App\Controllers\CommonController;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use CodeIgniter\HTTP\RedirectResponse;
use App\Services\MyLogService;
abstract class AdminController extends CommonController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->layout = "admin";
$this->uri_path = "admin/";
$this->view_path = "admin/";
}
protected function create_process_result($message): RedirectResponse|string
{
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
return parent::create_process_result($message);
// $this->init(__FUNCTION__);
// helper(['form']);
// $this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
// return view(
// strtolower($this->view_path . $this->getService()->getClassPath() . "/create_result"),
// data: ['viewDatas' => $this->getViewDatas()]
// );
}
protected function create_process_failed($message): RedirectResponse|string
{
MyLogService::add("error", $message);
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
return parent::create_process_failed($message);
}
//수정관련
protected function modify_process_result($message): RedirectResponse|string
{
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
return parent::modify_process_result($message);
}
protected function modify_process_failed($message): RedirectResponse|string
{
MyLogService::add("error", $message);
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
return parent::modify_process_failed($message);
}
//단일필드작업
protected function toggle_process_result($message): RedirectResponse|string
{
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
return parent::toggle_process_result($message);
}
protected function toggle_process_failed($message): RedirectResponse|string
{
MyLogService::add("error", $message);
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
return parent::toggle_process_failed($message);
}
//일괄처리작업
protected function batchjob_process_result($message): RedirectResponse|string
{
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
return parent::batchjob_process_result($message);
}
protected function batchjob_process_failed($message): RedirectResponse|string
{
MyLogService::add("error", $message);
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
return parent::batchjob_process_failed($message);
}
//Delete관련
protected function delete_process_result($message): RedirectResponse|string
{
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
return parent::delete_process_result($message);
}
protected function delete_process_failed($message): RedirectResponse|string
{
MyLogService::add("error", $message);
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
return parent::delete_process_failed($message);
}
//일괄삭제관련
protected function batchjob_delete_process_result($message): RedirectResponse|string
{
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, $message, $this->myauth->getUIDByAuthInfo());
return parent::batchjob_delete_process_result($message);
}
protected function batchjob_delete_process_failed($message): RedirectResponse|string
{
MyLogService::add("error", $message);
MyLogService::save($this->getService()->getClassName(), __FUNCTION__, MESSAGES["FAILED"], $this->myauth->getUIDByAuthInfo());
return parent::batchjob_delete_process_failed($message);
}
}