forked from projects/fipamo
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
use Psr\Http\Message\ResponseInterface;
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
use Slim\Views\Twig;
|
|
|
|
include "../brain/data/Book.inc.php";
|
|
|
|
class DashControl
|
|
{
|
|
public static function start(
|
|
ServerRequestInterface $request,
|
|
ResponseInterface $response,
|
|
array $args
|
|
): ResponseInterface {
|
|
$view = Twig::fromRequest($request);
|
|
$pageOptions = [];
|
|
$template = "";
|
|
switch (isset($args["second"]) ? $args["second"] : "index") {
|
|
case "pages":
|
|
$data = (new Book("../content/pages"))->getPages(1, 4);
|
|
$template = "dash/book.twig";
|
|
$pageOptions = [
|
|
"entryCount" => $data["entryCount"],
|
|
"filter" => $data["sort"],
|
|
"stats" => $data["stats"],
|
|
"pages" => $data["pages"],
|
|
];
|
|
break;
|
|
default:
|
|
//$_SESSION["TEST"] = "TESTERZ";
|
|
//session_unset();
|
|
$template = "dash/start.twig";
|
|
if (Session::active()) {
|
|
$pageOptions = [
|
|
"title" => "Welcome to Fipamo",
|
|
"status" => Session::active(),
|
|
"data" => (new Book("../content/pages"))->getPages(1, 4),
|
|
];
|
|
} else {
|
|
$pageOptions = [
|
|
"title" => "Welcome to Fipamo",
|
|
"status" => Session::active(),
|
|
];
|
|
}
|
|
break;
|
|
}
|
|
return $view->render($response, $template, $pageOptions);
|
|
}
|
|
}
|