選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

65 行
3.0KB

  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="stylesheet" href="https://unpkg.com/tabulator-tables@6.3.1/dist/css/tabulator.min.css">
  21. <link rel="stylesheet" href="<?= e(asset('css/site.css')) ?>">
  22. <script>window.__csrf = '<?= e(csrf_token()) ?>';</script>
  23. <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>
  24. <script src="https://unpkg.com/tabulator-tables@6.3.1/dist/js/tabulator.min.js" defer></script>
  25. <script src="<?= e(asset('js/app.js')) ?>?v=<?= e((string) $jsVersion) ?>" defer></script>
  26. <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
  27. </head>
  28. <body>
  29. <div class="page-shell">
  30. <header class="site-header">
  31. <div class="container header-inner">
  32. <a class="brand" href="/">
  33. <span class="brand-mark">CT</span>
  34. <span class="brand-copy">
  35. <strong>Campaign Tracker</strong>
  36. <small>PHP MVC</small>
  37. </span>
  38. </a>
  39. <nav class="site-nav" aria-label="Primary navigation">
  40. <?php foreach ($navigationItems as $item): ?>
  41. <?php
  42. $isActive = $item['href'] === '/'
  43. ? $currentPath === '/'
  44. : str_starts_with($currentPath, $item['href']);
  45. ?>
  46. <a class="nav-link<?= $isActive ? ' is-active' : '' ?>" href="<?= e($item['href']) ?>">
  47. <?= e($item['label']) ?>
  48. </a>
  49. <?php endforeach; ?>
  50. <?php if (auth()->check()): ?>
  51. <span class="nav-user"><?= e(auth()->user()?->displayName ?: auth()->user()?->username ?? '') ?></span>
  52. <form method="post" action="/logout" class="nav-logout-form">
  53. <?= csrf_field() ?>
  54. <button type="submit" class="button button-secondary button-sm">Log out</button>
  55. </form>
  56. <?php endif; ?>
  57. </nav>
  58. </div>
  59. </header>

Powered by TurnKey Linux.