- Funktion zum Erzeugen einer Datenbankverbindung ergänzt

modified:   homepage/redesign2018/markdownExperiment/phpLib/cwsvJudo/miscAssis.php
- Anzahl der Teilnehmer wird jetzt getrennt in Kämpfer und Zuschauer; nicht teilnehmende, aber eingeschriebene Starter werden ignoriert
	modified:   homepage/redesign2018/markdownExperiment/wkParticipo/admin/listUsers.php
	modified:   homepage/redesign2018/markdownExperiment/wkParticipo/index.php
	modified:   homepage/redesign2018/markdownExperiment/wkParticipo/lib/wkParticipoLib.inc.php
This commit is contained in:
marko
2018-10-18 13:55:26 +02:00
parent 806ba97821
commit 0b5a1e26d8
4 changed files with 47 additions and 7 deletions

View File

@@ -4,6 +4,20 @@ function is_positive_integer($str){
return (is_numeric($str) && $str > 0 && $str == round($str)); return (is_numeric($str) && $str > 0 && $str == round($str));
} }
function getPdoDbConnection($hostname, $dbName, $user, $password){
try{
$dbConnection = new PDO(
'mysql:host='.$hostname.';dbname='.$dbName,
$user,
$password
);
}
catch(PDOException $dbError){
echo( "Error whilst getting a dbConnection!: " . $dbError->getMessage() );
}
return $dbConnection;
}
function getCwsvJudoDbConn(){ function getCwsvJudoDbConn(){
global $cwsvJudoConfig; global $cwsvJudoConfig;
// Datenbankverbindung bereit stellen // Datenbankverbindung bereit stellen

View File

@@ -1,8 +1,18 @@
<?php <?php
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once('../local/wkParticipoConf.php.inc'); require_once('../local/wkParticipoConf.php.inc');
require_once('../auth.php'); require_once('../auth.php');
require_once('../local/db.php.inc'); require_once('../local/db.php.inc');
require_once('../lib/wkParticipoLib.inc.php'); require_once('../lib/wkParticipoLib.inc.php');
$basePath = "/users/cwsvjudo/www";
// require_once($basePath."/config/phpcount.config.php");
require_once($basePath."/config/cwsvJudo.config.php");
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
$pdoDbConn = getCwsvJudoDbConn();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>

View File

@@ -5,6 +5,10 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once('./local/db.php.inc'); require_once('./local/db.php.inc');
require_once('./lib/wkParticipoLib.inc.php'); 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");
$sqlMessage = array(); $sqlMessage = array();
$mysqlConn = @new mysqli($db_server, $db_user, $db_password, $db_name); $mysqlConn = @new mysqli($db_server, $db_user, $db_password, $db_name);
@@ -189,7 +193,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
<hr /> <hr />
<h2 id="wettkaempfen">Anstehende Wettkämpfe</h2> <h2 id="wettkaempfen">Anstehende Wettkämpfe</h2>
Nicht wundern, dass hier eventuell etwas doppelt steht! Ich experimentiere gerade. <!--Nicht wundern, dass hier eventuell etwas doppelt steht! Ich experimentiere gerade.-->
<?php <?php
$wkEvents = getCommingWkEvents($mysqli, array('outCharset'=>"UTF-8") ); $wkEvents = getCommingWkEvents($mysqli, array('outCharset'=>"UTF-8") );

View File

@@ -1201,6 +1201,7 @@ return $url;
function htmlWkEvent($aWkEvent, $starters, $fahrten){ function htmlWkEvent($aWkEvent, $starters, $fahrten){
//var_dump($aWkEvent, $starters, $fahrten); //var_dump($aWkEvent, $starters, $fahrten);
$retHtml = ""; $retHtml = "";
if( empty($aWkEvent['Datum']) ) if( empty($aWkEvent['Datum']) )
@@ -1209,6 +1210,10 @@ $retHtml = "";
foreach($fahrten as $fahrt) foreach($fahrten as $fahrt)
$anzPlätze += $fahrt['plaetze']; $anzPlätze += $fahrt['plaetze'];
$anzahlKaempfer = array_count_values(array_column($starters, 'type'))['1'];
$anzahlZuschauer = array_count_values(array_column($starters, 'type'))['2'];
$heuteDateTime = DateTimeImmutable::createFromFormat("Y-m-d", date("Y-m-d")); $heuteDateTime = DateTimeImmutable::createFromFormat("Y-m-d", date("Y-m-d"));
$einschreibeDateTime = DateTimeImmutable::createFromFormat("Y-m-d", $aWkEvent['meldefrist']); $einschreibeDateTime = DateTimeImmutable::createFromFormat("Y-m-d", $aWkEvent['meldefrist']);
@@ -1235,10 +1240,17 @@ $retHtml = "";
"</div>" "</div>"
)."</dd>". )."</dd>".
(!empty($_SESSION['login'])? (!empty($_SESSION['login'])?
"<dt>angemeldete Starter</dt><dd>".( "<dt>eingeschriebene Starter</dt><dd>".(
empty($starters)? ( $anzahlKaempfer == 0 )?
"Noch hat sich niemand für diesen Wettkampf gemeldet!": "Noch hat sich niemand für diesen Wettkampf eingeschrieben!":
count($starters) $anzahlKaempfer
)."</dd>"
:"").
(!empty($_SESSION['login'])?
"<dt>eingeschriebene Zuschauer</dt><dd>".(
( $anzahlZuschauer == 0 )?
"Noch will sich niemand diesen Wettkampf anschauen!":
$anzahlZuschauer
)."</dd>" )."</dd>"
:""). :"").
(empty($_SESSION['login'])? (empty($_SESSION['login'])?
@@ -1257,7 +1269,7 @@ $retHtml = "";
). ).
"</form></dd>" "</form></dd>"
). ).
"<dt" . ( ($anzPlätze<count($starters)) ? " style=\"color: red\"" : "" ) . ">Anzahl Mitfahrgelegenheiten</dt><dd>" . $anzPlätze . "</dd>". "<dt" . ( ($anzPlätze<($anzKaempfer+$anzZuschauer)) ? " style=\"color: red\"" : "" ) . ">Anzahl Mitfahrgelegenheiten</dt><dd>" . $anzPlätze . "</dd>".
(empty($_SESSION['login'])? (empty($_SESSION['login'])?
"<dd>Das Anbieten von Mitfahrgelegenheiten ist nur eingeloggt möglich!</dd>" "<dd>Das Anbieten von Mitfahrgelegenheiten ist nur eingeloggt möglich!</dd>"
:"<dd><form action=\"./addFahrt.php\" method=\"post\">". :"<dd><form action=\"./addFahrt.php\" method=\"post\">".