81 lines
2.6 KiB
PHP
81 lines
2.6 KiB
PHP
<?php
|
|
require_once("./local/cwsvJudo.config.php");
|
|
require_once("./lib/db.php");
|
|
require_once("./lib/api.php");
|
|
|
|
$dbConnection = getPdoDbConnection(
|
|
$cwsvJudoConfig["db"]["host"],
|
|
$cwsvJudoConfig["db"]["name"],
|
|
$cwsvJudoConfig["db"]["user"],
|
|
$cwsvJudoConfig["db"]["password"]
|
|
);
|
|
|
|
processPostData($dbConnection, $_POST);
|
|
|
|
$judokas = getJudokasInTraining($dbConnection, "inTraining");
|
|
|
|
$lastAttendances = getLastAttendances($dbConnection);
|
|
$lastAttendancesAssocArray = array();
|
|
foreach($lastAttendances as $a){
|
|
if(!array_key_exists( $a['date'], $lastAttendancesAssocArray)){
|
|
$lastAttendancesAssocArray[$a['date']] = array();
|
|
}
|
|
array_push( $lastAttendancesAssocArray[ $a['date'] ], $a );
|
|
}
|
|
|
|
$dateLastWendsday = new DateTime("last wednesday");
|
|
$dateLastFriday = new DateTime("last friday");
|
|
$lastTrainingDay = max($dateLastWendsday, $dateLastFriday);
|
|
|
|
?>
|
|
<html>
|
|
<header>
|
|
<!-- Compiled and minified CSS -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
|
|
<!-- Compiled and minified JavaScript -->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
var elems = document.querySelectorAll('select');
|
|
var instances = M.FormSelect.init(elems);
|
|
});
|
|
</script>
|
|
<!--Let browser know website is optimized for mobile-->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
</header>
|
|
<body>
|
|
<form action="./index.php" method="POST">
|
|
<div class="input-field col s12">
|
|
<input id="giveAttendanceAction" name="action" value="giveAttendance" type="hidden" />
|
|
<input id="attendenceDate" name="attandanceDate" value="<?php echo($lastTrainingDay->format("Y-m-d"));?>" />
|
|
<select name="judokaIdsInTraining[]" id="judokaIdsInTraining" multiple>
|
|
<?php foreach($judokas as $j) echo("<option value=\"".$j['userId']."\">".$j['vorname']." ".$j['name']."</option>");?>
|
|
</select>
|
|
<input type="submit" value="Submit">
|
|
</div>
|
|
</form>
|
|
<?php foreach($lastAttendancesAssocArray as $date => $attendees){
|
|
echo("<h2>".$date."</h2>");
|
|
echo("<table border=\"1\">");
|
|
echo("<tr>");
|
|
echo("<th>name</th>");
|
|
echo("<th>vorname</th>");
|
|
echo("<th>PLZ</th>");
|
|
echo("<th>Telefon</th>");
|
|
echo("<th>eMail</th>");
|
|
echo("</tr>");
|
|
foreach($attendees as $a){
|
|
echo("<tr>");
|
|
echo("<td>".$a['name']."</td>");
|
|
echo("<td>".$a['vorname']."</td>");
|
|
echo("<td>".$a['corona_PLZ']."</td>");
|
|
echo("<td>".$a['corona_telephon']."</td>");
|
|
echo("<td>".$a['corona_eMail']."</td>");
|
|
echo("</tr>");
|
|
}
|
|
echo("</table>");
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|