template.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. function FormatURI(URI $uri, $base=""){
  3. $image=$uri->GetImage();
  4. $imageHTML="";
  5. if ($image!="")
  6. $imageHTML='<img src="'.$uri->GetImage().'" />';
  7. return '<a href="'.$base.$uri->GetLinkLocation().'">'.$imageHTML.$uri->GetText().'</a>';
  8. }
  9. ?>
  10. <!DOCTYPE html>
  11. <html>
  12. <head>
  13. <title>
  14. {@Title}<?php
  15. $__crumbs=Breadcrumbs::GetAll();
  16. foreach ($__crumbs as $crumb)
  17. echo ' &gt; ',$crumb['text'];
  18. ?> | Robware
  19. </title>
  20. <meta charset="UTF-8">
  21. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
  22. <style type="text/css">
  23. <?= file_get_contents("css/style.css")?>
  24. {@CSS}
  25. </style>
  26. <style media="(max-width:1023px)">
  27. <?= file_get_contents("css/style-med.css")?>
  28. {@CSSMed}
  29. </style>
  30. <style media="(max-width:680px)">
  31. <?= file_get_contents("css/style-small.css")?>
  32. {@CSSSmall}
  33. </style>
  34. <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  35. <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
  36. <script>
  37. <?= file_get_contents("javascript.js"); ?>
  38. </script>
  39. <script type="text/javascript">
  40. {@JavaScript}
  41. </script>
  42. </head>
  43. <body>
  44. <div id="main-header">
  45. <div class="header">
  46. <img src="/images/menu.svg" id="menu-button" /><?php // using php tags to remove HTML space but to keep source tidy
  47. ?><h2><?php // Shitty, I know, but eh...
  48. ?><span>{@Title}</span><?php
  49. $__crumbs=Breadcrumbs::GetAll();
  50. foreach ($__crumbs as $crumb)
  51. echo '<span>',$crumb['text'],'</span>';
  52. ?></h2>
  53. </div>
  54. </div>
  55. <div id="menu">
  56. <div class="header">
  57. <img src="/images/logo.png" /><h1>Robware</h1>
  58. </div>
  59. <div id="nav-container">
  60. <nav>
  61. <dl>
  62. <?php
  63. $reqUri=trim($_SERVER['REQUEST_URI'],"/");
  64. $uriParts=explode("/",$reqUri);
  65. if ($uriParts[0]=="")
  66. $uriParts[0]="home";
  67. $__controllers=Navigation::Get();
  68. foreach ($__controllers as $controller){
  69. $cURI=$controller->GetURI();
  70. if ($cURI==null)
  71. continue;
  72. echo '<dt';
  73. if ($cURI->GetLinkLocation()=='/'.$uriParts[0])
  74. echo ' class="active"';
  75. echo'>',FormatURI($cURI);
  76. $items=$controller->GetItems();
  77. if (count($items)>0)
  78. echo '<span class="go">&raquo;</span><span class="expand">+</span>';
  79. echo '</dt>';
  80. if (count($items)>0){
  81. echo '<div class="sub-pages">';
  82. foreach ($items as $uri)
  83. echo '<dd>',FormatURI($uri,$cURI->GetLinkLocation().'/'),'</dd>';
  84. echo '</div>';
  85. }
  86. }
  87. ?>
  88. </dl>
  89. </nav>
  90. </div>
  91. </div>
  92. <div id="main">
  93. <div id="buttons">
  94. <table>
  95. <tr>
  96. <td>{@ButtonsLeft}</td>
  97. <td>{@ButtonsRight}</td>
  98. </tr>
  99. </table>
  100. </div>
  101. <div id="content">
  102. <?php if (isset($errors) && count($errors)>0){
  103. echo '<div class="errors">The following errors were encountered:<ul>';
  104. foreach ($errors as $e)
  105. echo '<li>',$e,'</li>';
  106. echo '</ul>Please rectify them and try again.</div>';
  107. } ?>
  108. {@Body}
  109. </div>
  110. <div id="footer">{@Footer}</div>
  111. </div>
  112. <?php if (!isset($_COOKIE['cookiePopupConfirmed']) || $_COOKIE['cookiePopupConfirmed']!=true) { ?>
  113. <div id="cookiePopup">
  114. <p>This site uses cookies. Please leave if you're not OK with this.</p>
  115. <p>In a hilarious twist of irony, we have to store a cookie to stop this popup appearing on every page.</p>
  116. <div>
  117. <button>OK</button>
  118. </div>
  119. </div>
  120. <?php }?>
  121. <div class="backdrop"></div>
  122. </body>
  123. </html>