Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
OlzTermineUpdatesTile | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
getRelevance | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getHtml | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | // ============================================================================= |
4 | // Zeigt eine Startseiten-Kachel mit kürzlich geänderten Terminen an. |
5 | // ============================================================================= |
6 | |
7 | namespace Olz\Startseite\Components\OlzTermineUpdatesTile; |
8 | |
9 | use Olz\Entity\Users\User; |
10 | use Olz\Startseite\Components\AbstractOlzTile\AbstractOlzTile; |
11 | |
12 | class OlzTermineUpdatesTile extends AbstractOlzTile { |
13 | public function getRelevance(?User $user): float { |
14 | return 0.5; |
15 | } |
16 | |
17 | public function getHtml(mixed $args): string { |
18 | $db = $this->dbUtils()->getDb(); |
19 | $code_href = $this->envUtils()->getCodeHref(); |
20 | |
21 | $out = "<h3>Aktualisierte Termine</h3>"; |
22 | |
23 | $out .= "<ul class='links'>"; |
24 | $res = $db->query(<<<'ZZZZZZZZZZ' |
25 | SELECT t.id, t.start_date as date, t.title as title, t.last_modified_at |
26 | FROM termine t |
27 | WHERE t.on_off = '1' AND t.newsletter = '1' |
28 | ORDER BY t.last_modified_at DESC |
29 | LIMIT 5 |
30 | ZZZZZZZZZZ); |
31 | // @phpstan-ignore-next-line |
32 | while ($row = $res->fetch_assoc()) { |
33 | $id = $row['id']; |
34 | // @phpstan-ignore-next-line |
35 | $modified = date('d.m.', strtotime($row['last_modified_at']) ?: 0); |
36 | // @phpstan-ignore-next-line |
37 | $date = date('d.m.', strtotime($row['date']) ?: 0); |
38 | $title = $row['title']; |
39 | $out .= "<li><a href='{$code_href}termine/{$id}' class='linkint'><b>{$modified}</b>: Änderung an {$title} vom {$date}</a></li>"; |
40 | } |
41 | $out .= "</ul>"; |
42 | |
43 | return $out; |
44 | } |
45 | } |