| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <?php
- /**
- * Building view.
- *
- * Contains the view layout and some code to present the data
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- * @category View
- * @property Search_Page $page The page model,.
- * @var Search_Page $page The page model,.
- */
- ?>
- <!DOCTYPE html>
- <html lang='en'>
- <head>
- <?=$page->generate_head()?>
- <script>
- function setFormAction(){
- console.log("ON SUBMIT");
- var query = document.getElementById('query').value;
- console.log(query);
- document.getElementById('searchForm').action = '/search/' + query;
-
- }
- </script>
- </head>
- <body>
- <header>
- <?php
- include __DIR__ . "/inc/header_app.php";
- ?>
- </header>
- <aside id='filters' class='content filters'>
- <h2 id='filters_title'>
- Search filters
- </h2>
- <form id='searchForm' action='/search/' onsubmit='setFormAction();'>
- <input id='query' type='text' placeholder='Search...'/>
- <span id='formError'></span>
- <hr/>
- <span id='include'>
- Include...
- </span>
- <table>
- <tr>
- <td>
- <?php
- $checked = "";
- if ($page->get_filter("MONSTER")){
- $checked = "checked";
- }
- ?>
- <input type='checkbox' name='monster' id='filter_monster' <?=$checked?>/>
- <label for='filter_monster'>Monsters</label>
- </td>
- <td>
- <?php
- $checked = "";
- if ($page->get_filter("DUNGEON")){
- $checked = "checked";
- }
- ?>
- <input type='checkbox' name='dungeon' id='filter_dungeon' <?=$checked?>/>
- <label for='filter_dungeon'>Dungeons</label>
- </td>
- </tr>
- <tr>
- <td>
- <?php
- $checked = "";
- if ($page->get_filter("BUILDING")){
- $checked = "checked";
- }
- ?>
- <input type='checkbox' name='building' id='filter_building' <?=$checked?>/>
- <label for='filter_building'>Buildings</label>
- </td>
- <td>
- <?php
- $checked = "";
- if ($page->get_filter("REPORT")){
- $checked = "checked";
- }
- ?>
- <input type='checkbox' name='report' id='filter_report' <?=$checked?>/>
- <label for='filter_report'>Reports</label>
- </td>
- </tr>
- <tr>
- <td>
- <?php
- $checked = "";
- if ($page->get_filter("PLAYER")){
- $checked = "checked";
- }
- ?>
- <input type='checkbox' name='monster' id='filter_player' <?=$checked?>/>
- <label for='filter_monster'>Players</label>
- </td>
- <td>
- <?php
- if (get_context()->get_user() != null){
- $checked = "";
- if ($page->get_filter("UNIT")){
- $checked = "checked";
- }
- ?>
- <input type='checkbox' name='unit' id='filter_unit' <?=$checked?>/>
- <label for='filter_unit'>My units</label>
- <?php
- }
- ?>
- </td>
- </tr>
- <tr>
- <td>
- <?php
- if (get_context()->get_user() != null){
- $checked = "";
- if ($page->get_filter("TEAM")){
- $checked = "checked";
- }
- ?>
- <input type='checkbox' name='team' id='filter_team' <?=$checked?>/>
- <label for='filter_team'>My teams</label>
- <?php
- }
- ?>
- </td>
- <td>
- </td>
- </tr>
- </table>
- <input type='submit' value='Search'/>
- </form>
- </aside>
- <main>
- <section class='content'>
- <h2>
- Results
- </h2>
- <article>
- <?php
- if (sizeof($page->get_results("monster")) > 0){
- ?>
- <h3>
- Monsters
- </h3>
- <div class='result_row'>
- <?php
- foreach($page->get_results("monster") as $monster){
- ?>
- <div class='monster'>
- <a href='/monsters/<?=$monster->get_id()?>'>
- <div class='monster_panel'>
- <?=HTML::unit_panel($monster)?>
- </div>
- </a>
- </div>
- <?php
- }
- ?>
- </div>
- <?php
- }
- if (sizeof($page->get_results("monster")) > 0){
- ?>
- <h3>
- Buildings
- </h3>
- <div class='result_row'>
- <?php
- foreach($page->get_results("building") as $building){
- ?>
- <div class='building'>
- <a href='/building/<?=$building->get_id()?>'>
- <?=HTML::building_panel($building)?>
- </a>
- </div>
- <?php
- }
- ?>
- </div>
- <?php
- }
- ?>
- </article>
- </section>
- </main>
- <?php
- include __DIR__ . "/inc/footer.php";
- ?>
- </body>
- </html>
|