Dragon-Knight/templates/left_nav.php

59 lines
2.0 KiB
PHP
Raw Permalink Normal View History

<section>
<div class="title"><img src="/img/button_location.gif" alt="Location" title="Location"></div>
2024-12-17 22:10:49 -06:00
Currently: <?= user()->currentaction ?><br>
<?php
$lat = user()->latitude;
$lon = user()->longitude;
if ($lat < 0) { $lat = ($lat * -1) . "S"; } else { $lat .= "N"; }
if ($lon < 0) { $lon = ($lon * -1) . "W"; } else { $lon .= "E"; }
?>
Latitude: <?= $lat ?><br>
Longitude: <?= $lon ?><br>
<a href="javascript:openmappopup()">View Map</a><br>
<form action="/move" method="post" hx-post="/move" hx-target="#middle" class="move-compass">
<button name="direction" value="north" class="north">North</button>
<div class="mid">
<button name="direction" value="west" class="west">West</button>
<button name="direction" value="east" class="east">East</button>
</div>
<button name="direction" value="south" class="south">South</button>
2024-12-12 18:36:30 -06:00
</form>
</section>
2024-12-13 12:47:29 -06:00
<section>
<div class="title"><img src="/img/button_towns.gif" alt="Towns" title="Towns"></div>
2024-12-17 22:10:49 -06:00
<?php
if (user()->currentaction == 'In Town') {
$town = get_town_by_xy((int) user()->latitude, (int) user()->longitude);
echo "Welcome to <b>{$town['name']}</b>.<br><br>";
}
2024-12-17 22:10:49 -06:00
?>
2024-12-12 18:36:30 -06:00
Travel To:<br>
<?php
$town_list = explode(",", user()->towns);
$towns = db()->query('SELECT * FROM towns ORDER BY id;');
$mapped = false;
while ($row = $towns->fetchArray(SQLITE3_ASSOC)) {
$mapped = true;
if (in_array($row['id'], $town_list)) {
echo <<<HTML
<a href="/gotown/{$row['id']}" hx-get="/gotown/{$row['id']}" hx-target="#middle">{$row['name']}</a><br>
HTML;
}
}
if (!$mapped) echo 'You have no towns mapped.';
?>
2024-12-13 12:47:29 -06:00
</section>
2024-12-13 12:47:29 -06:00
<section>
<div class="title"><img src="/img/button_functions.gif" alt="Functions" title="Functions"></div>
<a href="/" hx-get="/" hx-target="#middle">Home</a><br>
<a href="/forum" hx-get="/forum" hx-target="#middle">Forum</a><br>
<a href="/settings">Settings</a><br>
2024-12-17 22:10:49 -06:00
<?php if (user()->authlevel === 1): ?>
<a href="/admin">Admin</a><br>
<?php endif; ?>
<a href="/help">Help</a><br>
<a href="/logout">Log Out</a>
2024-12-13 12:47:29 -06:00
</section>