96 lines
3.0 KiB
PHP
96 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
use App\Models\UserModel;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class UserController extends \App\Controllers\Admin\AdminController
|
|
{
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->_className .= '/User';
|
|
$this->_model = new UserModel();
|
|
$this->_defines = [
|
|
'insert' => [
|
|
'fields' => ['id', 'passwd', 'confirmpassword', 'name', 'email', 'role', 'status'],
|
|
'fieldFilters' => ['role', 'status'],
|
|
'fieldRules' => [
|
|
'id' => 'required|min_length[4]|max_length[20]|is_unique[tw_user.id]',
|
|
'confirmpassword' => 'required|trim|matches[passwd]',
|
|
]
|
|
],
|
|
'update' => [
|
|
'fields' => ['passwd', 'name', 'email', 'role', 'status'],
|
|
'fieldFilters' => ['role', 'status'],
|
|
'fieldRules' => [
|
|
'confirmpassword' => 'required|trim|matches[passwd]',
|
|
]
|
|
],
|
|
'view' => [
|
|
'fields' => ['id', 'name', 'email', 'role', 'status', 'updated_at', 'created_at'],
|
|
'fieldFilters' => ['role', 'status'],
|
|
'fieldRules' => [],
|
|
],
|
|
'index' => [
|
|
'fields' => ['id', 'name', 'email', 'role', 'status', 'created_at'],
|
|
'fieldFilters' => ['role', 'status'],
|
|
'batchjobFilters' => ['role', 'status'],
|
|
],
|
|
'excel' => [
|
|
'fields' => ['id', 'name', 'email', 'role', 'status', 'created_at'],
|
|
'fieldFilters' => ['role', 'status'],
|
|
],
|
|
];
|
|
helper($this->_className);
|
|
$this->_viewPath = strtolower($this->_className);
|
|
$this->_viewDatas['title'] = lang($this->_className . '.title');
|
|
$this->_viewDatas['className'] = $this->_className;
|
|
}
|
|
|
|
////Action 모음
|
|
//Insert관련
|
|
final public function insert()
|
|
{
|
|
return $this->insert_procedure();
|
|
}
|
|
//Update관련
|
|
final public function update($uid)
|
|
{
|
|
return $this->update_procedure($uid);
|
|
}
|
|
//Toggle관련
|
|
final public function toggle($uid, string $field)
|
|
{
|
|
return $this->toggle_procedure($uid, $field);
|
|
}
|
|
//Batchjob 관련
|
|
final public function batchjob()
|
|
{
|
|
return $this->batchjob_procedure();
|
|
}
|
|
//Delete 관련
|
|
final public function delete($uid)
|
|
{
|
|
return $this->delete_procedure($uid);
|
|
}
|
|
//View 관련
|
|
final public function view($uid)
|
|
{
|
|
return $this->view_procedure($uid);
|
|
}
|
|
//Index 관련
|
|
final public function index()
|
|
{
|
|
return $this->index_procedure();
|
|
}
|
|
//Excel 관련
|
|
final public function excel()
|
|
{
|
|
return $this->excel_procedure();
|
|
}
|
|
}
|