Files
cwsvJudo/homepage/redesign2018/markdownExperiment/verein.wettkampf.php
2018-05-05 17:09:49 +02:00

353 lines
14 KiB
PHP

<?php
header("Content-Type: text/html; charset=utf-8");
header("Cache-Control: max-age=3600");
require_once($_SERVER['DOCUMENT_ROOT']."/ressourcen/phpLib/miscAssis.php");
require_once($_SERVER['DOCUMENT_ROOT']."/ressourcen/phpLib/breadcrumbList.php");
require_once($_SERVER['DOCUMENT_ROOT']."/bonus/db.inc");
// Deutsches Datumsformat
setlocale(LC_ALL, 'de_DE');
$message = array();
if(is_positive_integer($_GET['wkId'])){
$sqlConn = @new mysqli($db_server, $db_user, $db_password, $db_name);
if ($sqlConn->connect_error) {
$message['error'] .= "Datenbankverbindung fehlgeschlagen: " . $sqlConn->connect_error . "<br />";
}
else{
$wkData = getWkData($sqlConn, $_GET["wkId"]);
if( empty($wkData) ) $message['error'] .= "Fehler: WettkampfId ".$_GET['wkId']." nicht gefunden!<br />";
}
}
else $message['error'] .= "Fehler: wkId ist kein pos. Int (".$_GET['wkId'].")<br />";
$breadcrumbs = array();
array_push($breadcrumbs,
array("linkTarget" => "http://cwsvjudo.bplaced.net/pages/desktop/", "linkTitle" => "Startseite der Homepage der Sektion Judo des Chemnitzer Freizeit- und Wohngebietssportvereines", "caption" => "<img class=\"charImg\" src=\"/ressourcen/graphiken/banner/cwsv-judo-logo.png\" alt=\"Judo im Chemnitzer WSV - Logo\" title=\"Judo im Chemnitzer WSV\" />")
);
array_push($breadcrumbs,
array("linkTarget" => "http://cwsvjudo.bplaced.net/pages/desktop/verein.wettkampfkalender.php", "linkTitle" => "Wettkampfkalender der Sektion Judo des Chemnitzer Freizeit- und Wohngebietssportvereines in Kontakt zu treten", "caption" => "Wettkampkalender")
);
if(is_positive_integer($_GET['wkId'])){
array_push($breadcrumbs,
array("linkTarget" => "http://cwsvjudo.bplaced.net/pages/desktop/verein.wettkampf.php?wkId=".$_GET['wkId'], "linkTitle" => "Wettkampf Nr. ".$GET['wkID'], "caption" => $_GET['wkId'])
);
}
?>
<!doctype html>
<!--cwsvJudo Wettkampkalender-->
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo (isset($_GET["jahr"]) ? "Wettkampfkalender ".$_GET["jahr"] : "Aktueller Wettkampfkalender")?> der Judoka des Chemnitzer WSV</title>
<meta name="description" content="<?php echo (isset($_GET["jahr"]) ? "Wettkampfkalender ".$_GET["jahr"] : "Aktueller Wettkampfkalender")?> der Abteilung Judo des Chemnitzer Freizeit- und Wohngebietssportvereines" />
<meta name="keywords" content="Termine, Wettkampf, Judo" />
<meta name="author" content="Marko Bunzel" />
<!-- favIcon und Co nach der empfehlung von https://github.com/audreyr/favicon-cheat-sheet -->
<link rel="shortcut icon" type="image/x-icon" sizes="16x16 32x32 48x48 64x64" href="/ressourcen/graphiken/logos/favicon/favicon.ico">
<link rel="apple-touch-icon" sizes="152x152" href="/ressourcen/graphiken/logos/apple-touch-icon/apple-touch-icon-152.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/ressourcen/graphiken/logos/apple-touch-icon/apple-touch-icon-180.png" />
<link rel="manifest" href="/manifest.json">
<link rel="canonical" href="http://cwsvjudo.bplaced.net/pages/desktop/verein.wettkampfkalender.php<?php echo isset($_GET["jahr"]) ? "?jahr=".$_GET["jahr"] : ""?>" />
<link rel="alternate" media="only screen and (max-width: 400px)" href="http://cwsvjudo.bplaced.net/pages/mobile/index.php" />
<meta name="viewport" content="width=device-width" />
</head>
<body>
<!--Die Kopfzeile-->
<header>
<?php $bannerNumber=rand(1,7);?>
<img title="Judo im Chemnitzer WSV" alt="Judo im Chemnitzer WSV - Promo" class="styleBannerPromo" src=<?php echo "/ressourcen/graphiken/banner/bannerlogo.".$bannerNumber.".jpg"?> />
<img title="Judo im Chemnitzer WSV" alt="Judo im Chemnitzer WSV - Logo" class="styleBannerCwsv" src="/ressourcen/graphiken/banner/cwsv-judo-logo.png" />
<h1>Chemnitzer WSV e.&nbsp;V. - Judo</h1>
<?php echo htmlBreadcrumblist($breadcrumbs);?>
</header>
<!--Die Horizontale Navigationsleiste-->
<?php echo(
htmlNavBar(
[
['linkTarget' => "http://cwsvjudo.bplaced.net/pages/desktop/index.php", 'linkTitle' => "Homepage der Abteilung Judo des Chemnitzer WSV", 'caption' => "Home"],
['linkTarget' => "http://cwsvjudo.bplaced.net/pages/desktop/news.php", 'linkTitle' => "Bekanntmachungen der Abteilung Judo des Chemnitzer WSV", 'caption' => "News"],
['linkTarget' => "http://cwsvjudo.bplaced.net/pages/desktop/verein.php", 'linkTitle' => "Informationen über den Chemnitzer Freizeit- und Wohngebietssportverein und dessen Sektion Judo", 'caption' => "Verein"],
['linkTarget' => "http://cwsvjudo.bplaced.net/pages/desktop/extras.php", 'linkTitle' => "Einige kleine Extras und Helferlein", 'caption' => "Extras"],
['linkTarget' => "http://cwsvjudo.bplaced.net/pages/desktop/kontakt.php", 'linkTitle' => "Möglichkeiten mit dem Chemnitzer WSV in Kontakt zu treten", 'caption' => "Kontakt"],
], "navHori"
)
);?>
<!-- Der eigentliche Inhalt -->
<div id="content">
<?php
if(!empty($message)){
?>
<div class="messageBox">
<?php echo $message['error']?>
</div>
<?php
}
?>
<?php
if( !empty($wkData) ){
?>
<h2>Wettkampfdaten <?php echo mb_convert_encoding($wkData['Veranstaltung'], 'UTF-8', 'ISO-8859-1');?></h2>
<ul>
<li>Datum: <?php echo $wkData['Datum'] ?></li>
<li>AK: <?php echo mb_convert_encoding($wkData['Altersklassen'], 'UTF-8', 'ISO-8859-1');?></li>
<li>Ort: <?php echo mb_convert_encoding($wkData['Ort'], 'UTF-8', 'ISO-8859-1');?></li>
<li><a href="<?php echo $wkData['Ausschreibung'] ?>">Ausschreibung</a></li>
<li><a href="<?php echo $wkData['Routenplaner'] ?>">Routenplaner</a></li>
<li>Galerie: <?php echo $wkData['galleryLink'] ?></li>
<li>PromoPic: <?php echo $wkData['promoPic'] ?></li>
</ul>
<?php
}
?>
<?php
include($_SERVER['DOCUMENT_ROOT']."/bonus/db.inc");
try{
$db_connection = new PDO('mysql:host='.$db_server.';dbname='.$db_name, $db_user, $db_password);
// mögliche Werte für das jahr herausfinden
$jahre = array();
$query = "SELECT DISTINCT DATE_FORMAT( Datum, '%Y') FROM cwsvjudo.wettkampfkalender WHERE 1 ORDER BY DATE_FORMAT( Datum, '%Y' ) DESC";
$ergebnis = $db_connection->query($query);
foreach($ergebnis as $row){
array_push($jahre, $row["DATE_FORMAT( Datum, '%Y')"]);
}
// ist das übergebene jahr ein gültiges?
$jahr = $_GET["jahr"];
if($jahr){
if(in_array($jahr, $jahre)){
$minDate = $jahr."-01-01";
$maxDate = $jahr."-12-31";
?>
<h2>
Wettkampfkalender <?php echo $jahr?>
</h2>
<?php
}
else{
echo "Keine Wettkämpfe für das Jahr".$jahr." gefunden!";
die();
}
}
else{
$minDate = date("Y-m-d", time());
$maxDate = "";
?>
<h2>
Kommende Wettkämpfe
</h2>
<?php
}
$query="SELECT Datum,Veranstaltung,Ausschreibung,Ort,Routenplaner,Altersklassen,lfdeNr FROM wettkampfkalender WHERE Datum >= \"".$minDate."\" ORDER BY Datum ASC";
if($maxDate){
$query="SELECT Datum,Veranstaltung,Ausschreibung,Ort,Routenplaner,Altersklassen,lfdeNr FROM wettkampfkalender WHERE Datum >= \"".$minDate."\" AND Datum <= \"".$maxDate."\" ORDER BY Datum ASC";
}
$ergebnis = $db_connection->query($query);
?>
<table class="wkKalender">
<thead>
<tr>
<th>
Datum
</th>
<th>
Veranstaltung
</th>
<th>
Ort
</th>
<th>
Altersklasse(n)
</th>
<th>
iCal
</th>
</tr>
</thead>
<tbody>
<?php
$ergebnis = $db_connection->query($query);
// echo "Debug: " . gettype($ergebnis) . " " . count($ergebnis) . "\n";
foreach($ergebnis as $wk){
?>
<tr>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Event",
"name": "<?php echo mb_convert_encoding($wk['Veranstaltung'], 'UTF-8', 'ISO-8859-1');?>",
"startDate": "<?php echo mb_convert_encoding($wk['Datum'], 'UTF-8', 'ISO-8859-1');?>",
"endDate": "<?php echo mb_convert_encoding($wk['Datum'], 'UTF-8', 'ISO-8859-1');?>",
"url": "http://cwsvjudo.bplaced.net<?php echo mb_convert_encoding($wk['Ausschreibung'], 'UTF-8', 'ISO-8859-1');?>",
"description": "Judo-Wettkampf der Altersklasse(n) <?php echo mb_convert_encoding($wk['Altersklassen'], 'UTF-8', 'ISO-8859-1');?>",
"location": {
"@type": "Place",
"name": "<?php echo mb_convert_encoding($wk['Ort'], 'UTF-8', 'ISO-8859-1');?>",
"address": {
"@type": "PostalAddress",
"addressLocality": "<?php echo mb_convert_encoding($wk['Ort'], 'UTF-8', 'ISO-8859-1');?>"
}
}
}
</script>
<td class="noWrap">
<time datetime="<?php echo mb_convert_encoding($wk['Datum'], 'UTF-8', 'ISO-8859-1');?>">
<?php echo strftime("%Y-%m-%d (%a)", strtotime($wk['Datum']) );?>
</time>
</td>
<td class="hyphenate">
<a title="Ausschreibung <?php echo mb_convert_encoding($wk['Veranstaltung'], 'UTF-8', 'ISO-8859-1');?>" href="<?php echo mb_convert_encoding($wk['Ausschreibung'], 'UTF-8', 'ISO-8859-1');?>"><span property="name"><?php echo mb_convert_encoding($wk['Veranstaltung'], 'UTF-8', 'ISO-8859-1');?></span></a>
</td>
<td>
<a title="Wegbeschreibung <?php echo mb_convert_encoding($wk['Veranstaltung'], 'UTF-8', 'ISO-8859-1');?>" href="<?php echo $wk['Routenplaner']?>"><span><?php echo mb_convert_encoding($wk['Ort'], 'UTF-8', 'ISO-8859-1');?></span></a>
</td>
<td>
<?php echo mb_convert_encoding($wk['Altersklassen'], 'UTF-8', 'ISO-8859-1');?>
</td>
<td>
<a title="Termin für <?php echo mb_convert_encoding($wk['Veranstaltung'], 'UTF-8', 'ISO-8859-1');?> in Kalender übernehmen" href="/ressourcen/phpLib/calendar.php?wkID=<?php echo $wk['lfdeNr']?>">iCal</a>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th>
Datum
</th>
<th>
Veranstaltung
</th>
<th>
Ort
</th>
<th>
Altersklasse(n)
</th>
<th>
iCal
</th>
</tr>
</tfoot>
</table>
<div style="font-size:xx-small">
Alle Angaben ohne Gewähr! Fehler und Ergänzungen dürfen gerne gemeldet werden.
</div>
<a href="/downloads/Ausschreibungen/">Link zum Archiv mit allen Ausschreibungen</a>.
<!--Ende dynamische Wettkampfliste-->
<hr />
<div class="wkSelektor">
Im folgendem kann man sich mehrere Wettkampftermine in einer <a href="https://de.wikipedia.org/wiki/ICalendar">ICalendar</a>-Datei zusammenstellen. Zum An-/Abwählen bei gedrückter Strg-Taste mit der linken Maustaste die jeweiligen Wettkämpfe anklicken.
<form action="http://cwsvjudo.bplaced.net/ressourcen/phpLib/wkCustomICal.php" method="POST">
<label>Kommende Wettkämpfe:</label>
<div><select name="wkIDs[]" multiple="multiple" size="5">
<?php
$ergebnis = $db_connection->query($query);
foreach($ergebnis as $wk){
?>
<option value="<?php echo $wk['lfdeNr'];?>">
<?php echo mb_convert_encoding($wk['Datum'], 'UTF-8', 'ISO-8859-1');?>
--
<?php echo mb_convert_encoding($wk['Veranstaltung'], 'UTF-8', 'ISO-8859-1');?>
(<?php echo mb_convert_encoding($wk['Altersklassen'], 'UTF-8', 'ISO-8859-1');?>)
</option>
<?php
}
?>
</select></div>
<button type="submit">iCal erzeugen</button>
</form>
<?php
// Verbindung wieder schließen
$db_connection = NULL;
}
catch(PDOException $db_error){
print "Error!: " . $db_error->getMessage() . "<br/>";
die();
}
?>
</div>
</div> <!-- Ende div id content; des eigentlichen Inhaltes-->
<!-- Vertikale Navigationsleiste an der Seite-->
<div id="navVerti">
<nav><ul>
<?php
if(!$_GET["jahr"]){
echo "<li class=\"activeNav\">kommende Wett&shy;k&auml;mpfe</li>";
}
else{
echo "<li><a href=\"/pages/desktop/verein.wettkampfkalender.php\">komm&shy;ende Wett&shy;k&auml;mpfe</a></li>";
}
foreach($jahre as $runner){
if($_GET["jahr"] == $runner){
echo "<li class=\"activeNav\"> Wett&shy;k&auml;mpfe ".$runner."</li>";
}
else{
echo "<li><a href=\"/pages/desktop/verein.wettkampfkalender.php?jahr=".$runner."\">Wett&shy;k&auml;mpfe ".$runner."</a></li>";
}
}
?>
</ul></nav>
<hr />
<!--Anfang der Einbindung des Counters; die Zeile 'TEMPLATE;' DARF NICHT EINGERÜCKT SEIN-->
<div>
<?php
$chCounter_template = <<<TEMPLATE
<span class="bold">Besucher</span><br/>
Online: {V_VISITORS_CURRENTLY_ONLINE}<br/>
Heute: {V_VISITORS_TODAY}<br/>
Gestern: {V_VISITORS_YESTERDAY}<br/>
Tagesrekord: {V_MAX_VISITORS_PER_DAY}<br/>
Insgesamt: {V_TOTAL_VISITORS}<br/>
<span class="bold">Seitenaufrufe</span><br/>
Diese Seite: {V_PAGE_VIEWS_THIS_PAGE}<br/>
Insgesamt: {V_TOTAL_PAGE_VIEWS}<br/>
TEMPLATE;
$chCounter_page_title = "Wettkampfkalender";
if($_GET["jahr"]){
$chCounter_page_title = "Wettkampfkalender ".$_GET["jahr"];
}
$chCounter_visible=1;
include($_SERVER['DOCUMENT_ROOT']."/expCounter/counter.php");
?>
<!--Ende der Einbindung des Counters-->
</div>
</div>
<?php include($_SERVER['DOCUMENT_ROOT']."/pages/shared/sponsorList.html.inc");?>
<footer>
<p>
<?php
if($_GET["jahr"]){
?>
<a href="http://validator.w3.org/check?uri=http%3A%2F%2Fcwsvjudo.bplaced.net%2Fpages%2Fdesktop%2Fverein.wettkampfkalender.php?jahr=<?php echo $_GET["jahr"]?>">Valid <img src="http://www.w3.org/html/logo/downloads/HTML5_1Color_Black.svg" alt="HTML 5" style="height:1em"></a>
<?php
}
else{
?>
<a href="http://validator.w3.org/check?uri=http%3A%2F%2Fcwsvjudo.bplaced.net%2Fpages%2Fdesktop%2Fverein.wettkampfkalender.php">Valid <img src="http://www.w3.org/html/logo/downloads/HTML5_1Color_Black.svg" alt="HTML 5" style="height:1em"></a>
<?php
}
?>
</p>
</footer>
<link rel="stylesheet" media="screen and (min-width: 641px)" href="/ressourcen/css/cwsvJudo.css" />
<link rel="stylesheet" media="screen and (max-width: 640px)" href="/ressourcen/css/cwsvJudoMobile.css" />
</body>
</html>