artifacts.php 16 KB

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