81 lines
2.7 KiB
PHP
81 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
use App\Entities\UserEntity;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class UserController extends AdminController
|
|
{
|
|
public const PATH = 'user';
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
if ($this->service === null) {
|
|
$this->service = service('userservice');
|
|
}
|
|
$this->addActionPaths(self::PATH);
|
|
}
|
|
//Action작업관련
|
|
protected function action_init_process(string $action): void
|
|
{
|
|
$fields = ['id', 'passwd', 'confirmpassword', 'name', 'email', 'mobile', 'role'];
|
|
$filters = ['role', 'status'];
|
|
$batchjobFilters = ['status'];
|
|
switch ($action) {
|
|
case 'create':
|
|
case 'create_form':
|
|
case 'modify':
|
|
case 'modify_form':
|
|
break;
|
|
case 'view':
|
|
$fields = ['id', 'name', 'email', 'mobile', 'role', 'status', 'created_at'];
|
|
break;
|
|
case 'index':
|
|
case 'download':
|
|
$fields = ['id', 'name', 'email', 'mobile', 'role', '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);
|
|
parent::action_init_process($action);
|
|
}
|
|
protected function create_form_process(array $formDatas = []): array
|
|
{
|
|
$formDatas = ['role' => [ROLE['USER']['MANAGER']]];
|
|
return parent::create_form_process($formDatas);
|
|
}
|
|
protected function create_process(): UserEntity
|
|
{
|
|
return parent::create_process();
|
|
}
|
|
protected function modify_form_process($uid): UserEntity
|
|
{
|
|
return parent::modify_form_process($uid);
|
|
}
|
|
protected function modify_process($uid): UserEntity
|
|
{
|
|
return parent::modify_process($uid);
|
|
}
|
|
protected function delete_process($uid): UserEntity
|
|
{
|
|
return parent::delete_process($uid);
|
|
}
|
|
protected function view_process($uid): UserEntity
|
|
{
|
|
return parent::view_process($uid);
|
|
}
|
|
protected function batchjob_process($uid, array $formDatas): UserEntity
|
|
{
|
|
return parent::batchjob_process($uid, $formDatas);
|
|
}
|
|
}
|