113 lines
5.3 KiB
PHP
113 lines
5.3 KiB
PHP
<?php
|
|
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
|
|
|
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 = getUsersWithAttribute($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("wednesday this week");
|
|
$dateLastFriday = new DateTime("friday this week");
|
|
$lastTrainingDay = max($dateLastWendsday, $dateLastFriday);
|
|
?>
|
|
<html lang="de">
|
|
<header>
|
|
<!-- Compiled and minified CSS -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@materializecss/materialize@1.1.0-alpha/dist/css/materialize.min.css">
|
|
<!-- Compiled and minified JavaScript -->
|
|
<script src="https://cdn.jsdelivr.net/npm/@materializecss/materialize@1.1.0-alpha/dist/js/materialize.min.js"></script>
|
|
<!-- Inits for materializecss-->
|
|
<?php include_once("lib/mams/materializeInit.php");?>
|
|
<!--Let browser know website is optimized for mobile-->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
|
|
<title>Corona-Anwesenheitsliste der Judoka des Chemnitzer WSV</title>
|
|
</header>
|
|
<body>
|
|
<!-- sidenav for mams-->
|
|
<?php include_once("lib/mams/sidenav.php");?>
|
|
<h2 id="addAttendences">Anwesenheiten hinzufügen</h2>
|
|
|
|
<form action="./index.php" method="POST">
|
|
<div class="input-field">
|
|
<input id="giveAttendanceAction" name="action" value="giveAttendance" type="hidden" />
|
|
<input id="attendenceDate" name="attandanceDate" value="<?php echo($lastTrainingDay->format("Y-m-d"));?>" type="text" class="datepicker"/>
|
|
<select name="judokaIdsInTraining[]" id="judokaIdsInTraining" multiple><option value="" disabled selected>Anwesende auswählen</option>
|
|
<?php foreach($judokas as $j) echo("<option value=\"".$j['userId']."\">".$j['vorname']." ".$j['name']."</option>");?>
|
|
</select>
|
|
<input type="submit" value="Submit">
|
|
</div>
|
|
</form>
|
|
|
|
<h2 id="addCoronaUser">Corona-Trainee hinzufügen</h2>
|
|
<?php
|
|
if( array_key_exists('addCoronaUserSuccess', $_GET) ){
|
|
if($_GET['addCoronaUserSuccess'] == "true"){
|
|
echo("<div>Added user.</div>");
|
|
}else{
|
|
echo("<div>ERROR</div>");
|
|
}
|
|
}
|
|
?>
|
|
<form action="." method="POST">
|
|
<input name="action" value="addCoronaUser" type="hidden" />
|
|
<input placeholder="Name" name="name" type="text" />
|
|
<input placeholder="Vorname" name="vorname" type="text" />
|
|
<input placeholder="PLZ" name="corona_PLZ" type ="text" />
|
|
<input placeholder="Telefon" name="corona_telephon" type="tel" />
|
|
<input placeholder="eMail" name="corona_eMail" type="text" />
|
|
<input type="submit" value="Neuen Corona-User eintragen" />
|
|
</form>
|
|
|
|
<h2 id="showAttendences">Anwesenheiten</h2>
|
|
<h3>Sende Anwesenheitsliste an eMail</h3>
|
|
<form method="POST" action="." >
|
|
<input name="toEmail" type="text" placeholder="toEmail" />
|
|
<input name="action" type="hidden" value="sendAttandeesPerEmail" />
|
|
<input name="emailText" type="hidden" value="<?php echo( attendancesAssocArray2mdList($lastAttendancesAssocArray) );?>" />
|
|
<input type="submit" value="Send Email" />
|
|
</form>
|
|
<?php foreach($lastAttendancesAssocArray as $date => $attendees){
|
|
echo("<h3>".$date."</h3>");
|
|
echo("<table class=\"responsive-table striped\" 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'] ? $a['corona_PLZ'] : "<form action=\".\" method=\"POST\"><input name=\"action\" value =\"updateCoronaData\" type=\"hidden\" /><input name=\"columnName\" value=\"corona_PLZ\" type=\"hidden\" /><input name=\"userId\" value=\"".$a['userId']."\" type=\"hidden\" /><input name=\"columnValue\" type=\"text\" placeholder=\"PLZ\" /><input type=\"submit\" value=\"Submit\"></form>")."</td>");
|
|
echo("<td>".( $a['corona_telephon'] ? $a['corona_telephon'] : "<form action=\".\" method=\"POST\"><input name=\"action\" value =\"updateCoronaData\" type=\"hidden\" /><input name=\"columnName\" value=\"corona_telephon\" type=\"hidden\" /><input name=\"userId\" value=\"".$a['userId']."\" type=\"hidden\" /><input name=\"columnValue\" type=\"text\" placeholder=\"Telephpon\" /><input type=\"submit\" value=\"Submit\"></form>")."</td>");
|
|
echo("<td>".( $a['corona_eMail'] ? $a['corona_eMail'] : "<form action=\".\" method=\"POST\"><input name=\"action\" value =\"updateCoronaData\" type=\"hidden\" /><input name=\"columnName\" value=\"corona_eMail\" type=\"hidden\" /><input name=\"userId\" value=\"".$a['userId']."\" type=\"hidden\" /><input name=\"columnValue\" type=\"text\" placeholder=\"eMail\" /><input type=\"submit\" value=\"Submit\"></form>")."</td>");
|
|
echo("</tr>");
|
|
}
|
|
echo("</table>");
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|