2025-01-31 18:20:13 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
namespace openvk\Web\Presenters;
|
2025-01-31 18:20:13 +03:00
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
use openvk\Web\Models\Repositories\ContentSearchRepository;
|
|
|
|
|
|
|
|
final class ContentSearchPresenter extends OpenVKPresenter
|
|
|
|
{
|
|
|
|
private $repo;
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function __construct(ContentSearchRepository $repo)
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
|
|
|
$this->repo = $repo;
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function renderIndex(): void
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
2020-06-07 19:04:43 +03:00
|
|
|
$this->template->results = $repo->find([
|
|
|
|
"query" => $this->postParam("query"),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|