artifacts.php 15 KB

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