dbmsv2/app/Controllers/Admin/Equipment/ServerController.php
2025-08-21 16:53:01 +09:00

61 lines
2.0 KiB
PHP

<?php
namespace App\Controllers\Admin\Equipment;
use App\Helpers\Equipment\ServerHelper;
use App\Services\Equipment\ServerService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class ServerController extends EquipmentController
{
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;
$this->partinfo_cnt_range = array_combine(range(1, 10), range(1, 10));
$this->partinfo_extra_options = array_merge(["" => "RAID 선택"], lang("{$this->getService()->getClassName()}.EXTRAS"));
}
public function getService(): ServerService
{
if (!$this->_service) {
$this->_service = new ServerService();
}
return $this->_service;
}
public function getHelper(): ServerHelper
{
if (!$this->_helper) {
$this->_helper = new ServerHelper();
}
return $this->_helper;
}
//Index,FieldForm관련
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
{
switch ($this->getAction()) {
case 'index':
case 'view':
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'server');
break;
default:
$result = parent::getResultSuccess($message, $actionTemplate);
break;
}
return $result;
}
//생성
protected function create_form_process(): void
{
$this->setDefaultValue('code', $this->getService()->getLastestCode());
parent::create_form_process();
}
}