artifacts.php 15 KB

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