52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin;
|
|
|
|
use App\Models\CategoryModel;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class CategoryController extends AdminController
|
|
{
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
$this->_model = new CategoryModel();
|
|
parent::initController($request, $response, $logger);
|
|
$this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
|
|
$this->_viewPath .= strtolower($this->_model->getClassName());
|
|
helper($this->_model->getClassName());
|
|
}
|
|
|
|
public function getFields(string $action = ""): array
|
|
{
|
|
$fields = [
|
|
'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
|
|
"status", "head", "tail",
|
|
];
|
|
switch ($action) {
|
|
case "index":
|
|
case "excel":
|
|
return [
|
|
'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
|
|
"status", "created_at"
|
|
];
|
|
break;
|
|
case "view":
|
|
return [...$fields, "updated_at", "created_at"];
|
|
break;
|
|
default:
|
|
return $fields;
|
|
break;
|
|
}
|
|
}
|
|
public function getFieldFilters(): array
|
|
{
|
|
return ["isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "status"];
|
|
}
|
|
public function getFieldBatchFilters(): array
|
|
{
|
|
return parent::getFieldBatchFilters();
|
|
}
|
|
}
|