- add posibility to add missing data within the list
- section for adding new corona trainee - list (of the last month) can be send to an eMail
This commit is contained in:
@@ -1,10 +1,83 @@
|
||||
<?php
|
||||
|
||||
function processPostData($db, $post){
|
||||
function processPostData($db, $post, $redirectLocation = "."){
|
||||
if($post['action']){
|
||||
giveJudokasAttendence($db, $post['attandanceDate'], $post['judokaIdsInTraining']);
|
||||
header("Location: .");
|
||||
if($post['action'] == "giveAttendance"){
|
||||
giveJudokasAttendence($db, $post['attandanceDate'], $post['judokaIdsInTraining']);
|
||||
}
|
||||
if($post['action'] == "updateCoronaData"){
|
||||
updateCoronaData($db, $post['userId'], $post['columnName'], $post['columnValue']);
|
||||
}
|
||||
if($post['action'] == "addCoronaUser"){
|
||||
addCoronaUser(
|
||||
$db,
|
||||
$post['name'],
|
||||
$post['vorname'],
|
||||
$post['corona_PLZ'],
|
||||
$post['corona_telephon'],
|
||||
$post['corona_eMail']
|
||||
);
|
||||
}
|
||||
if($post['action'] == "sendAttandeesPerEmail"){
|
||||
sendEmail(
|
||||
$post['toEmail'],
|
||||
$post['emailText']
|
||||
);
|
||||
}
|
||||
header("Location: ".$redirectLocation);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function sendEmail($toEmail, $emailText){
|
||||
//var_dump($toEmail);
|
||||
//var_dump($emailText);
|
||||
try{
|
||||
$date=new DateTime();
|
||||
mail(
|
||||
$toEmail,
|
||||
"Kontakliste CWSV-Judo vom ".$date->format("Y-m-d"),
|
||||
$emailText
|
||||
);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
echo 'Message: ' .$e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
function attendancesAssocArray2text($attendancesAssocArray){
|
||||
$ret = "";
|
||||
foreach($attendancesAssocArray as $date => $attendees){
|
||||
$ret .= $date."\n";
|
||||
foreach($attendees as $a){
|
||||
$ret .= "\n";
|
||||
$ret .= "Name: ".$a['name'].", ".$a['vorname']."\n";
|
||||
$ret .= "PLZ: ".$a['corona_PLZ']."\n";
|
||||
$ret .= "Tel.: ".$a['corona_telephon']."\n";
|
||||
$ret .= "eMail: ".$a['corona_eMail']."\n";
|
||||
}
|
||||
$ret .= "\n";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function attendancesAssocArray2mdList($attendancesAssocArray, $date=null){
|
||||
if($date == null)
|
||||
$date=new DateTime();
|
||||
$ret = "# Anwesenheitsliste zur Corona-Kontaktverfolgung der Abteilung Judo des CWSV vom ".$date->format("Y-m-d")."\n\n";
|
||||
foreach($attendancesAssocArray as $d => $attendees){
|
||||
$ret .= "## ".$d."\n";
|
||||
$i=0;
|
||||
foreach($attendees as $a){
|
||||
$i += 1;
|
||||
$ret .= "\n";
|
||||
$ret .= $i." ".$a['name'].", ".$a['vorname']."\n";
|
||||
$ret .= " - PLZ: ".$a['corona_PLZ']."\n";
|
||||
$ret .= " - Tel.: ".$a['corona_telephon']."\n";
|
||||
$ret .= " - eMail: ".$a['corona_eMail']."\n";
|
||||
}
|
||||
$ret .= "\n";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user