artifacts.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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?>artifacts.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. </head>
  40. <body>
  41. <?php
  42. include __DIR__ . "/inc/header.php";
  43. ?>
  44. <aside class='filters'>
  45. <h2>
  46. Artifacts
  47. </h2>
  48. <p>
  49. Manage your enchantments
  50. </p>
  51. <form action='/<?=$UID?>/artifacts/' method='get' id='filter_artifacts' class='filter'>
  52. <table>
  53. <tr>
  54. <td class='label'>
  55. Element:
  56. </td>
  57. <td>
  58. <select multiple name='element[]' id='filter_element'>
  59. <?php
  60. $reflect = new ReflectionClass("ELEMENT_ID");
  61. foreach($reflect->getConstants() as $name => $id){
  62. if ($id != ELEMENT_ID::PURE){
  63. $selected = "";
  64. if (in_array($id, $page->filters["ELEMENT"])){
  65. $selected = "selected='selected'";
  66. }
  67. ?>
  68. <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
  69. <?php
  70. }
  71. }
  72. ?>
  73. </select>
  74. </td>
  75. <tr>
  76. </tr>
  77. <td class='label'>
  78. Type:
  79. </td>
  80. <td>
  81. <select multiple name='archetype[]' id='filter_archetype'>
  82. <?php
  83. $reflect = new ReflectionClass("ARCHETYPE_ID");
  84. foreach($reflect->getConstants() as $name => $id){
  85. if ($id != ARCHETYPE_ID::NONE && $id != ARCHETYPE_ID::MATERIAL){
  86. $selected = "";
  87. if (in_array($id, $page->filters["ARCHETYPE"])){
  88. $selected = "selected='selected'";
  89. }
  90. ?>
  91. <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
  92. <?php
  93. }
  94. }
  95. ?>
  96. </select>
  97. </td>
  98. </tr>
  99. <tr>
  100. <td class='label'>
  101. Main stat:
  102. </td>
  103. <td>
  104. <select multiple name='main_stat[]' id='filter_main_stat'>
  105. <?php
  106. $reflect = new ReflectionClass("ARTIFACT_STAT_ID");
  107. foreach($reflect->getConstants() as $name => $id){
  108. $selected = "";
  109. if (in_array($id, $page->filters["MAIN"])){
  110. $selected = "selected='selected'";
  111. }
  112. ?>
  113. <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
  114. <?php
  115. }
  116. ?>
  117. </select>
  118. </td>
  119. </tr>
  120. <tr>
  121. <td class='label'>
  122. Level:
  123. </td>
  124. <td>
  125. <input type='number' name='min_level' id='filter_level_min' min='0' max='15' value='<?=$page->filters["MIN_LEVEL"]?>'/>
  126. -
  127. <input type='number' name='max_level' id='filter_level_max' min='0' max='15' value='<?=$page->filters["MAX_LEVEL"]?>'/>
  128. </td>
  129. </tr>
  130. <tr>
  131. <td class='label'>
  132. Quality:
  133. </td>
  134. <td>
  135. <?php
  136. $selected = Array("", "", "", "", "");
  137. $selected[$page->filters["MIN_QUALITY"] - 1] = "selected";
  138. ?>
  139. <select name='min_quality' id='filter_quality_min'>
  140. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  141. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  142. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  143. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  144. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  145. </select>
  146. -
  147. <?php
  148. $selected = Array("", "", "", "", "");
  149. $selected[$page->filters["MAX_QUALITY"] - 1] = "selected";
  150. ?>
  151. <select name='max_quality' id='filter_quality_max'>
  152. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  153. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  154. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  155. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  156. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  157. </select>
  158. </td>
  159. </tr>
  160. <tr>
  161. <td class='label'>
  162. O. quality:
  163. </td>
  164. <td>
  165. <?php
  166. $selected = Array("", "", "", "", "");
  167. $selected[$page->filters["MIN_ORIGINAL_QUALITY"] - 1] = "selected";
  168. ?>
  169. <select name='min_original_quality' id='filter_original_quality_min'>
  170. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  171. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  172. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  173. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  174. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  175. </select>
  176. -
  177. <?php
  178. $selected = Array("", "", "", "", "");
  179. $selected[$page->filters["MAX_ORIGINAL_QUALITY"] - 1] = "selected";
  180. ?>
  181. <select name='max_original_quality' id='filter_original_quality_max'>
  182. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  183. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  184. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  185. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  186. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  187. </select>
  188. </td>
  189. </tr>
  190. <tr>
  191. <td class='label'>
  192. Assigned:
  193. </td>
  194. <td>
  195. <?php
  196. $selected = Array("", "", "", "", "");
  197. $selected[$page->filters["ASSIGNED"]] = "selected";
  198. ?>
  199. <select name='assigned' id='filter_assigned'>
  200. <option value='0' <?=$selected[0]?>>All</option>
  201. <option value='1' <?=$selected[1]?>>Assigned</option>
  202. <option value='2' <?=$selected[2]?>>Unassigned</option>
  203. <option value='3' <?=$selected[3]?>>All (no storage)</option>
  204. <option value='4' <?=$selected[4]?>>Assigned (no storage)</option>
  205. </select>
  206. </td>
  207. </tr>
  208. </table>
  209. <div id='filter_apply'>
  210. <input type='submit' value='Apply'/>
  211. </div>
  212. </form>
  213. </aside> <!-- #filters -->
  214. <main>
  215. <section class='content' id='artifacts'>
  216. <h2>
  217. Artifacts
  218. </h2>
  219. <table>
  220. <?php
  221. $prev_group = "";
  222. $group = "";
  223. $group_title = "";
  224. $group_image = "";
  225. foreach ($page->artifacts as $artifact){
  226. $group = $artifact->type . "-" . $artifact->element . "-" . $artifact->archetype;
  227. if ($prev_group != $group){
  228. switch ($artifact->type){
  229. case ARTIFACT_TYPE::ELEMENT:
  230. switch ($artifact->element){
  231. case ELEMENT_ID::WATER:
  232. $group_title = "Water";
  233. $group_image = URL::IMG["ARTIFACT"] . "element_water.png";
  234. break;
  235. case ELEMENT_ID::FIRE:
  236. $group_title = "Fire";
  237. $group_image = URL::IMG["ARTIFACT"] . "element_fire.png";
  238. break;
  239. case ELEMENT_ID::WIND:
  240. $group_title = "Wind";
  241. $group_image = URL::IMG["ARTIFACT"] . "element_wind.png";
  242. break;
  243. case ELEMENT_ID::LIGHT:
  244. $group_title = "Light";
  245. $group_image = URL::IMG["ARTIFACT"] . "element_light.png";
  246. break;
  247. case ELEMENT_ID::DARK:
  248. $group_title = "Dark";
  249. $group_image = URL::IMG["ARTIFACT"] . "element_dark.png";
  250. break;
  251. }
  252. break;
  253. case ARTIFACT_TYPE::ARCHETYPE:
  254. switch ($artifact->archetype){
  255. case ARCHETYPE_ID::ATTACK:
  256. $group_title = "Attack";
  257. $group_image = URL::IMG["ARTIFACT"] . "type_attack.png";
  258. break;
  259. case ARCHETYPE_ID::DEFENSE:
  260. $group_title = "Defense";
  261. $group_image = URL::IMG["ARTIFACT"] . "type_defense.png";
  262. break;
  263. case ARCHETYPE_ID::SUPPORT:
  264. $group_title = "Support";
  265. $group_image = URL::IMG["ARTIFACT"] . "type_support.png";
  266. break;
  267. case ARCHETYPE_ID::HP:
  268. $group_title = "HP";
  269. $group_image = URL::IMG["ARTIFACT"] . "type_hp.png";
  270. break;
  271. }
  272. }
  273. if ($prev_group == ""){
  274. ?>
  275. <tr>
  276. <td class='header'>
  277. <?php
  278. }
  279. else{
  280. ?>
  281. </td>
  282. </tr>
  283. <tr>
  284. <td class='header'>
  285. <?php
  286. }
  287. $prev_group = $group;
  288. ?>
  289. <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
  290. <span>
  291. <?=$group_title?>
  292. </span>
  293. </td>
  294. </tr>
  295. <tr>
  296. <td>
  297. <?php
  298. }
  299. ?>
  300. <?=HTML::artifact_table($artifact, $artifact->assigned_to)?>
  301. <?php
  302. }
  303. ?>
  304. </td> <!-- Close last group -->
  305. </tr>
  306. </table>
  307. </section>
  308. </main>
  309. <?php
  310. include __DIR__ . "/inc/footer.php";
  311. ?>
  312. </body>
  313. </html>