open POST /api/texts and node create endpoints to any
authenticated user; expose new /texts and /texts/{id} pages
plus admin-only GET /api/texts/all. ViewController gains
userTexts and userText methods. seed gives Tanach to the
regular user and adds a second non-admin user.
90 lines
2.2 KiB
PHP
90 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\View;
|
|
|
|
use Psr\Http\Message\ResponseInterface as Response;
|
|
|
|
class ViewController
|
|
{
|
|
public function admin(Response $response): Response
|
|
{
|
|
$html = file_get_contents(__DIR__ . '/../../views/templates/admin.php', true);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
|
|
public function texts(Response $response): Response
|
|
{
|
|
$html = file_get_contents(__DIR__ . '/../../views/templates/texts.php', true);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
|
|
public function text(Response $response): Response
|
|
{
|
|
$html = file_get_contents(__DIR__ . '/../../views/templates/text.php', true);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
|
|
public function userTexts(Response $response): Response
|
|
{
|
|
$html = file_get_contents(
|
|
__DIR__ . '/../../views/templates/userTexts.php'
|
|
);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
|
|
public function userText(Response $response): Response
|
|
{
|
|
$html = file_get_contents(
|
|
__DIR__ . '/../../views/templates/userText.php'
|
|
);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
|
|
public function home(Response $response): Response
|
|
{
|
|
$html = file_get_contents(__DIR__ . '/../../views/templates/home.php', true);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
|
|
public function today(Response $response): Response
|
|
{
|
|
$html = file_get_contents(
|
|
__DIR__ . '/../../views/templates/today.php'
|
|
);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
|
|
public function login(Response $response): Response
|
|
{
|
|
$html = file_get_contents(
|
|
__DIR__ . '/../../views/templates/login.php'
|
|
);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
|
|
public function register(Response $response): Response
|
|
{
|
|
$html = file_get_contents(
|
|
__DIR__ . '/../../views/templates/register.php'
|
|
);
|
|
$response->getBody()->write($html);
|
|
|
|
return $response;
|
|
}
|
|
}
|