artifacts.php 15 KB

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