85 lines
2.9 KiB
PHP
85 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
use App\Helpers\Customer\ServiceHelper;
|
|
use App\Services\Customer\ServicePaymentService;
|
|
|
|
use App\Services\Customer\ServiceService;
|
|
use App\Services\Equipment\CodeService;
|
|
use CodeIgniter\HTTP\RedirectResponse;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class SearchController extends AdminController
|
|
{
|
|
private ?CodeService $_codeService = null;
|
|
private ?ServicePaymentService $_servicePaymentService = null;
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
|
$this->class_path .= $this->getService()->getClassName();
|
|
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
|
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
|
|
|
}
|
|
public function getService(): ServiceService
|
|
{
|
|
if (!$this->_service) {
|
|
$this->_service = new ServiceService();
|
|
}
|
|
return $this->_service;
|
|
}
|
|
public function getHelper(): ServiceHelper
|
|
{
|
|
if (!$this->_helper) {
|
|
$this->_helper = new ServiceHelper();
|
|
}
|
|
return $this->_helper;
|
|
}
|
|
public function getCodeService(): CodeService
|
|
{
|
|
if (!$this->_codeService) {
|
|
$this->_codeService = new CodeService();
|
|
}
|
|
return $this->_codeService;
|
|
}
|
|
public function getServicePaymentService(): ServicePaymentService
|
|
{
|
|
if (!$this->_servicePaymentService) {
|
|
$this->_servicePaymentService = new ServicePaymentService();
|
|
}
|
|
return $this->_servicePaymentService;
|
|
}
|
|
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
|
{
|
|
switch ($this->getAction()) {
|
|
case 'index':
|
|
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'search');
|
|
break;
|
|
default:
|
|
$result = parent::getResultSuccess($message, $actionTemplate);
|
|
break;
|
|
}
|
|
return $result;
|
|
}
|
|
//Index,FieldForm관련
|
|
//List 관련
|
|
protected function index_process(): void
|
|
{
|
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
|
$this->setFilterOptionsByItemType();
|
|
//부모함수처리
|
|
parent::index_process();
|
|
//추가처리
|
|
$entities = [];
|
|
foreach ($this->entities as $entity) {
|
|
//각각의 Item항목 정의
|
|
$entities[$entity->getPK()] = $this->getService()->setItemEntitiesByService($entity);
|
|
}
|
|
$this->entities = $entities;
|
|
}
|
|
}
|