template.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. $angularSource="ajax.googleapis.com/ajax/libs/angularjs";
  3. $angularVersion="1.5.0";
  4. $this->RegisterJSFile("javascript.js");
  5. $this->RegisterJSFile("controllers/main.js");
  6. $this->RegisterJSFile("directives/equalHeightWidth.js");
  7. $this->RegisterJSFile("directives/scopeInit.js");
  8. function FormatURI(URI $uri, $base=""){
  9. $image=$uri->GetImage();
  10. $imageHTML="";
  11. if ($image!="")
  12. $imageHTML='<img src="'.$uri->GetImage().'" />';
  13. return '<a href="'.$base.$uri->GetLinkLocation().'">'.$imageHTML.$uri->GetText().'</a>';
  14. }
  15. ?>
  16. <?php
  17. {@Init}
  18. ?>
  19. <!DOCTYPE html>
  20. <html ng-app="robware">
  21. <head>
  22. <title>
  23. {@Title}<?php
  24. $__crumbs=Breadcrumbs::GetAll();
  25. foreach ($__crumbs as $crumb)
  26. echo ' &gt; ',$crumb['text'];
  27. ?> | Robware
  28. </title>
  29. <meta charset="UTF-8">
  30. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
  31. <link href="/css/style.css?t=<?= filemtime("css/style.css") ?>" rel="stylesheet" defer />
  32. <link href="/css/style-med.css?t=<?= filemtime("css/style-med.css") ?>" media="(max-width:1023px)" rel="stylesheet" defer />
  33. <link href="/css/style-small.css?t=<?= filemtime("css/style-small.css") ?>" media="(max-width:680px)" rel="stylesheet" defer />
  34. <?php foreach ($this->GetCSSFiles() as $css){
  35. echo '<link href="';
  36. if (strpos($css, "http")===false)
  37. echo '/css/',$css,'?t=', filemtime('css/'.$css);
  38. else
  39. echo $css;
  40. echo '" rel="stylesheet" defer />';
  41. }?>
  42. <style type="text/css">
  43. {@CSS}
  44. </style>
  45. <style media="(max-width:1023px)">
  46. {@CSSMed}
  47. </style>
  48. <style media="(max-width:680px)">
  49. {@CSSSmall}
  50. </style>
  51. <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" defer></script>
  52. <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js" defer></script>
  53. <script type="text/javascript" src="//<?=$angularSource?>/<?=$angularVersion?>/angular.min.js" defer></script>
  54. <script type="text/javascript" src="//<?=$angularSource?>/<?=$angularVersion?>/angular-animate.min.js" defer></script>
  55. <?php foreach ($this->GetJSFiles() as $js){
  56. echo '<script type="text/javascript" src="';
  57. if (strpos($js, "http")===false)
  58. echo '/scripts/',$js,'?t=', filemtime('scripts/'.$js);
  59. else
  60. echo $js;
  61. echo '" defer></script>';
  62. }?>
  63. <script type="text/javascript">
  64. {@JavaScript}
  65. </script>
  66. </head>
  67. <body ng-controller="main" ng-class="{scrollLock: (menuVisible && window.innerWidth < 1024) || spinnerVisible}">
  68. <div id="menu" ng-show="shouldShowMenu()">
  69. <div class="header">
  70. <img src="/images/logo.png" /><h1>Robware</h1>
  71. </div>
  72. <div id="nav-container">
  73. <nav>
  74. <dl>
  75. <?php
  76. $reqUri=trim($_SERVER['REQUEST_URI'],"/");
  77. $uriParts=explode("/",$reqUri);
  78. if ($uriParts[0]=="")
  79. $uriParts[0]="home";
  80. $__controllers=Navigation::Get();
  81. foreach ($__controllers as $controller){
  82. $cURI=$controller->GetURI();
  83. if ($cURI==null)
  84. continue;
  85. echo '<dt';
  86. if ($cURI->GetLinkLocation()=='/'.$uriParts[0])
  87. echo ' class="active"';
  88. echo'>',FormatURI($cURI);
  89. $items=$controller->GetItems();
  90. if (count($items)>0)
  91. echo '<span class="go">&raquo;</span><span class="expand">+</span>';
  92. echo '</dt>';
  93. if (count($items)>0){
  94. echo '<div class="sub-pages">';
  95. foreach ($items as $uri)
  96. echo '<dd>',FormatURI($uri,$cURI->GetLinkLocation().'/'),'</dd>';
  97. echo '</div>';
  98. }
  99. }
  100. ?>
  101. </dl>
  102. </nav>
  103. </div>
  104. </div>
  105. <div id="main">
  106. <div class="header">
  107. <img src="/images/menu.svg" id="menu-button" ng-click="menuVisible=!menuVisible" /><?php // using php tags to remove HTML space but to keep source tidy
  108. ?><h2><?php // Shitty, I know, but eh...
  109. ?><span>{@Title}</span><?php
  110. $__crumbs=Breadcrumbs::GetAll();
  111. foreach ($__crumbs as $crumb)
  112. echo '<span>',$crumb['text'],'</span>';
  113. ?></h2>
  114. </div>
  115. <?php if (isset($errors) && count($errors)>0){
  116. echo '<div class="errors">The following errors were encountered:<ul>';
  117. foreach ($errors as $e)
  118. echo '<li>',$e,'</li>';
  119. echo '</ul>Please rectify them and try again.</div>';
  120. } ?>
  121. <div class="errors" ng-if="errors.length>0">
  122. The following errors were encountered:
  123. <ul>
  124. <li ng-repeat="error in errors">{{error}}</li>
  125. </ul>
  126. Please rectify them and try again.
  127. </div>
  128. <div id="content">
  129. <div id="body">
  130. {@Body}
  131. </div>
  132. <div id="footer">{@Footer}</div>
  133. </div>
  134. <div id="buttons-left">{@ButtonsLeft}</div>
  135. <div id="buttons-right">{@ButtonsRight}</div>
  136. </div>
  137. <div class="backdrop" ng-show="shouldShowMenu()" ng-click="menuVisible=false"></div>
  138. <div id="spinner" class="backdrop" ng-show="spinnerVisible">
  139. <img src="/images/spinner.svg" />
  140. </div>
  141. </body>
  142. </html>