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
264 lines
8.4 KiB
PHP
264 lines
8.4 KiB
PHP
<?php
|
|
|
|
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
|
|
require_once('./local/wkParticipoConf.php.inc');
|
|
// require_once('./auth.php');
|
|
require_once('./authLogin.php');
|
|
require_once('./local/db.php.inc');
|
|
require_once('./lib/wkParticipoLib.inc.php');
|
|
|
|
$basePath = "/users/cwsvjudo/www";
|
|
require_once($basePath."/config/phpcount.config.php");
|
|
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
|
|
|
|
|
|
$message = array();
|
|
$eventData = array();
|
|
|
|
if(empty($_GET)){
|
|
$message['error'] = "Fehler: leeres POST!";
|
|
}
|
|
else{
|
|
if( empty($_GET['eventId']) ){
|
|
$message['error'] .= "Fehler: keine eventId gefunden! <a href=\"./index.php\">zur Eventübersicht</a>";
|
|
}
|
|
else{
|
|
if( (string)(int)$_GET['eventId'] == $_GET['eventId'] ){
|
|
$mysqli = @new mysqli($db_server, $db_user, $db_password, $db_name);
|
|
if ($mysqli->connect_error) {
|
|
$message['error'] .= 'Datenbankverbindung fehlgeschlagen: ' . $mysqli->connect_error;
|
|
}
|
|
else{
|
|
$eventData = getWkEventData($mysqli, $_GET['eventId']);
|
|
if( empty($eventData) ) $message['error'] .= 'Fehler: keine Eventdaten zurückgeliefert!';
|
|
else{
|
|
if(!empty($eventData['bemerkungen'])){
|
|
$tmpJson = json_decode( $eventData['bemerkungen'], true);
|
|
if($tmpJson){
|
|
$eventData['Datum'] = $tmpJson['Datum'];
|
|
$eventData['Veranstaltung'] = $tmpJson['Veranstaltung'];
|
|
$eventData['Altersklassen'] = $tmpJson['Altersklassen'];
|
|
$eventData['Routenplaner'] = $tmpJson['Routenplaner'];
|
|
$eventData['Ausschreibung'] = $tmpJson['Ausschreibung'];
|
|
$eventData['bemerkungen'] = $tmpJson['bemerkungen'];
|
|
}
|
|
}
|
|
PHPCount::AddHit(
|
|
"Wettkampfplaner ".
|
|
($_SESSION['user']['username']?("(".htmlspecialchars($_SESSION['user']['username']).") "):"").
|
|
"- ".$eventData['Veranstaltung']
|
|
);
|
|
}
|
|
}
|
|
}
|
|
else $message['error'] .= "Fehler: eventId ist kein Int (".$_GET['eventId'].")";
|
|
}
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Wettkampfplanung - Wettkampfdetails<?php echo( empty($eventData) ? "" : " ".$eventData['Veranstaltung'] );?></title>
|
|
<link rel="stylesheet" href="./style.css">
|
|
</head>
|
|
<body>
|
|
<?php
|
|
echo $login_status;
|
|
?>
|
|
<hr />
|
|
<?php
|
|
if (!empty($_SESSION['login'])) echo "<a class=\"touchLink\" href=\"./index.php\">Zur Übersicht zurück</a>";
|
|
|
|
echo htmlRetMessage($message);
|
|
|
|
if( empty($eventData) ){
|
|
?>
|
|
Keine Eventdaten zum Anzeigen gefunden!<br />
|
|
<a class="touchLink" href="./index.php"><div>Zur Übersicht zurück</div></a>
|
|
<?php
|
|
}
|
|
else{
|
|
?>
|
|
<h1><?php echo (empty($eventData) ? "" : " ".$eventData['Veranstaltung']);?></h1>
|
|
|
|
<h2>Wettkampfdaten</h2>
|
|
<ul>
|
|
<li>Wettkampfname: <?php echo $eventData['Veranstaltung'];?></li>
|
|
<li>Datum: <time datetime="<?php echo $eventData['Datum'];?>"><?php echo $eventData['Datum'];?></time></li>
|
|
<li>Frist zum Einschreiben: <time datetime="<?php echo $eventData['meldefrist'];?>"><?php echo $eventData['meldefrist'];?></time> <a class="touchLink" href ="<?php echo(addToGcalUrl($eventData['Veranstaltung'], $eventData['meldefrist']));?>">Einschreibefrist in den Google Calendar übernehmen</a></li>
|
|
<li>Altersklassen: <?php echo $eventData['Altersklassen'];?></li>
|
|
<li>Ort: <a class="touchLink" href="<?php echo $eventData['Routenplaner'];?>"><?php echo $eventData['Ort'];?></a></li>
|
|
<li>Bemerkungen: <?php echo $eventData['bemerkungen'];?></li>
|
|
</ul>
|
|
|
|
<nav>
|
|
<ul>
|
|
<li>
|
|
<a href ="<?php echo $eventData['Ausschreibung'];?>">
|
|
<div>Link zur Ausschreibung</div>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="<?php echo $eventData['Routenplaner'];?>">
|
|
<div>Link zum Routenplaner</div>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href ="/ressourcen/phpLib/calendar.php?wkID=<?php echo $eventData['wkId']?>">
|
|
<div>Termin als iCal</div>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href ="<?php echo(addToGcalUrl($eventData['Veranstaltung'], $eventData['Datum'] ));?>">
|
|
<div>Termin in den Google Calendar übernehmen</div>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<h2>Einschreibungen:</h2>
|
|
<?php if( !empty($_SESSION['login']) ){
|
|
$wkEventStarterData = getEventsStarterData($mysqli, $eventData['id']);
|
|
?>
|
|
<li>Eingeschrieben:
|
|
<?php
|
|
$starters = getStarterForEvent($mysqli, $eventData['id']);
|
|
$anzahlKaempfer = array_count_values(array_column($starters, 'type'))['1'];
|
|
$anzahlZuschauer = array_count_values(array_column($starters, 'type'))['2'];
|
|
// if( empty($starters) ){
|
|
if( ($anzahlKaempfer+$anzahlZuschauer) <= 0 ){
|
|
?>
|
|
Noch will niemand zu diesem Wettkampf!
|
|
<?php
|
|
}
|
|
else{
|
|
echo($anzahlKaempfer+$anzahlZuschauer);
|
|
}
|
|
?>
|
|
<ul>
|
|
<li>Kämpfer:
|
|
<?php
|
|
$kaempfer = getKaempferForEvent($mysqli, $eventData['id']);
|
|
if( empty($kaempfer) ){
|
|
?>
|
|
Keine
|
|
<?php
|
|
}
|
|
else{
|
|
echo count($kaempfer);
|
|
}
|
|
?>
|
|
</li>
|
|
<li>Zuschauer:
|
|
<?php
|
|
$zuschauer = getZuschauerForEvent($mysqli, $eventData['id']);
|
|
if( empty($zuschauer) ){
|
|
?>
|
|
Keine
|
|
<?php
|
|
}
|
|
else{
|
|
echo count($zuschauer);
|
|
}
|
|
?>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<!--
|
|
<p>Es sind momentan <?php echo (count($wkEventStarterData) == 0 ? "keine" : count($wkEventStarterData));?> Starter eingeschrieben.</p>
|
|
-->
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
|
|
<p>Jemanden einschreiben:
|
|
<?php
|
|
if (empty($_SESSION['login'])){
|
|
echo( "Nur eingeloggt möglich!");
|
|
}
|
|
else{
|
|
$kinderDaten = getUsersKidsData($mysqli, $_SESSION['user']['userId']);
|
|
|
|
foreach($kinderDaten as $kind){
|
|
?>
|
|
<div style="border: 1px solid black;">
|
|
<?php echo mb_convert_encoding( $kind['name'].", ".$kind['vorname'], 'UTF-8', 'ISO-8859-1');?></li>
|
|
<form action="./addStarter.php" method="post">
|
|
<input type="hidden" name="f[eventId]" id="eventId"<?php echo isset($eventData['id']) ? ' value="' . htmlspecialchars($eventData['id']) . '"' : '' ?> />
|
|
<input type="hidden" name="f[userId]" id="userId" <?php echo isset($kind['id']) ? ' value="' . htmlspecialchars($kind['id']) . '"' : '' ?> />
|
|
<?php
|
|
if( getUsersMeldeStatus($mysqli, $eventData['id'], $kindId) ){
|
|
echo("<div>Bereits eingeschrieben!</div>");
|
|
}
|
|
else{
|
|
$heuteDateTime = DateTime::createFromFormat("Y-m-d", date("Y-m-d"));
|
|
$einschreibeDateTime = DateTime::createFromFormat("Y-m-d", $eventData['meldefrist']);
|
|
if($heuteDateTime->modify( "+ 4 weeks") < $einschreibeDateTime){
|
|
echo("<button type=\"submit\" disabled>Es ist noch zu früh jemanden einzuschreiben!</button>");
|
|
}
|
|
else{
|
|
if( date("Y-m-d") > $eventData['meldefrist']){
|
|
echo "<button class=\"touchButton\" type=\"submit\" disabled>Die Frist zum Einschreiben (".$eventData['meldefrist'].") ist bereits abgelaufen!</button>";
|
|
|
|
if (!empty($_SESSION['login'])){
|
|
echo( "<p>Frist für das Einschreiben verpasst? Für ein nachträgliches Eintragen mit dem Admin verständigen (<a href=\"mailto:cwsvjudo@arcor.de?Subject=".rawurlencode("Meldefrist ".$eventData['Veranstaltung'])."\" target=\"_top\">Email an cwsvjudo@arcor.de</a>).</p>" );
|
|
}
|
|
}
|
|
else{
|
|
echo "<button class=\"touchButton\" type=\"submit\" name=\"submit\">Einschreiben</button>";
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
</form>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</p>
|
|
|
|
<h2>Mitfahrangebote</h2>
|
|
<?php
|
|
if (empty($_SESSION['login'])){
|
|
echo "Nur eingeloggt einsehbar!";
|
|
}
|
|
else{
|
|
$wkEventsFahrerData = getFahrtenForEvent($mysqli, $eventData['id']);
|
|
?>
|
|
<ul>
|
|
<?php
|
|
foreach( $wkEventsFahrerData as $fahrt ){
|
|
?>
|
|
<li><?php echo mb_convert_encoding($fahrt['name'], 'UTF-8', 'ISO-8859-1').", ".mb_convert_encoding($fahrt['vorname'], 'UTF-8', 'ISO-8859-1');?> (<?php echo $fahrt['plaetze'];?> Plätze)</li>
|
|
<?php
|
|
}
|
|
?>
|
|
</ul>
|
|
<form action="./addFahrt.php" method="post">
|
|
<input type="hidden" name="f[eventId]" value="<?php echo ( isset( $eventData['id'] ) ? $eventData['id'] : "" );?>" />
|
|
<?php
|
|
if($eventData['Datum'] > date("Y-m-d")){
|
|
?>
|
|
<button class="touchButton" type="submit">ein Mitfahrangebot abgeben.</button>
|
|
<?php
|
|
}
|
|
else{
|
|
?>
|
|
<button class="touchButton" type="submit" disabled>es ist leider zu spät, noch Mitfahrangebote hinzuzufügen.</button>
|
|
<?php
|
|
}
|
|
?>
|
|
</form>
|
|
<?php
|
|
}
|
|
}
|
|
if($mysqli) $mysqli->close();
|
|
?>
|
|
</body>
|
|
</html>
|