61 lines
2.0 KiB
PHP
61 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin\Equipment\Link;
|
|
|
|
use App\Controllers\Admin\Equipment\EquipmentController;
|
|
|
|
use CodeIgniter\HTTP\RedirectResponse;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
abstract class LinkController extends EquipmentController
|
|
{
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
}
|
|
abstract public function getPartService(): mixed;
|
|
|
|
protected function setOrderByForList()
|
|
{
|
|
//OrderBy 처리
|
|
$this->getService()->getModel()->orderBy('serverinfo_uid', 'ASC', false);
|
|
parent::setOrderByForList();
|
|
}
|
|
|
|
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
|
|
{
|
|
switch ($action) {
|
|
case 'index':
|
|
$this->getHelper()->setViewDatas($this->getViewDatas());
|
|
$result = view($this->view_path . 'popup' . DIRECTORY_SEPARATOR . $action, ['viewDatas' => $this->getViewDatas()]);
|
|
break;
|
|
default:
|
|
$result = parent::getResultPageByActon($action, $message);
|
|
break;
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
protected function getFormFieldOption(string $field, array $options): array
|
|
{
|
|
switch ($field) {
|
|
case 'cpuinfo_uid':
|
|
case 'raminfo_uid':
|
|
case 'diskinfo_uid':
|
|
$temps = [];
|
|
foreach ($this->getPartService()->getEntities() as $entity) {
|
|
$temps[$entity->getPK()] = $entity->getTitle();
|
|
}
|
|
$options[$field] = $temps;
|
|
// dd($options);
|
|
break;
|
|
default:
|
|
$options = parent::getFormFieldOption($field, $options);
|
|
break;
|
|
}
|
|
return $options;
|
|
}
|
|
}
|