|
|
|
<?php
|
|
|
|
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
|
use Slim\Views\Twig;
|
|
|
|
|
|
|
|
include "brain/data/Book.inc.php";
|
|
|
|
include "brain/data/Auth.inc.php";
|
|
|
|
|
|
|
|
class DashControl
|
|
|
|
{
|
|
|
|
public static function start(
|
|
|
|
ServerRequestInterface $request,
|
|
|
|
ResponseInterface $response,
|
|
|
|
array $args
|
|
|
|
): ResponseInterface {
|
|
|
|
$view = Twig::fromRequest($request);
|
|
|
|
$pageOptions = [];
|
|
|
|
$auth = new Auth();
|
|
|
|
switch (isset($args["second"]) ? $args["second"] : "index") {
|
|
|
|
case "pages":
|
|
|
|
$content = [];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$book = new Book("content/pages");
|
|
|
|
$pageOptions = [
|
|
|
|
"title" => "Fipamo Dashboard",
|
|
|
|
"status" => $auth->sessionStatus(),
|
|
|
|
"pages" => $book->getContents(),
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $view->render($response, "dash/start.twig", $pageOptions);
|
|
|
|
}
|
|
|
|
}
|