setDbConnection($db); $g->loadAchievementGroupFromDb($post['achievementGroupId']); $g->autoAddAchievements( $post['messageTemplate'], $post['from'], $post['to'], $post['step'] ); } if($post['action']=="updateAchievement"){ updateAchievement( $db, $post['achievementId'], $post['name'], $post['rootId'], $post['achievementGroupId'], $post['level'], $post['description'], $post['imgUrl'] ); } if($post['action']=="updateAchievementGroup"){ updateAchievement( $db, $post['achievementGroupId'], $post['name'], $post['rootId'], $post['unlockingAchievementId'], $post['imgUrl'] ); } if($post['action']=="setBday"){ setBday( $db, $post['userId'], $post['bday'] ); } if($post['action']=="setRecord"){ $u = getUserData($db, $post['userId']); $g = new achievementGroup; $g->setDbConnection($db); $g->loadAchievementGroupFromDb($post['achievementGroupId']); sendEmail( "cwsvjudo@arcor.de", $u['vorname']." ".$u['name']." got ".$post['value']." in ".$g->getName(), "[machs] Rekord eingetragen" ); setRecord( $db, $post['userId'], $post['achievementGroupId'], $post['value'] ); } if($post['action']=="reportRecord"){ # $u = getUserData($db, $post['userId']); # $ag = new achievementGroup; # achievementGroup::setDbConnection($db); # $ag->loadAchievementGroupFromDb($post['achievementGroupId']); $m = $post['userId']." hat in ".$post['achievementGroupId']." ".$post['value']." geschafft!"; # $m = $u['vorname']." ".$u['name']." hat in ".$ag->getName()." ".$post['value']." geschafft!"; sendEmail("cwsvjudo@arcor.de", $m, "[machs] Rekordmeldung"); } if($post['redirectLocation']) $redirectLocation = $post['redirectLocation']; header("Location: ".$redirectLocation); } return; } function sendEmail($toEmail, $emailText, $emailSubject){ try{ $date=new DateTime(); mail( $toEmail, $emailSubject, $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; } ?>