added router->path()

This commit is contained in:
tracer 2022-10-25 15:48:11 +02:00
parent 753b832cbc
commit ab4a00d25c
1 changed files with 18 additions and 26 deletions

View File

@ -1,32 +1,24 @@
<html lang="en">
<head>
<head>
<title>Address Book
<?php if (!empty($user)): ?>
<?php if (!empty($user->getNick())): ?>
&nbsp;-&nbsp;<?= $user->getNick() ?>
<?php endif; ?>
</title>
<link rel="stylesheet" href="/assets/styles/main.css">
</head>
<body>
<h1>Address Book</h1>
<a href="<?= $router->path('app_main'); ?>">🏠 Home</a>
<a href="<?= $router->path('app_admin'); ?>"> Admin</a>
<?php if (empty($user) || $user->getAuth() == \App\Enums\UserAuth::AUTH_ANONYMOUS): ?>
<a href="/login">🚪Login</a>
<?php else: ?>
<a href="/logout">🚪Logout</a>
<?php endif; ?>
<?php
if ($user->getAuth() == \App\Enums\UserAuth::AUTH_ANONYMOUS) {
echo "no";
} else {
echo "yes";
}
?>
<?php if (!empty($user) && !$user->getAuth() == \App\Enums\UserAuth::AUTH_ANONYMOUS): ?>
<h1>Address Book</h1>
<a href="<?= $router->path('app_main'); ?>">🏠 Home</a>
<a href="<?= $router->path('app_admin'); ?>"> Admin</a>
<?php if (empty($user) || $user->getAuth() == \App\Enums\UserAuth::AUTH_ANONYMOUS): ?>
<a href="<?= $router->path('app_login'); ?>">🚪Login</a>
<?php else: ?>
<a href="<?= $router->path('app_logout'); ?>">🚪Logout</a>
<?php endif; ?>
<?php if (!empty($user->getNick())): ?>
<br>
Welcome back, <?= $user->getNick(); ?>
<?php endif; ?>
<?php endif; ?>
<br>