units.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. /**
  3. * Monsters view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @category View
  8. * @var Monsters_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. <?=$page->generate_head()?>
  17. </head>
  18. <body>
  19. <header>
  20. <?php
  21. include __DIR__ . "/inc/header.php";
  22. ?>
  23. </header>
  24. <aside id='filters' class='content filters'>
  25. <h2 id='filters_title'>
  26. Monsters
  27. </h2>
  28. <p>
  29. Filters
  30. </p>
  31. <form action='/player/<?=get_context()->get_player()->get_id()?>/units/' method='get' id='filter_monsters' class='filter'>
  32. <table>
  33. <tr>
  34. <td class='label'>
  35. Element:
  36. </td>
  37. <td class='value'>
  38. <?php
  39. $selected = Array("", "", "", "", "");
  40. $selected[$page->get_filter("ELEMENT") - 1] = "selected";
  41. ?>
  42. <select multiple name='element'>
  43. <option> </option>
  44. <option value='<?=ELEMENT_ID::FIRE?>' <?=$selected[1]?>>Fire</option>
  45. <option value='<?=ELEMENT_ID::WATER?>' <?=$selected[0]?>>Water</option>
  46. <option value='<?=ELEMENT_ID::WIND?>' <?=$selected[2]?>>Wind</option>
  47. <option value='<?=ELEMENT_ID::LIGHT?>' <?=$selected[3]?>>Light</option>
  48. <option value='<?=ELEMENT_ID::DARK?>' <?=$selected[4]?>>Dark</option>
  49. </select>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class='label'>
  54. Stars:
  55. </td>
  56. <td class='value'>
  57. <input type='number' name='min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->get_filter("MIN_STARS")?>'/>
  58. -
  59. <input type='number' name='max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->get_filter("MAX_STARS")?>'/>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class='label'>
  64. Name:
  65. </td>
  66. <td class='value'>
  67. <input type='text' name='name' id='filter_name' value='<?=$page->get_filter("NAME")?>'/>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td class='filter' colspan='2'>
  72. <?php
  73. $checkedStorage = "";
  74. $checkedShrine = "";
  75. $checkedMaterial = "";
  76. if ($page->get_filter("IN_STORAGE")){
  77. $checkedStorage = "checked";
  78. }
  79. if ($page->get_filter("IN_SHRINE")){
  80. $checkedShrine = "checked";
  81. }
  82. if ($page->get_filter("IN_MATERIAL")){
  83. $checkedMaterial = "checked";
  84. }
  85. ?>
  86. <input type='checkbox' name='in_storage' id='filter_in_storage' <?=$checkedStorage?>/>
  87. <label for='filter_in_storage'>Monsters in storage</label>
  88. <input type='checkbox' name='in_shrine' id='filter_in_shrine' <?=$checkedShrine?>/>
  89. <label for='filter_in_storage'>Monsters in the Sealed Shrine</label>
  90. <input type='checkbox' name='in_material' id='filter_in_material' <?=$checkedMaterial?>/>
  91. <label for='filter_in_storage'>Monsters in Enhancing Storage</label>
  92. </td>
  93. </tr>
  94. <tr>
  95. <td class='filter' colspan='2'>
  96. <?php
  97. $checked = "";
  98. if ($page->get_filter("WITHOUT_RUNES")){
  99. $checked = "checked";
  100. }
  101. ?>
  102. <input type='checkbox' name='without_runes' id='filter_without_runes' <?=$checked?>/>
  103. <label for='filter_without_runes'>Monsters without runes</label>
  104. </td>
  105. </tr>
  106. <tr>
  107. <td class='label'>
  108. Effects:
  109. <div class='help_tooltip'>
  110. <p>
  111. Effect the monster can induce. Choose 'All' to search for all of the selected, or 'Any' to search for any of the selected effects.
  112. </p>
  113. </div>
  114. <br/>
  115. <select name='effect_option' id='filter_effect_option'>
  116. <option value='or' <?=($page->get_filter("EFFECT_OPTION") == "or") ? ("selected='selected'") : ("");?>>Any</option>
  117. <option value='and' <?=($page->get_filter("EFFECT_OPTION") == "and") ? ("selected='selected'") : ("");?>>All</option>
  118. </select>
  119. </td>
  120. <td class='value'>
  121. <select multiple name='effect[]' id='filter_effect'>
  122. <?php
  123. foreach ($page->get_effects() as $effect){
  124. if (in_array($effect->get_id(), $page->get_filter("EFFECT"))){
  125. $selected = "selected='selected'";
  126. }
  127. else{
  128. $selected = "";
  129. }
  130. $name = $effect->get_name();
  131. $name = strtoupper($name);
  132. $name = str_replace("INCREASE", "INC.", $name);
  133. $name = str_replace("DECREASE", "DEC.", $name);
  134. $name = str_replace("CRITICAL", "CRIT.", $name);
  135. $name = str_replace("CONTINUOUS", "CONT.", $name);
  136. $name = str_replace("DAMAGE", "DMG.", $name);
  137. $name = str_replace("BENEFICIAL", "BENEF.", $name);
  138. $name = str_replace("BENEFICIAL", "BENEF.", $name);
  139. $name = str_replace("EFFECTS", "EFF.", $name);
  140. $name = str_replace("EFFECT", "EFF.", $name);
  141. ?>
  142. <option value='<?=$effect->get_id()?>' <?=$selected?>><?=$name?></option>
  143. <?php
  144. }
  145. ?>
  146. </select>
  147. </td>
  148. </tr>
  149. </table>
  150. <input type='submit' value='Apply'/>
  151. </form>
  152. </aside> <!-- #filters -->
  153. <main>
  154. <section id='list' class='list'>
  155. <h2>
  156. Monsters
  157. </h2>
  158. <article>
  159. <?php
  160. foreach ($page->get_units() as $unit){
  161. ?>
  162. <div class='monster'>
  163. <a href='/player/<?=get_context()->get_player()->get_id()?>/units/<?=$unit->get_id()?>'>
  164. <div class='monster_panel'>
  165. <?=HTML::unit_panel($unit)?>
  166. </div>
  167. </a>
  168. </div>
  169. <?php
  170. }
  171. ?>
  172. </article>
  173. </section> <!-- #catalog -->
  174. </main>
  175. <?php
  176. include __DIR__ . "/inc/footer.php";
  177. ?>
  178. </body>
  179. </html>