Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 25 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
OlzTerminTemplatesListParams | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
OlzTerminTemplatesList | |
0.00% |
0 / 25 |
|
0.00% |
0 / 3 |
30 | |
0.00% |
0 / 1 |
getSearchTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSearchResults | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getHtml | |
0.00% |
0 / 23 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | namespace Olz\Termine\Components\OlzTerminTemplatesList; |
4 | |
5 | use Olz\Components\Common\OlzRootComponent; |
6 | use Olz\Components\Page\OlzFooter\OlzFooter; |
7 | use Olz\Components\Page\OlzHeader\OlzHeader; |
8 | use Olz\Entity\Termine\TerminTemplate; |
9 | use Olz\Termine\Components\OlzTerminTemplatesListItem\OlzTerminTemplatesListItem; |
10 | use Olz\Utils\HttpParams; |
11 | |
12 | /** @extends HttpParams<array{}> */ |
13 | class OlzTerminTemplatesListParams extends HttpParams { |
14 | } |
15 | |
16 | /** @extends OlzRootComponent<array<string, mixed>> */ |
17 | class OlzTerminTemplatesList extends OlzRootComponent { |
18 | public function getSearchTitle(): string { |
19 | return 'TODO'; |
20 | } |
21 | |
22 | public function getSearchResults(array $terms): array { |
23 | return []; |
24 | } |
25 | |
26 | public function getHtml(mixed $args): string { |
27 | $this->httpUtils()->validateGetParams(OlzTerminTemplatesListParams::class); |
28 | $code_href = $this->envUtils()->getCodeHref(); |
29 | |
30 | if (!$this->authUtils()->hasPermission('termine')) { |
31 | $this->httpUtils()->dieWithHttpError(401); |
32 | throw new \Exception('should already have failed'); |
33 | } |
34 | |
35 | $out = OlzHeader::render([ |
36 | 'back_link' => "{$code_href}termine", |
37 | 'title' => 'Termin-Vorlagen', |
38 | 'description' => "Vorlagen, um OL Zimmerberg-Termine zu erstellen.", |
39 | 'norobots' => true, |
40 | ]); |
41 | |
42 | $out .= <<<ZZZZZZZZZZ |
43 | <div class='content-right'> |
44 | </div> |
45 | <div class='content-middle'> |
46 | <button |
47 | id='create-termin-template-button' |
48 | class='btn btn-secondary' |
49 | onclick='return olz.initOlzEditTerminTemplateModal()' |
50 | > |
51 | <img src='{$code_href}assets/icns/new_white_16.svg' class='noborder' /> |
52 | Neue Vorlage erstellen |
53 | </button> |
54 | <h1>Termin-Vorlagen</h1> |
55 | ZZZZZZZZZZ; |
56 | $termin_template_repo = $this->entityManager()->getRepository(TerminTemplate::class); |
57 | $termin_templates = $termin_template_repo->findBy(['on_off' => 1]); |
58 | foreach ($termin_templates as $termin_template) { |
59 | $out .= OlzTerminTemplatesListItem::render([ |
60 | 'termin_template' => $termin_template, |
61 | ]); |
62 | } |
63 | |
64 | $out .= <<<'ZZZZZZZZZZ' |
65 | </div> |
66 | ZZZZZZZZZZ; |
67 | |
68 | $out .= OlzFooter::render(); |
69 | |
70 | return $out; |
71 | } |
72 | } |