67 lines
2.0 KiB
PHP
67 lines
2.0 KiB
PHP
<?php
|
|
require_once("./local/cwsvJudo.config.php");
|
|
require_once("./lib/db.php");
|
|
|
|
$dbConnection = getPdoDbConnection(
|
|
$cwsvJudoConfig["db"]["host"],
|
|
$cwsvJudoConfig["db"]["name"],
|
|
$cwsvJudoConfig["db"]["user"],
|
|
$cwsvJudoConfig["db"]["password"]
|
|
);
|
|
|
|
$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 );
|
|
}
|
|
|
|
if($_POST['action']){
|
|
giveJudokasAttendence($dbConnection, $_POST['attandanceDate'], $_POST['judokaIdsInTraining']);
|
|
header("Location: .");
|
|
}
|
|
|
|
$dateLastWendsday = new DateTime("last wednesday");
|
|
$dateLastFriday = new DateTime("last friday");
|
|
$lastTrainingDay = max($dateLastWendsday, $dateLastFriday);
|
|
|
|
?>
|
|
<html>
|
|
<body>
|
|
<form action="./index.php" method="POST">
|
|
<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">
|
|
</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>
|