vhost init...2

This commit is contained in:
최준흠 2024-05-14 09:48:09 +09:00
parent c0400c1433
commit 229e7e0fa9
4 changed files with 22 additions and 38 deletions

View File

@ -13,43 +13,27 @@ class CategoryController extends AdminController
{
parent::initController($request, $response, $logger);
$this->_model = new CategoryModel();
$this->_viewDatas['className'] = 'Category';
$this->_viewPath .= strtolower($this->_viewDatas['className']);
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
$this->_viewDatas["className"] = "Category";
$this->_viewPath .= strtolower($this->_viewDatas["className"]);
$this->_viewDatas["title"] = lang($this->_viewDatas["className"] . ".title");
$this->_viewDatas["class_icon"] = CLASS_ICONS[strtoupper($this->_viewDatas["className"])];
helper($this->_viewDatas["className"]);
}
public function getFields(string $action = ""): array
{
$fields = [
'uid',
'name',
"linkurl",
"isaccess",
"isread",
"iswrite",
"isreply",
"isupload",
"isdownload",
"status",
"head",
"tail",
"uid", "name", "linkurl",
"isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"status", "head", "tail",
];
switch ($action) {
case "index":
case "excel":
return [
'name',
"linkurl",
"isaccess",
"isread",
"iswrite",
"isreply",
"isupload",
"isdownload",
"status",
"created_at",
"name", "linkurl",
"isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"status", "created_at",
];
break;
case "view":

View File

@ -8,9 +8,9 @@ return [
'title' => "분류 정보",
'label' => [
'uid' => "분류코드",
'linkurl' => "연결URL",
'parent' => "상단코드",
'name' => "분류제목",
'linkurl' => "LinkURL",
'photo' => "이미지",
'isaccess' => "접속권한",
'isread' => "읽기권한",

View File

@ -180,7 +180,7 @@ abstract class BaseModel extends Model
break;
case 'category_uid':
if (is_null($this->_category_options)) {
$this->_category_options = $this->getCategoryModel()->getOptions(['classname' => $this->_className]);
$this->_category_options = $this->getCategoryModel()->getOptions();
}
$options = $this->_category_options;
break;

View File

@ -11,21 +11,21 @@ class CategoryModel extends BaseHierarchyModel
protected $returnType = CategoryEntity::class;
public function __construct()
{
parent::__construct('Category');
parent::__construct("Category");
$this->allowedFields = [
...$this->allowedFields,
'name', "linkurl", "photo", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"name", "linkurl", "photo", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"head", "tail", "status"
];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
}
public function getTitleField(): string
{
return 'name';
return "name";
}
public function getContentField(): string
{
return 'head';
return "head";
}
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
@ -37,7 +37,7 @@ class CategoryModel extends BaseHierarchyModel
$rules[$field] = "required|trim|string";
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case 'photo':
case "photo":
$rules[$field] = !$action ? "if_exist|string" : "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},300]|max_dims[{$field},2048,768]";
break;
case "isaccess":
@ -80,9 +80,9 @@ class CategoryModel extends BaseHierarchyModel
foreach ($this->getEntitys($conditions) as $entity) {
if ($entity->getHierarchy_Depth() == 1) {
$old = $entity->getPrimaryKey();
$menus[$old] = ['entity' => $entity, 'childs' => []];
$menus[$old] = ["entity" => $entity, "childs" => []];
} else {
$menus[$old]['childs'][] = $entity;
$menus[$old]["childs"][] = $entity;
}
}
return $menus;
@ -99,7 +99,7 @@ class CategoryModel extends BaseHierarchyModel
case "isupload":
case "isdownload":
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
$entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field];
$entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS["DELIMITER_ROLE"], $formDatas[$field]) : $formDatas[$field];
}
break;
case "head":
@ -117,7 +117,7 @@ class CategoryModel extends BaseHierarchyModel
public function getEntity($conditions): CategoryEntity
{
return parent::getEntity($conditions);
return new CategoryEntity(parent::getEntity($conditions)->toArray());
}
public function getEntitys(array $conditions = array()): array
{