hydrate($datas);
}
}
/**
* Get the code to insert directly
*/
public function getcode(): string
{
return '%LIST?' . $this->getquery() . '%';
}
/**
* @param Page[] $pagelist
* @param Page $currentpage
* @param Modelrender $render
* @retrun string HTML formated string
*/
public function listhtml(array $pagelist, Page $currentpage, Modelrender $render): string
{
$this->render = $render;
$li = '';
foreach ($pagelist as $page) {
// ================= Class =============
$classdata = [];
if ($page->id() === $currentpage->id()) {
$classdata['actual'] = 'current_page';
}
$classdata['secure'] = $page->secure('string');
$class = ' class="' . implode(' ', $classdata) . '" ';
// ================ Content
$content = '';
$title = '' . $page->title() . '';
if ($this->description()) {
$content .= '' . $page->description() . '';
}
if ($this->date()) {
$date = $page->date('pdate');
$content .= "\n";
}
if ($this->time()) {
$time = $page->date('ptime');
$content .= "\n";
}
if ($this->author()) {
$content .= $page->authors('string') . PHP_EOL;
}
if ($this->thumbnail) {
if (!empty($page->thumbnail())) {
$src = Model::thumbnailpath() . $page->thumbnail();
} elseif (!empty(Config::defaultthumbnail())) {
$src = Model::thumbnailpath() . Config::defaultthumbnail();
} else {
$src = "";
}
$content .= '';
}
switch ($this->style) {
case 'card':
$li .= $this->li($this->a($title . $content, $class, $page->id()), $page->id());
break;
case 'list':
$li .= $this->li($this->a($title, $class, $page->id()) . $content, $page->id());
break;
}
}
$html = $this->ul($li);
return $html;
}
public function ul(string $content)
{
return '