diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php index 6ee692e2..4a55c223 100644 --- a/app/class/Controllerhome.php +++ b/app/class/Controllerhome.php @@ -139,16 +139,14 @@ public function deepsearch(): array return ['regex' => $regex, 'searchopt' => $searchopt]; } - public function listquery() + public function listquery(): void { if (isset($_POST['query']) && $this->user->iseditor()) { $datas = array_merge($_POST, $_SESSION['opt']); - $this->optlist = new Optlist(); - $this->optlist->hydrate($datas); + $this->optlist = new Optlist($datas); if (!empty($this->optlist->bookmark())) { $this->optlist->resetall(); } - $coucou = $this->optlist; } } diff --git a/app/class/Optlist.php b/app/class/Optlist.php index 9bc9344e..ef570a12 100644 --- a/app/class/Optlist.php +++ b/app/class/Optlist.php @@ -2,6 +2,8 @@ namespace Wcms; +use IntlDateFormatter; + class Optlist extends Opt { protected $title = 1; @@ -17,6 +19,11 @@ class Optlist extends Opt /** @var string $bookmark Associated bookmark ID */ protected string $bookmark = ""; + public function __construct(array $datas = []) + { + parent::__construct($datas); + } + public function parsehydrate(string $encoded) { parse_str(ltrim($encoded, "?"), $datas); @@ -63,12 +70,30 @@ public function listhtml(array $pagelist, Page $currentpage, Servicerender $rend $content .= '' . $page->description() . ''; } if ($this->date()) { - $date = $page->date('pdate'); - $content .= "\n"; + $dateattr = $page->date('pdate'); + $formater = new IntlDateFormatter( + $currentpage->lang(), + IntlDateFormatter::SHORT, + IntlDateFormatter::NONE + ); + $date = $formater->format($page->date()); + $formater = new IntlDateFormatter( + $currentpage->lang(), + IntlDateFormatter::FULL, + IntlDateFormatter::NONE + ); + $datetitle = $formater->format($currentpage->date()); + $content .= "\n"; } if ($this->time()) { - $time = $page->date('ptime'); - $content .= "\n"; + $timeattr = $page->date('ptime'); + $formater = new IntlDateFormatter( + $currentpage->lang(), + IntlDateFormatter::NONE, + IntlDateFormatter::SHORT + ); + $time = $formater->format($page->date()); + $content .= "\n"; } if ($this->author()) { $usermanager = new Modeluser();