web-base/core/Documents/Admin.class.php

16 lines
422 B
PHP
Raw Normal View History

2020-02-10 00:52:25 +01:00
<?php
2021-12-08 16:53:43 +01:00
namespace Documents;
2020-04-03 15:56:04 +02:00
2021-12-08 16:53:43 +01:00
use Elements\TemplateDocument;
2022-06-01 12:28:50 +02:00
use Objects\Router\Router;
2020-04-03 15:56:04 +02:00
2021-12-08 16:53:43 +01:00
class Admin extends TemplateDocument {
2022-06-01 12:28:50 +02:00
public function __construct(Router $router) {
$user = $router->getUser();
2021-12-08 16:53:43 +01:00
$template = $user->isLoggedIn() ? "admin.twig" : "redirect.twig";
$params = $user->isLoggedIn() ? [] : ["url" => "/login"];
2022-06-01 12:28:50 +02:00
parent::__construct($router, $template, $params);
2021-12-08 16:53:43 +01:00
$this->enableCSP();
2020-02-10 00:52:25 +01:00
}
2020-04-03 15:56:04 +02:00
}