Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

68 lignes
3.3KB

  1. <?php
  2. declare(strict_types=1);
  3. $navigationItems = [
  4. ['label' => 'Home', 'href' => '/'],
  5. ['label' => 'Campaigns', 'href' => '/campaigns'],
  6. ['label' => 'Campaign Types', 'href' => '/campaign-types'],
  7. ['label' => 'Jobs', 'href' => '/jobs'],
  8. ['label' => 'Job Types', 'href' => '/job-types'],
  9. ];
  10. $currentPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
  11. $currentPath = is_string($currentPath) && $currentPath !== '' ? $currentPath : '/';
  12. $jsVersion = filemtime(__DIR__ . '/../../../public/js/app.js') ?: time();
  13. ?>
  14. <!DOCTYPE html>
  15. <html lang="en">
  16. <head>
  17. <meta charset="UTF-8">
  18. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  19. <title><?= e($pageTitle ?? 'Campaign Tracker') ?></title>
  20. <link rel="preconnect" href="https://fonts.googleapis.com">
  21. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  22. <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&family=IBM+Plex+Sans:wght@400;600&family=Public+Sans:wght@400;600;700;800&display=swap">
  23. <link rel="stylesheet" href="https://unpkg.com/tabulator-tables@6.3.1/dist/css/tabulator.min.css">
  24. <link rel="stylesheet" href="<?= e(asset('css/site.css')) ?>">
  25. <script>window.__csrf = '<?= e(csrf_token()) ?>';</script>
  26. <script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.10/dist/htmx.min.js" integrity="sha384-H5SrcfygHmAuTDZphMHqBJLc3FhssKjG7w/CeCpFReSfwBWDTKpkzPP8c+cLsK+V" crossorigin="anonymous" defer></script>
  27. <script src="https://unpkg.com/tabulator-tables@6.3.1/dist/js/tabulator.min.js" defer></script>
  28. <script src="<?= e(asset('js/app.js')) ?>?v=<?= e((string) $jsVersion) ?>" defer></script>
  29. <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
  30. </head>
  31. <body>
  32. <div class="page-shell">
  33. <header class="site-header">
  34. <div class="container header-inner">
  35. <a class="brand" href="/">
  36. <span class="brand-mark">CT</span>
  37. <span class="brand-copy">
  38. <strong>Campaign Tracker</strong>
  39. <small>PHP MVC</small>
  40. </span>
  41. </a>
  42. <nav class="site-nav" aria-label="Primary navigation">
  43. <?php foreach ($navigationItems as $item): ?>
  44. <?php
  45. $isActive = $item['href'] === '/'
  46. ? $currentPath === '/'
  47. : str_starts_with($currentPath, $item['href']);
  48. ?>
  49. <a class="nav-link<?= $isActive ? ' is-active' : '' ?>" href="<?= e($item['href']) ?>">
  50. <?= e($item['label']) ?>
  51. </a>
  52. <?php endforeach; ?>
  53. <?php if (auth()->check()): ?>
  54. <span class="nav-user"><?= e(auth()->user()?->displayName ?: auth()->user()?->username ?? '') ?></span>
  55. <form method="post" action="/logout" class="nav-logout-form">
  56. <?= csrf_field() ?>
  57. <button type="submit" class="button button-secondary button-sm">Log out</button>
  58. </form>
  59. <?php endif; ?>
  60. </nav>
  61. </div>
  62. </header>

Powered by TurnKey Linux.