header.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /**
  3. * Site header view.
  4. *
  5. * To be included from all views.
  6. *
  7. * @category View
  8. */
  9. /** @var int $UID User id. */
  10. ?>
  11. <script>
  12. function setMode(rta){
  13. if (rta === true){
  14. mode = <?=GAME_MODE_ID::RTA?>;
  15. }
  16. else if (rta === false){
  17. mode = <?=GAME_MODE_ID::NORMAL?>;
  18. }
  19. else{
  20. return false;
  21. }
  22. params = '?uid=<?=$UID?>&mode=' + mode;
  23. var xhttp = new XMLHttpRequest();
  24. xhttp.onreadystatechange = function() {
  25. if (this.readyState == 4){
  26. if (this.status == 201){
  27. window.location.reload(false);
  28. }
  29. }
  30. };
  31. xhttp.open('GET', '/action/change_game_mode/' + params, true);
  32. xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  33. xhttp.send();
  34. return true;
  35. }
  36. </script>
  37. <header>
  38. <?php
  39. if ($_SESSION['session'] == true){
  40. ?>
  41. <nav id='menu'>
  42. <table>
  43. <tr>
  44. <td rowspan='2'>
  45. <div id='logo'>
  46. <img id='logo_img' src='<?=URL::IMG["LOGO"]?>sw.png' alt=''/>
  47. <h1 id='logo_text'>
  48. <span class='large'>D</span>
  49. <span class='small'>ata</span>
  50. <span class='large'>B</span>
  51. <span class='small'>ase</span>
  52. </h1>
  53. </div>
  54. </td>
  55. <td class='item'>
  56. <a href='/<?=$UID?>/'>
  57. Home
  58. </a>
  59. </td>
  60. <td class='item'>
  61. <a href='/<?=$UID?>/monsters/'>
  62. Monsters
  63. </a>
  64. </td>
  65. <td class='item'>
  66. <a href='/<?=$UID?>/runes/'>
  67. Runes
  68. </a>
  69. </td>
  70. <td class='item'>
  71. <a href='/<?=$UID?>/artifacts/'>
  72. Artifacts
  73. </a>
  74. </td>
  75. <td class='item'>
  76. <a href='/<?=$UID?>/enchantments/'>
  77. Enchantments
  78. </a>
  79. </td>
  80. <td class='item'>
  81. <a href='/<?=$UID?>/teams/'>
  82. Teams
  83. </a>
  84. </td>
  85. <td class='last profile'>
  86. <a href='/<?=$UID?>/profile/'>
  87. <?=$_SESSION['name']?>
  88. </a>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class='item'>
  93. <a href='/<?=$UID?>/catalog/'>
  94. Catalog
  95. </a>
  96. </td>
  97. <td class='item'>
  98. <a href='/<?=$UID?>/fusion/'>
  99. Fusion
  100. </a>
  101. </td>
  102. <td class='item'>
  103. <a href='/<?=$UID?>/guild/'>
  104. Guild
  105. </a>
  106. </td>
  107. <td class='item'>
  108. <a href='/<?=$UID?>/runs/'>
  109. Runs
  110. </a>
  111. </td>
  112. <td class='item'>
  113. <a href='/<?=$UID?>/report/'>
  114. Reports
  115. </a>
  116. </td>
  117. <td class='item'>
  118. <a href='/<?=$UID?>/optimizer/'>
  119. Optimizer
  120. </a>
  121. </td>
  122. <!--<td class='item'>
  123. <a href='/<?=$UID?>/stats/'>
  124. Stats
  125. </a>
  126. </td>-->
  127. <td class='last mode'>
  128. <div id='mode_switch'>
  129. <span class='mode'>
  130. N<span class='desktop'>ormal</span>
  131. </span>
  132. <label class='switch'>
  133. <input type="checkbox" <?=($MODE == GAME_MODE_ID::RTA ? "checked='cheecked'" : "")?> onChange='setMode(this.checked);'/>
  134. <span class="slider round"></span>
  135. </label>
  136. <span class='mode'>
  137. R<span class='desktop'>TA</span>
  138. </span>
  139. </div>
  140. </td>
  141. </tr>
  142. </table>
  143. </nav>
  144. <?php
  145. }
  146. ?>
  147. </header>