77 lines
1.8 KiB
PHP
77 lines
1.8 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Hura8\Components\Page\Model;
|
||
|
|
|
||
|
|
use Hura8\Interfaces\AppResponse;
|
||
|
|
use Hura8\Interfaces\iEntityModel;
|
||
|
|
use Hura8\Interfaces\EntityType;
|
||
|
|
use Hura8\System\Controller\UrlManagerController;
|
||
|
|
use Hura8\System\Model\aEntityBaseModel;
|
||
|
|
use Hura8\System\ModuleManager;
|
||
|
|
|
||
|
|
class PageModel extends aEntityBaseModel implements iEntityModel
|
||
|
|
{
|
||
|
|
|
||
|
|
protected $richtext_fields = [
|
||
|
|
'content',
|
||
|
|
'content_html',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $tb_page_info = "tb_page_info";
|
||
|
|
|
||
|
|
public function __construct() {
|
||
|
|
parent::__construct(EntityType::PAGE, '', null, $this->richtext_fields);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
protected function extendedFilterOptions() : array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
// empty for now
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public function getFullInfo($id) : ?array
|
||
|
|
{
|
||
|
|
$query = $this->db->runQuery(
|
||
|
|
"SELECT * FROM `".$this->tb_entity."` basic, `".$this->tb_page_info."` info
|
||
|
|
WHERE basic.`id` = info.`page_id` AND basic.id = ?
|
||
|
|
LIMIT 1 ",
|
||
|
|
['d'], [$id]
|
||
|
|
);
|
||
|
|
|
||
|
|
if( $item_info = $this->db->fetchAssoc($query)){
|
||
|
|
return $item_info;
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected function _buildQueryConditionExtend(array $filter_condition): ?array
|
||
|
|
{
|
||
|
|
/*$condition = array(
|
||
|
|
"q" => "",
|
||
|
|
"status" => 0,
|
||
|
|
);*/
|
||
|
|
|
||
|
|
/*$condition = array(
|
||
|
|
"letter" => "",
|
||
|
|
);*/
|
||
|
|
|
||
|
|
$catCondition = [];
|
||
|
|
$bind_types = [];
|
||
|
|
$bind_values = [];
|
||
|
|
|
||
|
|
/*if(isset($filter_condition["letter"]) && strlen($filter_condition["letter"]) == 1){
|
||
|
|
$catCondition[] = " AND `letter` = ? ";
|
||
|
|
$bind_types[] = 's';
|
||
|
|
$bind_values[] = $filter_condition["letter"];
|
||
|
|
}*/
|
||
|
|
|
||
|
|
return array( join(" ", $catCondition), $bind_types, $bind_values);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|