79 lines
2.3 KiB
PHP
79 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin\Equipment;
|
|
|
|
use App\Entities\Equipment\ServerEntity;
|
|
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;
|
|
use RuntimeException;
|
|
|
|
class ServerController extends EquipmentController
|
|
{
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
if ($this->service === null) {
|
|
$this->service = service('equipment_serverservice');
|
|
}
|
|
$this->addActionPaths('server');
|
|
}
|
|
protected function action_init_process(string $action): void
|
|
{
|
|
$fields = [
|
|
"code",
|
|
"type",
|
|
"switch",
|
|
"ip",
|
|
"os",
|
|
"title",
|
|
"price",
|
|
"manufactur_at",
|
|
"format_at",
|
|
];
|
|
$filters = [
|
|
"clientinfo_uid",
|
|
"status",
|
|
];
|
|
$batchjobFilters = ['status'];
|
|
// $actionButtons = ['view' => ICONS['SEARCH']];
|
|
// $batchjobButtons = [];
|
|
parent::action_init_process($action);
|
|
switch ($action) {
|
|
case 'create':
|
|
case 'create_form':
|
|
case 'modify':
|
|
case 'modify_form':
|
|
$fields = [...$fields, 'status'];
|
|
break;
|
|
case 'view':
|
|
$fields = [...$fields, 'status', 'created_at'];
|
|
break;
|
|
case 'index':
|
|
case 'download':
|
|
$fields = [...$fields, 'status', 'created_at'];
|
|
break;
|
|
default:
|
|
throw new \Exception("[{$action}] 지원하지 않는 action입니다.");
|
|
// break;
|
|
}
|
|
$this->service->getFormService()->setFormFields($fields);
|
|
$this->service->getFormService()->setFormRules($action, $fields);
|
|
$this->service->getFormService()->setFormFilters($filters);
|
|
$this->service->getFormService()->setFormOptions($filters);
|
|
$this->service->getFormService()->setBatchjobFilters($batchjobFilters);
|
|
// $this->service->getFormService()->setActionButtons($actionButtons);
|
|
// $this->service->getFormService()->setBatchjobButtons($batchjobButtons);
|
|
parent::action_init_process($action);
|
|
}
|
|
protected function getEntityClass(): string
|
|
{
|
|
return ServerEntity::class;
|
|
}
|
|
//기본 함수 작업
|
|
//Custom 추가 함수
|
|
}
|