78 lines
2.4 KiB
PHP
78 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
use App\Helpers\MyLogHelper as Helper;
|
|
use App\Services\MyLogService as Service;
|
|
use App\Services\UserService;
|
|
|
|
class MyLogController extends AdminController
|
|
{
|
|
private $_userService = null;
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->uri_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
|
$this->view_path = $this->uri_path;
|
|
$this->title = lang("MyLog.title");
|
|
$this->helper = new Helper($this->request);
|
|
}
|
|
protected function getServiceClass(): Service
|
|
{
|
|
if ($this->service === null) {
|
|
$this->service = new Service($this->request);
|
|
}
|
|
return $this->service;
|
|
}
|
|
public function getUserService(): UserService
|
|
{
|
|
if ($this->_userService === null) {
|
|
$this->_userService = new UserService($this->request);
|
|
}
|
|
return $this->_userService;
|
|
}
|
|
//Index,FieldForm관련
|
|
public function getFields(): array
|
|
{
|
|
return ['class_name', 'method_name', $this->getService()->getModel()::TITLE, 'user_uid', 'status'];
|
|
}
|
|
public function getFilterFields(): array
|
|
{
|
|
return ['user_uid', 'status'];
|
|
}
|
|
public function getBatchJobFields(): array
|
|
{
|
|
return [];
|
|
}
|
|
protected function getFormFieldOption(string $field, array $options = []): array
|
|
{
|
|
switch ($field) {
|
|
case 'user_uid':
|
|
// $this->getUserModel()->where('status', DEFAULTS['STATUS']);
|
|
$options[$field] = $this->getUserService()->getFormFieldOption($field);
|
|
// echo $this->getUserModel()->getLastQuery();
|
|
// dd($options);
|
|
break;
|
|
default:
|
|
$options = parent::getFormFieldOption($field, $options);
|
|
break;
|
|
}
|
|
return $options;
|
|
}
|
|
//Index,FieldForm관련
|
|
|
|
|
|
//View관련
|
|
protected function view_init(string $action, $fields = []): void
|
|
{
|
|
$fields = [
|
|
'fields' => ['user_uid', 'class_name', 'method_name', $this->getService()->getModel()::TITLE, 'created_at', 'status', 'content'],
|
|
];
|
|
parent::view_init($action, $fields);
|
|
}
|
|
}
|