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

486 lines
17 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
$basePath = "/users/cwsvjudo/www";
$baseUrl = "http://cwsvjudo.bplaced.net";
require_once( $basePath."/bonus/db.inc");
header("Content-Type: text/html; charset=utf-8");
header("Cache-Control: max-age=3600");
setlocale(LC_ALL, 'de_DE.UTF8');
// Abfrage der Wettkampfdaten der Einzelansicht
if(!empty($_GET['wkId'])){
$mysqlConn = @new mysqli($db_server, $db_user, $db_password, $db_name);
if ($mysqlConn->connect_error) {
$message['error'] .= "Datenbankverbindung fehlgeschlagen: " . $mysqlConn->connect_error;
}
else{
$wkInfo = array();
$wkGals = array();
if( (string)(int)$_GET['wkId'] != $_GET['wkId'] ){
$message['error'] .= "Ungültige wkId ".$_GET['wkId'];
}
else{
$mysqlConn->query("USE cwsvjudo;");
$wkInfoQuery = sprintf(
"SELECT * FROM wettkampfkalender WHERE wettkampfkalender.lfdeNr = '%s';",
$mysqlConn->real_escape_string($_GET['wkId'])
);
$wkResults = $mysqlConn->query($wkInfoQuery);
if( empty($wkResults) ){
$message['error'] .= "Fehler bei Datenbankabfrage (".$wkInfoQuery.")!";
}
else{
$wkInfo = $wkResults->fetch_assoc();
}
$mysqlConn->query("USE cwsvjudo;");
$wkInfoQuery = sprintf(
"SELECT * FROM wkGalerien WHERE wkGalerien.wkId = '%s';",
$mysqlConn->real_escape_string($_GET['wkId'])
);
$wkResults = $mysqlConn->query($wkInfoQuery);
if( empty($wkResults) ){
$message['error'] .= "Fehler bei Datenbankabfrage (".$wkInfoQuery.")!";
}
else{
//$wkGals = $wkResults->fetch_assoc();
$wkGals = $wkResults->fetch_all();
}
}
}
if($mysqlConn) $mysqlConn->close();
}
?>
<!doctype html>
<!--cwsvJudo Wettkampkalender-->
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
<?php
if ( !empty($wkInfo) ){
echo mb_convert_encoding($wkInfo['Veranstaltung'], 'UTF-8', 'ISO-8859-1');
}
else{
echo((isset($_GET["jahr"]) ? "Wettkampfkalender ".$_GET["jahr"] : "Aktueller Wettkampfkalender"));
}
?>
</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/verein.wettkampfkalender.php" />
<meta name="viewport" content="width=device-width" />
<script type='application/ld+json'>
{
"@context": "http://www.schema.org",
"@type": "WebSite",
"name": "<?php echo isset($_GET["jahr"]) ? "Wettkampfkalender ".$_GET["jahr"] : "Aktueller Wettkampfkalender";?> der Judoka des Chemnitzer WSV",
"alternateName": "Termine, Ausschreibungen und Wegbeschreibunge für Wettkämpfe der Abteilung Judo des Chemnitzer Freizeit- und Wohngebietssportvereines",
"url": "http://cwsvjudo.bplaced.net/pages/desktop/verein.wettkampfkalender.php<?php echo isset($_GET["jahr"]) ? "?jahr=".$_GET["jahr"] : "" ?>"
}
</script>
</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>
<div class="breadcrumbList"><!-- Breadcrumbs -->
<ol vocab="http://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage"
href="http://cwsvjudo.bplaced.net/pages/desktop/"
title="Startseite der Homepage der Sektion Judo des Chemnitzer Freizeit- und Wohngebietssportvereines"
><img class="charImg"
src="/ressourcen/graphiken/banner/cwsv-judo-logo.png"
alt="Judo im Chemnitzer WSV - Logo"
title="Judo im Chemnitzer WSV"
/></a>
<meta property="position" content="1">
</li>
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage"
href="http://cwsvjudo.bplaced.net/pages/desktop/verein.wettkampfkalender.php"
title="Liste mit Terminen für Wettkämpfe im Judo"
>
<span property="name">Wettkampfkalender</span>
</a>
<meta property="position" content="2">
</li>
<?php
if( isset( $_GET["jahr"]) ){
?>
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage"
href="http://cwsvjudo.bplaced.net/pages/desktop/verein.wettkampfkalender.php?jahr=<?php echo $_GET["jahr"]; ?>"
>
<span property="name"><?php echo $_GET["jahr"]; ?></span>
</a>
<meta property="position" content="3">
</li>
<?php
}
?>
</ol>
</div><!-- Ende Breadcrumbs -->
</header>
<!--Die Horizontale Navigationsleiste-->
<nav class="navHori">
<ul>
<li>
<a title="Homepage der Abteilung Judo des Chemnitzer WSV" href="index.php">
Home
</a>
</li>
<li>
<a title="Bekanntmachungen der Abteilung Judo des Chemnitzer WSV" href="news.php">
News
</a>
</li>
<li>
<a title="Informationen über den Chemnitzer Freizeit- und Wohngebietssportverein und dessen Sektion Judo" href="verein.php">
Verein
</a>
</li>
<li>
<a title="Einige kleine Extras und Helferlein" href="extras.php">
Extras
</a>
</li>
<li>
<a title="Möglichkeiten mit dem Chemnitzer WSV in Kontakt zu treten" href="kontakt.php">
Kontakt
</a>
</li>
</ul>
</nav>
<!-- Der eigentliche Inhalt -->
<div id="content">
<?php // Eine Einzelansicht, falls ein wkInfo ausgefüllt wurde
if( !empty($wkInfo) ){
?>
<h2><?php echo( mb_convert_encoding($wkInfo['Veranstaltung'], 'UTF-8', 'ISO-8859-1') );?></h2>
<ul>
<!-- <li>Datum: <time datetime="<?php echo mb_convert_encoding($wkInfo['Datum'], 'UTF-8', 'ISO-8859-1');?>"><?php echo mb_convert_encoding($wkInfo['Datum'], 'UTF-8', 'ISO-8859-1');?></time></li>-->
<li>Datum: <time datetime="<?php echo mb_convert_encoding($wkInfo['Datum'], 'UTF-8', 'ISO-8859-1');?>"><?php echo strftime("%a, %d. %B %Y", strtotime($wkInfo['Datum']) )?></time></li>
<li>Altersklassen: <?php echo mb_convert_encoding($wkInfo['Altersklassen'], 'UTF-8', 'ISO-8859-1');?></li>
<li>Ort: <a href="<?php echo $wkInfo['Routenplaner'];?>"><?php echo mb_convert_encoding($wkInfo['Ort'], 'UTF-8', 'ISO-8859-1');?></a></li>
</ul>
<nav>
<ul>
<li>
<a href ="<?php echo( mb_convert_encoding($wkInfo['Ausschreibung'], 'UTF-8', 'ISO-8859-1') );?>">
<div>Link zur Ausschreibung</div>
</a>
</li>
<li>
<a href="<?php echo $wkInfo['Routenplaner'];?>">
<div>Link zum Routenplaner</div>
</a>
</li>
<li>
<a href ="/ressourcen/phpLib/calendar.php?wkID=<?php echo $wkInfo['lfdeNr']?>">
<div>Termin in Kalender übernehmen</div>
</a>
</li>
<?php
if( !empty($wkGals) ){
//print_r($wkGals);
foreach($wkGals as $wkGal){
echo("<li><a href=\"".$wkGal[3]."\">".$wkGal[5]."galerie</a></li>");
}
}
?>
</ul>
</nav>
<hr />
<?php
}
else{
echo( $message['error'] );
}
?>
<?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);
?>
<style>
.wkKalender th {
background-color: #666;
color: #fff;
}
.wkKalenderMonth {
background-color: #666;
color: #fff;
}
.wkKalender tr {
background-color: #FFAE00;
color: #000;
}
.wkKalender tr:nth-child(odd) {
background-color: #FF8100 ;
}
</style>
<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";
$lastMonthName = "";
foreach($ergebnis as $wk){
if($lastMonthName != strftime("%B", strtotime($wk['Datum']) )){
$lastMonthName = strftime("%B", strtotime($wk['Datum']) );
echo("<tr><th colspan=\"5\">".$lastMonthName."</th></tr>");
}
?>
<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/pages/desktop/verein.wettkampfkalender.php?wkId=<?php echo mb_convert_encoding($wk['lfdeNr'], '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>
<li>
<a title="Wettkampfplaner der Abteilung Judo des Chemnitzer WSV" href="/pages/desktop/wkParticipo/">
Wett&shy;kampf&shy;pla&shy;ner
</a>
</li>
<?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(!empty($_GET["jahr"])){
$chCounter_page_title .= " ".$_GET["jahr"];
}
if(!empty($wkInfo['Veranstaltung'])){
$chCounter_page_title .= " - ".mb_convert_encoding($wkInfo['Veranstaltung'], 'UTF-8', 'ISO-8859-1');
}
$chCounter_visible=1;
include($_SERVER['DOCUMENT_ROOT']."/expCounter/counter.php");
echo("<!--".$chCounter_page_title."-->");
?>
<!--Ende der Einbindung des Counters-->
</div>
</div>
<?php include($_SERVER['DOCUMENT_ROOT']."/pages/shared/sponsorList.html.inc");?>
<footer>
<p>
<a href="http://validator.w3.org/check?uri=http%3A%2F%2Fcwsvjudo.bplaced.net%2Fpages%2Fdesktop%2Fverein.wettkampfkalender.php<?php echo( urlencode(!empty($_SERVER['QUERY_STRING'])?"?".$_SERVER['QUERY_STRING']:"") );?>">Valid <img src="http://www.w3.org/html/logo/downloads/HTML5_1Color_Black.svg" alt="HTML 5" style="height:1em"></a>
</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>