From 7c9f4b8baa72e19057d2ebc4f14154adc481aa81 Mon Sep 17 00:00:00 2001 From: marko Date: Wed, 9 Jan 2019 07:31:52 +0100 Subject: [PATCH] Erweiterungen am Wettkampkalender: - wettkampfkalenderlose Events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - neue Funktion zur Ausführung einer DatenbankAbfrage modified: markdownExperiment/phpLib/cwsvJudo/miscAssis.php - URL der Wettkämpfe um Wetkampfname erweitert modified: markdownExperiment/phpLib/cwsvJudo/wkKalender.php - events haben jetzt ein eigenes Datum und nehmen es nicht mehr aus dem zugeordneten Wettkampf (für die events ohne zugehörigen Eintrag im Wettkampfkalender) modified: markdownExperiment/wkParticipo/addEvent.php modified: markdownExperiment/wkParticipo/admin/addEvent.php - In der Adminansicht eines Events können jetzt auch Starter eintfernt werden; @todo: Was noch fehlt ist die Behandlung der Fahrten! modified: markdownExperiment/wkParticipo/admin/showEvent.php - dbQuery wurde in cwsvJudoe/miscAssis eingepflegt. modified: markdownExperiment/wkParticipo/lib/wkParticipo-userAttribute.php --- .../phpLib/cwsvJudo/miscAssis.php | 44 ++++++++++++++++++- .../phpLib/cwsvJudo/wkKalender.php | 2 +- .../wkParticipo/addEvent.php | 8 ++-- .../wkParticipo/admin/addEvent.php | 13 ++++-- .../wkParticipo/admin/showEvent.php | 36 ++++++++++++++- .../lib/wkParticipo-userAttribute.php | 41 ----------------- 6 files changed, 93 insertions(+), 51 deletions(-) diff --git a/homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/miscAssis.php b/homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/miscAssis.php index ec8f622..e89e127 100644 --- a/homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/miscAssis.php +++ b/homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/miscAssis.php @@ -23,7 +23,7 @@ global $cwsvJudoConfig; // Datenbankverbindung bereit stellen try{ $db_connection = new PDO( - 'mysql:host='.$cwsvJudoConfig["db"]["host"].';dbname='.$cwsvJudoConfig["db"]["name"], + 'mysql:host='.$cwsvJudoConfig["db"]["host"].';dbname='.$cwsvJudoConfig["db"]["name"],//.';charset=utf8', $cwsvJudoConfig["db"]["user"], $cwsvJudoConfig["db"]["password"] ); @@ -161,4 +161,46 @@ function toAscii($str, $replace=array(), $delimiter='-') { return $clean; } + +function dbQuery($aDbConnection, $aQueryString, $aBindArray = array(), $someOptions = array( "dbCharset" => "ISO-8859-1", "outCharset" => "UTF-8" ) ){ +//echo("Doing ".$aQueryString); +var_dump($aBindArray); +if( empty($someOptions['dbCharset']) ) $someOptions['dbCharset'] = "ISO-8859-1"; +if( empty($someOptions['outCharset']) ) $someOptions['outCharset'] = "UTF-8"; +/// @toDo: Bisher wird nur die Rückgabe konvertiert. Eigentlich muss +/// doch auch die Eingabe konvertiert werden. Aber das jetzt +/// umzustellen wird schwer! Die User m Wettkampfplaner sind ja z.B. +/// als UTF8 in latin1(?) gespeichert. + try{ + $pdoStatement = $aDbConnection->prepare( $aQueryString ); + foreach( $aBindArray as $bindName => $bind ){ + $pdoStatement->bindValue( + $bindName, + $bind['value'], + (isset($bind['data_type'])?$bind['data_type']:PDO::PARAM_STR) + ); + } + $pdoStatement->execute(); + $ret = $pdoStatement->fetchAll(PDO::FETCH_ASSOC); + } + catch(PDOException $db_error){ + print "Error!: " . $db_error->getMessage() . "
"; + return null; + } + //var_dump($ret); +// Zeichensatzkonvertierung + if( is_array($ret) ){ + foreach($ret as &$entry){ + array_walk( + $entry, + function (&$value, $key, $someOptions) { + $value = iconv($someOptions['dbCharset'], $someOptions['outCharset'], $value); + }, + $someOptions + ); + } + } +return $ret; +} + ?> diff --git a/homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/wkKalender.php b/homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/wkKalender.php index 4a9e3be..52bbbf9 100644 --- a/homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/wkKalender.php +++ b/homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/wkKalender.php @@ -200,7 +200,7 @@ $htmlWkTableString = ""; str_replace("mannschaft", "mann­schaft", $wk['Veranstaltung']); $htmlWkTableString .= - "". + "". "". "". "