monsters.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * Catalog view.
  4. *
  5. * Contains the view layout and some 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 Monsters_Page $page The page model,.
  12. * @var Monsters_Page $page The page model,.
  13. */
  14. ?>
  15. <!DOCTYPE html>
  16. <html lang='en'>
  17. <head>
  18. <?=$page->generate_head()?>
  19. </head>
  20. <body>
  21. <header>
  22. <?php
  23. include __DIR__ . "/inc/header_app.php";
  24. ?>
  25. </header>
  26. <aside id='filters' class='content filters'>
  27. <h2 id='filters_title'>
  28. Catalog
  29. </h2>
  30. <p>
  31. A list with every monster in the game.
  32. </p>
  33. <form action='/monsters/' method='get' id='filter_catalog' class='filter'>
  34. <table>
  35. <tr>
  36. <td class='label'>
  37. Element:
  38. </td>
  39. <td>
  40. <?php
  41. $selected = Array("", "", "", "", "");
  42. $selected[$page->get_filter("ELEMENT") - 1] = "selected";
  43. ?>
  44. <select name='element'>
  45. <option value='0'>All</option>
  46. <option value='<?=ELEMENT_ID::WATER?>' <?=$selected[0]?>>Water</option>
  47. <option value='<?=ELEMENT_ID::FIRE?>' <?=$selected[1]?>>Fire</option>
  48. <option value='<?=ELEMENT_ID::WIND?>' <?=$selected[2]?>>Wind</option>
  49. <option value='<?=ELEMENT_ID::LIGHT?>' <?=$selected[3]?>>Light</option>
  50. <option value='<?=ELEMENT_ID::DARK?>' <?=$selected[4]?>>Dark</option>
  51. </select>
  52. </td>
  53. </tr>
  54. <tr>
  55. <td class='label' id='filter_stars'>
  56. Stars:
  57. </td>
  58. <td>
  59. <input type='number' name='min_stars' id='filter_stars_min' min='1' max='5' value='<?=$page->get_filter("MIN_STARS")?>'/>
  60. -
  61. <input type='number' name='max_stars' id='filter_stars_max' min='1' max='5' value='<?=$page->get_filter("MAX_STARS")?>'/>
  62. </td>
  63. </tr>
  64. <tr>
  65. <td class='label'>
  66. Name:
  67. </td>
  68. <td>
  69. <input type='text' name='name' id='filter_name' value='<?=$page->get_filter("NAME")?>'/>
  70. </td>
  71. </tr>
  72. </table>
  73. <input type='submit' value='Apply'/>
  74. </form>
  75. </aside> <!-- #filters -->
  76. <main>
  77. <section id='list' class='list'>
  78. <h2>
  79. Catalog
  80. </h2>
  81. <article>
  82. <?php
  83. $element = "";
  84. foreach ($page->get_monsters() as $monster){
  85. if ($monster->get_element() != $element){
  86. if ($element != ""){
  87. ?>
  88. </article>
  89. <article>
  90. <?php
  91. }
  92. $element = $monster->get_element();
  93. }
  94. ?>
  95. <div class='monster'>
  96. <a href='/monsters/<?=$monster->get_id()?>'>
  97. <div class='monster_panel'>
  98. <?=HTML::unit_panel($monster)?>
  99. </div>
  100. </a>
  101. </div>
  102. <?php
  103. }
  104. ?>
  105. </article>
  106. </section> <!-- #catalog -->
  107. </main>
  108. <?php
  109. include __DIR__ . "/inc/footer.php";
  110. ?>
  111. </body>
  112. </html>