hydrate($datas); } } /** * Get the code to insert directly */ public function getcode(): string { return '%LIST?' . $this->getquery() . '%'; } public function listhtml(array $pagelist, Page $actualpage, Modelrender $render) { $this->render = $render; $li = ''; foreach ($pagelist as $page) { // ================= Class ============= $classdata = []; if ($page->id() === $actualpage->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()) { $content .= '' . PHP_EOL; } if ($this->time()) { $content .= '' . PHP_EOL; } if ($this->author()) { $content .= $page->authors('string') . PHP_EOL; } if ($this->thumbnail) { $content .= '' . $page->title() . ''; } 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 ''; } public function li(string $content, string $id) { return '
  • ' . PHP_EOL . $content . PHP_EOL . '
  • ' . PHP_EOL; } public function a(string $content, string $class, string $id) { return '' . $content . '' . PHP_EOL; } public function spandescription(Page $page) { if ($this->description) { return '' . $page->description() . ''; } else { return ''; } } // _______________________________________ G E T _____________________________________ public function title() { return $this->title; } public function description() { return $this->description; } public function thumbnail() { return $this->thumbnail; } public function date() { return $this->date; } public function time() { return $this->time; } public function author() { return $this->author; } public function style() { return $this->style; } // _______________________________________ S E T _____________________________________ public function settitle($title) { $this->title = intval($title); } public function setdescription($description) { $this->description = intval($description); } public function setthumbnail($thumbnail) { $this->thumbnail = intval($thumbnail); } public function setdate($date) { $this->date = intval($date); } public function settime($time) { $this->time = intval($time); } public function setauthor($author) { $this->author = intval($author); } public function setstyle($style) { if (is_string($style) && key_exists($style, Model::LIST_STYLES)) { $this->style = $style; } } }