Files
cwsvJudo/homepage/participo/pmelo.php
2024-02-03 20:08:36 +01:00

122 lines
3.9 KiB
PHP

<?php require_once "pmelo.inc.php"; ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- shared imports (common css, MaterializeCss) -->
<?php readfile("shared/imports.php"); ?>
<!-- inits for the materializeCss -->
<script src="index.js"></script>
<title>participo</title>
<meta name="description" content="pmelo">
<link rel="icon" href="<?echo($config['ressourceUrl']);?>/graphiken/icons/cwsv.ico" />
<link rel="apple-touch-icon" href="<?echo($config['baseUrl']);?>/apple-touch-icon.png">
</head>
<body>
<header>
<nav class="indigo darken-4">
<h1 style="display:inline;">cwsvJudo Apps</h1>
<a class="right top-nav sidenav-trigger waves-effect waves-light hide-on-large-only" href="#" data-target="nav-mobile">
<i class="material-icons">menu</i>
</a>
</nav>
<ul class="sidenav sidenav-fixed sidenav-close" id="nav-mobile">
<li class="logo">
<a style="height:auto;" class="brand-logo" id="logo-container" href="/participo/">
<img alt="cwsvJudoApps" style="max-width:100%;height:12vh;" class="responsive-img" src="http://cwsvjudo.bplaced.net/ressourcen/graphiken/logos/cwsvJudoLogoWappen.x256.png" />
</a>
</li>
<?php require_once "sidenav/loginStatus.php"; ?><!-- brings its own li -->
</ul>
</header>
<main>
<h2><a href="pmelo">pmElo</a></h2>
<form id="pmelo-form-fighters" action="pmelo.php" method="post">
<div class="input-field col s12">
<select name ="pmelo[fighterIds][]" id="pmelo-form-fighters-select" multiple>
<option value="" disabled selected>Kämpfer auswählen</option>
<?php foreach ($pmelo->trainees as $trainee) {
echo "<option value=\"" .
$trainee->getId() .
"\">" .
$trainee->getFirstname() .
" " .
$trainee->getName() .
"</option>" .
PHP_EOL;
} ?>
</select>
<label for="form-select-2">Kämpfer auswählen</label>
<input type="submit" value="Liste erstellen">
</div>
</form>
<table>
<thead>
<tr><th>Platz</th><th>Name</th><th>Aufstieg</th></tr>
</thead>
<tbody>
<?php if (!empty($pmelo->fighters)) {
// remember the predecessor for the promoting form
$lastOne = null;
foreach ($pmelo->rankings as $rank => $id) {
if (array_key_exists($id, $pmelo->fighters)) {
$fighter = $pmelo->fighters[$id];
echo "<tr>" .
"<td>" .
$rank .
"</td>" .
"<td>" .
$fighter->getFirstName() .
" " .
$fighter->getName() .
"</td>" .
"<td>" .
(!is_null($lastOne)
? $pmelo->htmlPromoteButton(
$fighter->getId(),
$rank,
$lastOne["id"],
$lastOne["rank"]
)
: "") .
"</td>" .
"</tr>" .
PHP_EOL;
$lastOne = ["id" => $fighter->getId(), "rank" => $rank];
}
}
} ?>
</tbody>
</table>
<ul class="collection with-header">
<li class="collection-header"><h3>Logs</h3></li>
<?php foreach ($pmelo->log as $logLevel => $messages) {
if (!empty($messages)) { ?>
<li class="collection-item">
<ul class="collection with-header">
<li class="collection-header"><?php echo $logLevel; ?></li>
<?php foreach ($messages as $message) { ?>
<li>
<?php echo $message; ?>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>
<?php
} ?>
</ul>
</main>
</body>
</html>