enchantments.php 12 KB

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