servermgrv2 init...
This commit is contained in:
parent
b4e3898fb8
commit
ed4276402e
@ -54,4 +54,11 @@ abstract class BaseHierarchyModel extends BaseModel
|
||||
$entity->grpdepth = $parent_entity->grpdepth + 1;
|
||||
return parent::create_process($entity, $formDatas);
|
||||
}
|
||||
|
||||
public function setIndexOrderBy($field, $order = "DESC")
|
||||
{
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
$this->orderBy("grpno", "DESC");
|
||||
$this->orderBy("grporder", "ASC");
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,6 +49,11 @@ abstract class BaseModel extends Model
|
||||
}
|
||||
$this->validationRules = [];
|
||||
}
|
||||
final public function getPrimaryKey(): string
|
||||
{
|
||||
return $this->primaryKey;
|
||||
}
|
||||
abstract public function getTitle(): string;
|
||||
abstract public function getEntity($uid): BaseEntity;
|
||||
abstract public function getEntitys($conditions): array;
|
||||
abstract public function getFieldFilters(): array;
|
||||
@ -102,11 +107,6 @@ abstract class BaseModel extends Model
|
||||
return $fields;
|
||||
}
|
||||
|
||||
final public function getPrimaryKey()
|
||||
{
|
||||
return $this->primaryKey;
|
||||
}
|
||||
|
||||
final public function getFieldFormOptions($conditions, $options = array()): array
|
||||
{
|
||||
foreach ($this->getEntitys($conditions) as $entity) {
|
||||
@ -226,6 +226,5 @@ abstract class BaseModel extends Model
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = "ASC")
|
||||
{
|
||||
$this->orderBy($field, $order);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,17 +15,21 @@ class BoardConfigModel extends BaseModel
|
||||
$this->allowedFields = [...$this->allowedFields, ...$this->getFields()];
|
||||
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'name';
|
||||
}
|
||||
public function getFields(string $action = ""): array
|
||||
{
|
||||
$fields = [
|
||||
"name", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
|
||||
$this->getTitle(), "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
|
||||
"status", "head", "tail",
|
||||
];
|
||||
switch ($action) {
|
||||
case "index":
|
||||
case "excel":
|
||||
return [
|
||||
"name", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
|
||||
$this->getTitle(), "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
|
||||
"status", "created_at"
|
||||
];
|
||||
break;
|
||||
@ -53,7 +57,7 @@ class BoardConfigModel extends BaseModel
|
||||
$rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
|
||||
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
case "name":
|
||||
case $this->getTitle():
|
||||
$rules[$field] = "required|trim|string";
|
||||
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
@ -120,7 +124,7 @@ class BoardConfigModel extends BaseModel
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike("name", $word, "both"); //befor , after , both
|
||||
$this->orLike($this->getTitle(), $word, "both"); //befor , after , both
|
||||
$this->orLike("isaccess", $word, "both"); //befor , after , both
|
||||
$this->orLike("isread", $word, "both"); //befor , after , both
|
||||
$this->orLike("iswrite", $word, "both"); //befor , after , both
|
||||
@ -130,7 +134,7 @@ class BoardConfigModel extends BaseModel
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = "ASC")
|
||||
{
|
||||
$this->orderBy("name", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
$this->orderBy($this->getTitle(), "ASC");
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,16 +14,20 @@ class BoardModel extends BaseHierarchyModel
|
||||
$this->allowedFields = [...$this->allowedFields, ...$this->getFields(), "user_uid"];
|
||||
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'title';
|
||||
}
|
||||
public function getFields(string $action = ""): array
|
||||
{
|
||||
$fields = ["board_config_uid", "title", "board_file", "passwd", "status", "content"];
|
||||
$fields = ["board_config_uid", $this->getTitle(), "board_file", "passwd", "status", "content"];
|
||||
switch ($action) {
|
||||
case "index":
|
||||
case "excel":
|
||||
return ["board_config_uid", "user_uid", "title", "board_file", "view_cnt", "status", "created_at"];
|
||||
return ["board_config_uid", "user_uid", $this->getTitle(), "board_file", "view_cnt", "status", "created_at"];
|
||||
break;
|
||||
case "view":
|
||||
return ["board_config_uid", "user_uid", "title", "board_file", "view_cnt", "status", "created_at", "content"];
|
||||
return ["board_config_uid", "user_uid", $this->getTitle(), "board_file", "view_cnt", "status", "created_at", "content"];
|
||||
break;
|
||||
default:
|
||||
return $fields;
|
||||
@ -40,7 +44,7 @@ class BoardModel extends BaseHierarchyModel
|
||||
case "board_config_uid":
|
||||
$rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
|
||||
break;
|
||||
case "title":
|
||||
case $this->getTitle():
|
||||
case "content":
|
||||
$rules[$field] = "required|string";
|
||||
break;
|
||||
@ -83,13 +87,12 @@ class BoardModel extends BaseHierarchyModel
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike("title", $word, "both");
|
||||
$this->orLike($this->getTitle(), $word, "both");
|
||||
$this->orLike("content", $word, "both"); //befor , after , both
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = "DESC")
|
||||
public function setIndexOrderBy($field, $order = "ASC")
|
||||
{
|
||||
$this->orderBy("grpno", "DESC");
|
||||
$this->orderBy("grporder", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
$this->orderBy($this->getTitle(), "ASC");
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,16 +14,20 @@ class HPILOModel extends BaseModel
|
||||
$this->allowedFields = [...$this->allowedFields, ...$this->getFields(), 'model', 'processor', 'memory', 'health', 'power', 'detail',];
|
||||
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'customer';
|
||||
}
|
||||
public function getFields(string $action = ""): array
|
||||
{
|
||||
$fields = ['customer', 'ip', 'port', 'id', 'passwd', 'status'];
|
||||
$fields = [$this->getTitle(), 'ip', 'port', 'id', 'passwd', 'status'];
|
||||
switch ($action) {
|
||||
case "index":
|
||||
case "excel":
|
||||
return ['customer', 'ip', 'port', 'model', 'processor', 'memory', 'health', 'power', 'status', 'created_at'];
|
||||
return [$this->getTitle(), 'ip', 'port', 'model', 'processor', 'memory', 'health', 'power', 'status', 'created_at'];
|
||||
break;
|
||||
case "view":
|
||||
return ['customer', 'ip', 'port', 'id', 'model', 'processor', 'memory', 'health', 'power', 'detail', 'status', 'updated_at', 'created_at'];
|
||||
return [$this->getTitle(), 'ip', 'port', 'id', 'model', 'processor', 'memory', 'health', 'power', 'detail', 'status', 'updated_at', 'created_at'];
|
||||
break;
|
||||
default:
|
||||
return $fields;
|
||||
@ -105,11 +109,16 @@ class HPILOModel extends BaseModel
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike('customer', $word, 'both');
|
||||
$this->orLike($this->getTitle(), $word, 'both');
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = 'ASC')
|
||||
{
|
||||
$this->orderBy("health", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = "ASC")
|
||||
{
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
$this->orderBy($this->getTitle(), "ASC");
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,16 +15,20 @@ class UserModel extends BaseModel
|
||||
$this->allowedFields = [...$this->allowedFields, ...$this->getFields()];
|
||||
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'name';
|
||||
}
|
||||
public function getFields(string $action = ""): array
|
||||
{
|
||||
$fields = ["id", "passwd", "name", "email", "role", "status"];
|
||||
$fields = ["id", "passwd", $this->getTitle(), "email", "role", "status"];
|
||||
switch ($action) {
|
||||
case "index":
|
||||
case "excel":
|
||||
return ["id", "name", "email", "role", "status", 'created_at'];
|
||||
return ["id", $this->getTitle(), "email", "role", "status", 'created_at'];
|
||||
break;
|
||||
case "view":
|
||||
return ["id", "name", "email", "role", "status", 'updated_at', 'created_at'];
|
||||
return ["id", $this->getTitle(), "email", "role", "status", 'updated_at', 'created_at'];
|
||||
break;
|
||||
default:
|
||||
return $fields;
|
||||
@ -50,7 +54,7 @@ class UserModel extends BaseModel
|
||||
$rules[$field] = "required|trim|string";
|
||||
$rules["confirmpassword"] = "required|trim|string|matches[passwd]";
|
||||
break;
|
||||
case "name":
|
||||
case $this->getTitle():
|
||||
$rules[$field] = "required|trim|string";
|
||||
break;
|
||||
case "email":
|
||||
@ -103,11 +107,11 @@ class UserModel extends BaseModel
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike("id", $word, "both");
|
||||
$this->orLike("name", $word, "both"); //befor , after , both
|
||||
$this->orLike($this->getTitle(), $word, "both"); //befor , after , both
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = "ASC")
|
||||
{
|
||||
$this->orderBy("name", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
$this->orderBy($this->getTitle(), "ASC");
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,13 +14,17 @@ class UserSNSModel extends BaseModel
|
||||
$this->allowedFields = [...$this->allowedFields, ...$this->getFields(), "user_uid"];
|
||||
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'name';
|
||||
}
|
||||
public function getFields(string $action = ""): array
|
||||
{
|
||||
$fields = ["site", "id", "name", "email", "detail", "status"];
|
||||
$fields = ["site", "id", $this->getTitle(), "email", "detail", "status"];
|
||||
switch ($action) {
|
||||
case "index":
|
||||
case "excel":
|
||||
return ["user_uid", "site", "id", "name", "email", "status", "created_at"];
|
||||
return ["user_uid", "site", "id", $this->getTitle(), "email", "status", "created_at"];
|
||||
break;
|
||||
case "view":
|
||||
return [...$fields, "updated_at", "created_at"];
|
||||
@ -41,7 +45,7 @@ class UserSNSModel extends BaseModel
|
||||
$rules[$field] = "required|trim|string";
|
||||
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
case "name":
|
||||
case $this->getTitle():
|
||||
$rules[$field] = "required|trim|string";
|
||||
break;
|
||||
case "email":
|
||||
@ -82,12 +86,12 @@ class UserSNSModel extends BaseModel
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike("name", $word, "both");
|
||||
$this->orLike($this->getTitle(), $word, "both");
|
||||
$this->orLike("email", $word, "both"); //befor , after , both
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = "ASC")
|
||||
{
|
||||
$this->orderBy("name", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
$this->orderBy($this->getTitle(), "ASC");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user