| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- /**
- * Site header view.
- *
- * To be included from all views.
- *
- * @category View
- */
- if ($_SESSION['session'] == true && get_context()->get_user() != null){
- $logged_in = true;
- //$user_id = get_context()->get_user()->get_id();
- }
- else{
- $logged_in = false;
- //$user_id = null;
- }
- ?>
- <script>
- function setSearchAction(){
- var query = document.getElementById('app_search_query').value;
- document.getElementById('app_search_form').action = '/search/' + query;
- }
- </script>
- <nav class='menu' id='menu_app'>
- <table>
- <tr>
- <td>
- <h1 id='logo_text'>
- SWDB
- </h1>
- </td>
- <td class='item'>
- <a href='/monsters/'>
- Monsters
- </a>
- </td>
- <td class='item'>
- <a href='/dungeons/'>
- Dungeons
- </a>
- </td>
- <td class='item'>
- <a href='/buildings/'>
- Buildings
- </a>
- </td>
- <td class='item'>
- <a href='/fusion/'>
- Fusion
- </a>
- </td>
- <?php
- if (! $logged_in){
- ?>
- <td class='item'>
- <a href='/login/'>
- Login
- </a>
- </td>
- <td class='item'>
- <a href='/register/'>
- Register
- </a>
- </td>
- <?php
- }
- else{
- ?>
- <td class='item'>
- <a href='/'>
- Account
- </a>
- </td>
- <td class='item'>
- <a href='/action/logout/'>
- Log Out
- </a>
- </td>
- <?php
- }
- ?>
- <td class='item' id='search'>
- <form id='app_search_form' onsubmit='setSearchAction();'>
- <input id='app_search_query' type='text' placeholder='Search...'/>
- <input type='submit' value='Search'/>
- </form>
- </td>
- </tr>
- </table>
- </nav>
|