View.php 1.06 KB
<?php

final class View
{
    public static function header(string $title): void
    {
        ?><!doctype html>
<html lang="pt-br">
<head>
    <meta charset="utf-8">
    <title><?= htmlspecialchars($title, ENT_QUOTES) ?> - Gestão de Alunos Lab. Informática</title>
    <link rel="stylesheet" href="assets/style.css">
</head>
<body>
<div class="topbar">
    <strong>Gestão de Alunos Lab. Informática</strong>
    <nav>
        <span><?= htmlspecialchars(Auth::currentName() ?? '', ENT_QUOTES) ?></span>
        <a href="dashboard.php">Alunos</a>
        <?php if (Auth::isAdmin()): ?>
            <a href="admins.php">Administradores</a>
            <a href="auditoria.php">Auditoria</a>
            <a href="settings.php">Configurações</a>
        <?php endif; ?>
        <a href="logout.php">Sair</a>
    </nav>
</div>
<div class="container">
<?php
    }

    public static function footer(): void
    {
        ?>
</div>
</body>
</html>
<?php
    }

    public static function escape(?string $value): string
    {
        return htmlspecialchars($value ?? '', ENT_QUOTES);
    }
}