building.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * Building 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 Building_Page $page The page model,.
  12. * @var Building_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. <?=$page->get_building()->get_name()?>
  29. </h2>
  30. <p>
  31. <?=HTML::building_panel($page->get_building())?>
  32. <?=$page->get_building()->get_description()?>
  33. </p>
  34. </aside>
  35. <main>
  36. <?php
  37. if ($page->is_decorative()){
  38. ?>
  39. <section class='content'>
  40. <h2>
  41. Levels
  42. </h2>
  43. <article>
  44. <table id='levels'>
  45. <tr>
  46. <th>
  47. Level
  48. </th>
  49. <th>
  50. Bonus
  51. </th>
  52. <th>
  53. Cost
  54. </th>
  55. <tr>
  56. <?php
  57. $bonus = $page->get_building()->get_level_bonus();
  58. $cost = $page->get_building()->get_level_cost();
  59. for ($i = 1; $i <= min([sizeof($bonus), sizeof($cost)]); $i ++){
  60. ?>
  61. <tr class='<?=($i % 2 == 0 ? "even" : "odd")?>'>
  62. <td>
  63. <?=$i?>
  64. </td>
  65. <td>
  66. <?=$bonus[$i]?>
  67. </td>
  68. <td>
  69. <?=$cost[$i]?>
  70. </td>
  71. </tr>
  72. <?php
  73. }
  74. ?>
  75. </table>
  76. </article>
  77. </section>
  78. <?php
  79. }
  80. ?>
  81. </main>
  82. <?php
  83. include __DIR__ . "/inc/footer.php";
  84. ?>
  85. </body>
  86. </html>