enchantments.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <?php
  2. /**
  3. * Artifacts view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @category View
  8. * @property_read Artifacts_Page $page The page model.
  9. */
  10. ?>
  11. <!DOCTYPE html>
  12. <html lang='en'>
  13. <head>
  14. <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
  15. <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
  16. <title><?=$page->title?></title>
  17. <link rel='shortcut icon' href='<?=$page->favicon?>'/>
  18. <!-- CSS files -->
  19. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
  20. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>enchantments.css'/>
  21. <!-- Meta tags -->
  22. <link rel='canonical' href='<?=$page->canonical?>'/>
  23. <link rel='author' href='<?=$page->author?>'/>
  24. <link rel='publisher' href='<?=$page->author?>'/>
  25. <meta name='description' content='<?=$page->description?>'/>
  26. <meta property='og:title' content='<?=$page->title?>'/>
  27. <meta property='og:url' content='<?=$page->canonical?>'/>
  28. <meta property='og:description' content='<?=$page->description?>'/>
  29. <meta property='og:image' content='<?=$page->icon?>'/>
  30. <meta property='og:site_name' content='<?=$page->name?>'/>
  31. <meta property='og:type' content='website'/>
  32. <meta property='og:locale' content='en'/>
  33. <meta name='twitter:card' content='summary'/>
  34. <meta name='twitter:title' content='<?=$page->title?>'/>
  35. <meta name='twitter:description' content='<?=$page->description?>'/>
  36. <meta name='twitter:image' content='<?=$page->icon?>'/>
  37. <meta name='twitter:url' content='<?=$page->canonical?>'/>
  38. <meta name='robots' content='index follow'/>
  39. <script>
  40. /**
  41. * Hack to treat all type selects as one.
  42. *
  43. * @param clicked Numeric order of the select clicked.
  44. * @param event onMouseDown event.
  45. */
  46. function fixTypeSelect(clicked, event){
  47. if (!event.ctrlKey){
  48. // If controll was not being held, clean all other selects
  49. const selects = document.querySelectorAll('.select_type');
  50. Array.from(selects).forEach((element, index) => {
  51. if (element.id != "select_type_" + clicked){
  52. element.selectedIndex = -1;
  53. }
  54. });
  55. }
  56. }
  57. /**
  58. * Hack to treat all main stat selects as one.
  59. *
  60. * @param clicked Numeric order of the select clicked.
  61. * @param event onMouseDown event.
  62. */
  63. function fixMainSelect(clicked, event){
  64. if (!event.ctrlKey){
  65. // If controll was not being held, clean all other selects
  66. const selects = document.querySelectorAll('.select_main');
  67. Array.from(selects).forEach((element, index) => {
  68. if (element.id != "select_main_" + clicked){
  69. element.selectedIndex = -1;
  70. }
  71. });
  72. }
  73. }
  74. </script>
  75. </head>
  76. <body>
  77. <?php
  78. include __DIR__ . "/inc/header.php";
  79. ?>
  80. <aside class='filters'>
  81. <h2>
  82. Enchantments
  83. </h2>
  84. <p>
  85. Manage your enchantments
  86. </p>
  87. <form action='/<?=$UID?>/enchantments/' method='get' id='filter_artifacts' class='filter'>
  88. <table>
  89. <tr>
  90. <td class='label'>
  91. Type:
  92. </td>
  93. <td>
  94. <select multiple name='type[]' id='filter_type'>
  95. <?php
  96. $selected = "";
  97. if (in_array("GRI", $page->filters["TYPE"])){
  98. $selected = "selected='selected'";
  99. }
  100. ?>
  101. <option value='GRI' <?=$selected?>>Grindstone</option>
  102. <?php
  103. $selected = "";
  104. if (in_array("GEM", $page->filters["TYPE"])){
  105. $selected = "selected='selected'";
  106. }
  107. ?>
  108. <option value='GEM' <?=$selected?>>Gem</option>
  109. </select>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td class='label'>
  114. Quality:
  115. </td>
  116. <td>
  117. <?php
  118. $selected = Array("", "", "", "", "");
  119. $selected[$page->filters["MIN_QUALITY"] - 1] = "selected";
  120. ?>
  121. <select name='min_quality' id='filter_quality_min'>
  122. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  123. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  124. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  125. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  126. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  127. </select>
  128. -
  129. <?php
  130. $selected = Array("", "", "", "", "");
  131. $selected[$page->filters["MAX_QUALITY"] - 1] = "selected";
  132. ?>
  133. <select name='max_quality' id='filter_quality_max'>
  134. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  135. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  136. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  137. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  138. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  139. </select>
  140. </td>
  141. </tr>
  142. <tr>
  143. <td class='label'>
  144. Rune:
  145. </td>
  146. <td class='rune'>
  147. <div>
  148. <select multiple name='rune[]' id='filter_rune'>
  149. <?php
  150. $selected = "";
  151. if (in_array(0, $page->filters["RUNE"])){
  152. $selected = "selected='selected'";
  153. }
  154. ?>
  155. <option value='0' <?=$selected?>>Inmemorial</option>
  156. <?php
  157. $reflect = new ReflectionClass("RUNE_SET_ID");
  158. $i = 1;
  159. $j = 1;
  160. foreach($reflect->getConstants() as $name => $id){
  161. $selected = "";
  162. if (in_array($id, $page->filters["TYPE"])){
  163. $selected = "selected='selected'";
  164. }
  165. $name_format = ucwords(strtolower($name));
  166. if (strlen($name_format) > 9){
  167. $name_format = substr($name_format, 0, 9) . ".";
  168. }
  169. ?>
  170. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  171. <?php
  172. if (($i + 1) % 6 == 0 && ($i + 1) < sizeof($reflect->getConstants())){
  173. ?>
  174. </select><select multiple name='type[]' class='select_type' id='select_type_<?=$j?>' onMouseDown='fixTypeSelect(<?=$j?>, event);'>
  175. <?php
  176. $j ++;
  177. }
  178. $i ++;
  179. }
  180. ?>
  181. </select>
  182. </div>
  183. </td>
  184. </tr>
  185. <tr>
  186. <td class='label'>
  187. Stat:
  188. </td>
  189. <td class='stats'>
  190. <div>
  191. <select multiple name='stat[]' id='filter_stat'>
  192. <?php
  193. $reflect = new ReflectionClass("RUNE_STAT_ID");
  194. $i = 0;
  195. $j = 1;
  196. foreach($reflect->getConstants() as $name => $id){
  197. $selected = "";
  198. if (in_array($id, $page->filters["SUB"])){
  199. $selected = "selected='selected'";
  200. }
  201. $name_format = ucwords(str_replace("_P", "%", $name));
  202. ?>
  203. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  204. <?php
  205. if (($i + 1) % 2 == 0){
  206. ?>
  207. </select><select multiple name='main_stat[]' class='select_sub' id='filter_sub_stat_<?=$j?>' onMouseDown='fixSubSelect(<?=$j?>, event);'>
  208. <?php
  209. $j ++;
  210. }
  211. $i ++;
  212. }
  213. ?>
  214. </select>
  215. </div>
  216. </td>
  217. </tr>
  218. </table>
  219. <div id='filter_apply'>
  220. <input type='submit' value='Apply'/>
  221. </div>
  222. </div>
  223. </form>
  224. </aside> <!-- #filters -->
  225. <main>
  226. <section class='content' id='enchantments'>
  227. <h2>
  228. Enchantments
  229. </h2>
  230. <table>
  231. <?php
  232. $prev_group = "";
  233. $group = "";
  234. $group_title = "";
  235. $group_image = "";
  236. foreach ($page->grindstones as $grindstone){
  237. $group = $grindstone->rune->id . "-" . $grindstone->inmemorial;
  238. if ($prev_group != $group){
  239. if ($grindstone->inmemorial == 1){
  240. $group_title = "Inmemorial";
  241. $group_image = URL::IMG["ICON"] . "star.png";
  242. }
  243. else{
  244. $group_title = $grindstone->rune->name;
  245. $group_image = URL::IMG["RUNE"] . str_pad($grindstone->rune->id, 2, '0', STR_PAD_LEFT) . ".png";
  246. }
  247. if ($prev_group == ""){
  248. ?>
  249. <tr>
  250. <td class='header'>
  251. <?php
  252. }
  253. else{
  254. ?>
  255. </td>
  256. </tr>
  257. <tr>
  258. <td class='header'>
  259. <?php
  260. }
  261. $prev_group = $group;
  262. ?>
  263. <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
  264. <span>
  265. <?=$group_title?>
  266. </span>
  267. </td>
  268. </tr>
  269. <tr>
  270. <td>
  271. <?php
  272. }
  273. ?>
  274. <?=HTML::craft_panel($grindstone)?>
  275. <?php
  276. }
  277. ?>
  278. </td> <!-- Close last group -->
  279. </tr>
  280. </table>
  281. </section>
  282. </main>
  283. <?php
  284. include __DIR__ . "/inc/footer.php";
  285. ?>
  286. </body>
  287. </html>