Wettkampfkalender - Die Ereignisse wurden um ihr Datum erweitert - Daten, die sonst aus dem Wettkampfeintrag des zugehörigen Wettkampfes gezogen worden wären, müssen jetzt als json in die Bemerkunksspalte geschrieben werden - Events ohne zugehörigen Wettkampf im Wettkampfkalender müssen momentan noch per Hand eingefügt werden. Es gibt keine Oberfläche dafür. Changes to be committed: modified: addFahrt.php modified: addStarter.php modified: addStarterDev.php modified: admin/adminAddStarter.php modified: admin/newsLetter.php modified: admin/showEvent.php modified: admin/showFahrt.php modified: auth.php modified: authLogin.php modified: index.php modified: lib/wkParticipoLib.inc.php modified: showWkEvent.php
199 lines
7.7 KiB
PHP
199 lines
7.7 KiB
PHP
<?php
|
|
require_once('../local/db.php.inc');
|
|
require_once('../local/wkParticipoConf.php.inc');
|
|
require_once('../auth.php');
|
|
require_once('../lib/wkParticipoLib.inc.php');
|
|
$message = array();
|
|
// $meldungsBox = array();
|
|
|
|
if( empty($_POST) ){
|
|
$message['error'] .= "Weder userId noch eventId übergeben!";
|
|
}
|
|
else{
|
|
if( !isset($_POST['f']['eventId']) ){
|
|
$message['error'] .= "Fehlende eventId (".$_POST['f']['eventId'].") (POST: ".var_export($_POST, true).")<br />";
|
|
}
|
|
if( !isset($_POST['f']['type']) ){
|
|
$message['error'] .= "Fehlender type (".$_POST['f']['type'].") (POST: ".var_export($_POST, true).")<br />";
|
|
}
|
|
else{
|
|
$mysqlConn = @new mysqli($db_server, $db_user, $db_password, $db_name);
|
|
if ($mysqlConn->connect_error) {
|
|
$message['error'] .= "Datenbankverbindung fehlgeschlagen: ".$mysqlConn->connect_error."<br /";
|
|
}
|
|
else{
|
|
$wkEventData = getWkEventData($mysqlConn, $_POST['f']['eventId']);
|
|
|
|
if( date("Y-m-d") > $wkEventData['meldefrist']){
|
|
$message['error'] .= "Die Meldefrist ist bereits abgelaufen!<br />";
|
|
}
|
|
else{
|
|
if( !isset($_POST['f']['userId']) ){
|
|
$query = sprintf(
|
|
"SELECT kinder FROM wkParticipo_Users WHERE id='%s';",
|
|
$mysqlConn->real_escape_string($_SESSION['user']['userId'])
|
|
);
|
|
|
|
$kinderResults = $mysqlConn->query($query);
|
|
if(!$kinderResults){
|
|
$message['warning'] .= "Fehler bei Abfrage der Kinder!<br />";
|
|
}
|
|
$kinderResult = $kinderResults->fetch_array();
|
|
|
|
$kinderIds = explode(',', $kinderResult['kinder']);
|
|
foreach($kinderIds as $kindId){
|
|
$query = sprintf("SELECT name, vorname FROM wkParticipo_Users WHERE id='%s';",
|
|
$mysqlConn->real_escape_string($kindId)
|
|
);
|
|
$kinderDaten = $mysqlConn->query($query);
|
|
if(!$kinderDaten){
|
|
$message['warning'] .= "Fehler bei Abfrage der Kinder!<br />";
|
|
}
|
|
if($mysqlConn->affected_rows != 1) $message['warning'] .= "Nicht eindeutige userId!<br />";
|
|
$kindDaten = $kinderDaten->fetch_array();
|
|
|
|
$meldungsBox =
|
|
"<div id=\"meldungsBox\">Meldung".
|
|
"<ul>".
|
|
"<li>Für Wettkampf: ".mb_convert_encoding($wkEventData['Veranstaltung'], 'UTF-8', 'ISO-8859-1')."</li>".
|
|
"<li>Für Starter: ".mb_convert_encoding($kindDaten['name'], 'UTF-8', 'ISO-8859-1').", ".mb_convert_encoding($kindDaten['vorname'], 'UTF-8', 'ISO-8859-1')."</li>".
|
|
"</ul>".
|
|
"<form action=\"./addStarter.php\" method=\"post\">".
|
|
"<input type=\"hidden\" name=\"f[eventId]\" id=\"eventId\"".(isset($_POST['f']['eventId']) ? " value=\"" . htmlspecialchars($_POST['f']['eventId']) . "\"" : "")." />".
|
|
"<input type=\"hidden\" name=\"f[userId]\" id=\"userId\"".(isset($kindId) ? " value=\"".htmlspecialchars($kindId)."\"" : "")." />".
|
|
"<select name=\"f[type]\"><option value=\"1\" selected>als Starter</option><option value=\"2\">als Zuschauer</option><option value=\"3\">keine Teilnahme</option></select>";
|
|
|
|
if( getUsersMeldeStatus($mysqlConn, $_POST['f']['eventId'], $kindId) ){
|
|
$meldungsBox .= "<div>Bereits gemeldet</div>";
|
|
}
|
|
else{
|
|
if( date("Y-m-d") > $wkEventData['meldefrist']){
|
|
$meldungsBox .= "<div>Die Meldefrist ist bereits abgelaufen!</div>";
|
|
}
|
|
else{
|
|
$meldungsBox .= "<button type=\"submit\" name=\"submit\">Melden</button>";
|
|
}
|
|
}
|
|
$meldungsBox .="</form></div>";
|
|
}
|
|
}
|
|
else{
|
|
$userData = getUserData($mysqlConn, $_SESSION['user']['userId']);
|
|
$starterData = getUserData($mysqlConn, $_POST['f']['userId']);
|
|
|
|
// if(
|
|
// !in_array(
|
|
// $_POST['f']['userId'],
|
|
// explode(',', getUserData($mysqlConn, $_SESSION['user']['userId'])['kinder'])
|
|
// )
|
|
// ){
|
|
// $message['error'] .= "Es fehlt die Berechtigung diesen Starter zu melden!<br />";
|
|
// }
|
|
// else{
|
|
$message = addStarterToEvent($mysqlConn, $_POST['f']['userId'], $_POST['f']['eventId'], $_POST['f']['type']);
|
|
|
|
if( isset($message['success']) ){
|
|
$notificationMail['to'] = $userData['eMail'];
|
|
$notificationMail['subject'] = "=?UTF-8?B?".base64_encode("Meldebestätigung")."?=";
|
|
$notificationMail['message'] = $starterData['name'] . ", " . $starterData['vorname'] . " zum Wettkampf " . $wkData['Veranstaltung'] . " gemeldet. Diese Mail wurde automatisch vom Wettkampfplaner bei der Meldung versandt.";
|
|
$notificationMail['headers'] = "From: noreply.wettkampflaner@cwsvjudo.bplaced.net\r\n".
|
|
"Reply-To: cwsvjudo@arcor.de\r\n".
|
|
"X-Mailer: PHP/".phpversion()."\r\n".
|
|
"Content-Type: text/plain; charset=UTF-8";
|
|
|
|
if(!empty($notificationMail['to'])){
|
|
mail ( $notificationMail['to'] , $notificationMail['subject'] , $notificationMail['message'], $notificationMail['headers'] );
|
|
}
|
|
|
|
$notificationMail['to'] = $wkParticipoConf['adminEmail'];
|
|
if(!empty($notificationMail['to'])){
|
|
mail ( $notificationMail['to'] , $notificationMail['subject'] , $notificationMail['message'], $notificationMail['headers'] );
|
|
}
|
|
}
|
|
// }
|
|
}
|
|
}
|
|
}
|
|
$mysqlConn->close();
|
|
}
|
|
}
|
|
}
|
|
?><!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Wettkampfplaner - Meldung</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
<body>
|
|
<?php echo $login_status; ?>
|
|
<hr />
|
|
<?php
|
|
if( isset($message['success']) ){
|
|
?>
|
|
<?php echo $userData['name'].", ".$userData['vorname'];?> zum Wettkampf <?php echo $wkEventData['Veranstaltung'];?> gemeldet!<br />
|
|
<?php
|
|
}
|
|
else{
|
|
echo htmlRetMessage($message);
|
|
}
|
|
?>
|
|
<?php if(isset($meldungsBox)) echo $meldungsBox;?>
|
|
<nav>
|
|
<ul>
|
|
<li>
|
|
<a href="./index.php">
|
|
<div>zur Übersicht zurück</div>
|
|
</a>
|
|
</li>
|
|
<?php
|
|
if( isset($message['success']) ){
|
|
?>
|
|
<li>
|
|
<a href="./showWkEvent.php?eventId=<?php echo $wkEventData['id'];?>">
|
|
<div>
|
|
<?php echo "Detailansicht ".$wkEventData['Veranstaltung'];?>
|
|
</div>
|
|
</a>
|
|
</li>
|
|
<?php
|
|
}
|
|
?>
|
|
</ul>
|
|
</nav>
|
|
|
|
<!--
|
|
<div style="border: solid black"><?php echo var_export($wkEventData, true);?></div>
|
|
<div style="border: solid black"><?php echo var_export($userData, true);?></div>
|
|
<div style="border: solid black"><?php echo var_export($_SESSION, true);?></div>
|
|
<div style="border: solid black"><?php echo var_export($_POST, true);?></div>
|
|
|
|
<div id="meldungsBox">
|
|
Manuelle Meldung
|
|
<ul>
|
|
<li>Für Wettkampf: <?php echo isset($wkEventData['Veranstaltung']) ? mb_convert_encoding($wkEventData['Veranstaltung'], 'UTF-8', 'ISO-8859-1') : "<fehlende Wettkampfdaten>" ?></li>
|
|
<li>Für Starter: <?php echo isset($userData['vorname']) ? mb_convert_encoding($userData['vorname'], 'UTF-8', 'ISO-8859-1') : "<fehlender Vorname>" ?></li>
|
|
</ul>
|
|
|
|
<form action="./addStarterDev.php" method="post">
|
|
<fieldset>
|
|
<legend>Meldungsdaten</legend>
|
|
<div>
|
|
<label for="eventId">eventId</label>
|
|
<input type="text" name="f[eventId]" id="eventId" <?php echo isset($_POST['f']['eventId']) ? "value=\"".htmlspecialchars($_POST['f']['eventId'])."\"" : "" ?> />
|
|
</div>
|
|
<div>
|
|
<label for="userId">userId</label>
|
|
<input type="<?php echo isset($_POST['f']['userId']) ? "disabled" : "text" ?>" name="f[userId]" id="userId" <?php echo isset($_POST['f']['userId']) ? "value=\"".htmlspecialchars($_POST['f']['userId'])."\"" : "" ?> />
|
|
</div>
|
|
</fieldset>
|
|
<fieldset>
|
|
<div><button type="submit" name="submit" value="Meldung">Meldung</button></div>
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
-->
|
|
</body>
|
|
</html>
|