Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 28 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| OlzFilesParams | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| OlzFiles | |
0.00% |
0 / 28 |
|
0.00% |
0 / 4 |
42 | |
0.00% |
0 / 1 |
| hasAccess | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSearchTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSearchResultsWhenHasAccess | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getHtmlWhenHasAccess | |
0.00% |
0 / 25 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Apps\Files\Components\OlzFiles; |
| 4 | |
| 5 | use Olz\Apps\Files\Metadata; |
| 6 | use Olz\Components\Common\OlzRootComponent; |
| 7 | use Olz\Components\Page\OlzFooter\OlzFooter; |
| 8 | use Olz\Components\Page\OlzHeader\OlzHeader; |
| 9 | use Olz\Utils\HttpParams; |
| 10 | |
| 11 | /** @extends HttpParams<array{}> */ |
| 12 | class OlzFilesParams extends HttpParams { |
| 13 | } |
| 14 | |
| 15 | /** @extends OlzRootComponent<array<string, mixed>> */ |
| 16 | class OlzFiles extends OlzRootComponent { |
| 17 | public function hasAccess(): bool { |
| 18 | return true; |
| 19 | } |
| 20 | |
| 21 | public function getSearchTitle(): string { |
| 22 | return 'TODO'; |
| 23 | } |
| 24 | |
| 25 | public function getSearchResultsWhenHasAccess(array $terms): array { |
| 26 | return []; |
| 27 | } |
| 28 | |
| 29 | public function getHtmlWhenHasAccess(mixed $args): string { |
| 30 | $this->httpUtils()->validateGetParams(OlzFilesParams::class); |
| 31 | $base_href = $this->envUtils()->getBaseHref(); |
| 32 | $code_href = $this->envUtils()->getCodeHref(); |
| 33 | |
| 34 | $user = $this->authUtils()->getCurrentUser(); |
| 35 | if (!$user) { |
| 36 | $this->httpUtils()->dieWithHttpError(401); |
| 37 | throw new \Exception('should already have failed'); |
| 38 | } |
| 39 | $user_root = $user->getRoot(); |
| 40 | if (!$user_root) { |
| 41 | $this->httpUtils()->dieWithHttpError(403); |
| 42 | throw new \Exception('should already have failed'); |
| 43 | } |
| 44 | |
| 45 | $out = OlzHeader::render([ |
| 46 | 'back_link' => "{$code_href}service/", |
| 47 | 'title' => "Dateien", |
| 48 | 'norobots' => true, |
| 49 | ]); |
| 50 | |
| 51 | $iframe_url = "{$base_href}/apps/files/artgris/?conf=default&tree=0"; |
| 52 | |
| 53 | $out .= <<<ZZZZZZZZZZ |
| 54 | <div class='content-full'> |
| 55 | <iframe class='files-iframe' src='{$iframe_url}'></iframe> |
| 56 | </div> |
| 57 | ZZZZZZZZZZ; |
| 58 | |
| 59 | $metadata = new Metadata(); |
| 60 | $out .= $metadata->getJsCssImports(); |
| 61 | |
| 62 | $out .= OlzFooter::render(); |
| 63 | |
| 64 | return $out; |
| 65 | } |
| 66 | } |