Different changes that were made online

This commit is contained in:
marko
2020-08-30 17:57:09 +02:00
parent 5819a3abcb
commit 4dc97198e6
7 changed files with 69 additions and 44 deletions

View File

@@ -54,8 +54,14 @@
<?php endif; ?> <?php endif; ?>
<fieldset> <fieldset>
<legend>Benutzerdaten</legend> <legend>Benutzerdaten</legend>
<div><label for="wkId">wkId</label> <input type="text" name="f[wkId]" id="wkId"<?php echo isset($_POST['f']['wkId']) ? ' value="' . htmlspecialchars($_POST['f']['wkId']) . '"' : '' ?> /></div> <div>
<div><label for="meldefrist">meldefrist</label> <input type="text" name="f[meldefrist]" id="meldefrist" <?php echo isset($_POST['f']['meldefrist']) ? ' value="' . htmlspecialchars($_POST['f']['meldefrist']) . '"' : '' ?> /></div> <label for="wkId">wkId</label>
<input type="text" name="f[wkId]" id="wkId"<?php echo isset($_POST['f']['wkId']) ? ' value="' . htmlspecialchars($_POST['f']['wkId']) . '"' : '' ?> />
</div>
<div>
<label for="meldefrist">meldefrist</label>
<input type="text" name="f[meldefrist]" id="meldefrist" <?php echo isset($_POST['f']['meldefrist']) ? ' value="' . htmlspecialchars($_POST['f']['meldefrist']) . '"' : '' ?> />
</div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<div><input type="submit" name="submit" value="Erstellen" /></div> <div><input type="submit" name="submit" value="Erstellen" /></div>

View File

@@ -15,10 +15,11 @@
<body> <body>
<?php echo $login_status; ?> <?php echo $login_status; ?>
<h1>Inhalt</h1> <h1>Inhalt</h1>
<p><a href="./register.php">Neuen Benutzer anlegen.</a></p> <p><a href="./register.php">Neuen Benutzer anlegen</a></p>
<p><a href="./addEvent.php">Neuen Event anlegen.</a></p> <p><a href="./addEvent.php">Neuen Event anlegen</a></p>
<p><a href="./listUsers.php">User anzeigen.</a></p> <p><a href="./listUsers.php">User anzeigen</a></p>
<p><a href="./listEvents.php">Events anzeigen.</a></p> <p><a href="./listEvents.php">Events anzeigen</a></p>
<p><a href="./newsLetter.php?sendNewsletter">Newsletter manuel senden</a></p>
<p><a href="<?php echo( $baseUrl."/lib/wkParticipo-userAttribute.php");?>">Attribute verteilen</a></p> <p><a href="<?php echo( $baseUrl."/lib/wkParticipo-userAttribute.php");?>">Attribute verteilen</a></p>
</body> </body>
</html> </html>

View File

@@ -25,7 +25,8 @@
echo $message['error']; die(); echo $message['error']; die();
} }
$eventList = getAllEvents($mysqli); // $eventList = getAllEvents($mysqli);
$eventList = getCommingWkEvents($mysqli);
foreach($eventList as $event){ foreach($eventList as $event){
// $wkData = getWkData($mysqli, $event['wkId']); // $wkData = getWkData($mysqli, $event['wkId']);
$wkData = getWkEventData($mysqli, $event['id']); $wkData = getWkEventData($mysqli, $event['id']);
@@ -49,12 +50,6 @@
} }
?> ?>
</ul> </ul>
<!--Beginn der Einbindung des Counters-->
<?php
$chCounter_page_title = "Wettkampfplanung - Administration - eventList";
$chCounter_visible=0;
//include( $_SERVER['DOCUMENT_ROOT'].'/expCounter/counter.php');?>
</body> </body>
</html> </html>

View File

@@ -3,9 +3,12 @@
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');
require_once('../lib/wkParticipo-user.php');
$message = array(); $message = array();
$eventData = array(); $eventData = array();
$user = new participo\user();
if(empty($_POST)){ if(empty($_POST)){
$message['error'] = "Fehler: leeres POST!"; $message['error'] = "Fehler: leeres POST!";
@@ -16,6 +19,11 @@
} }
else{ else{
if( (string)(int)$_POST['f']['userId'] == $_POST['f']['userId'] ){ if( (string)(int)$_POST['f']['userId'] == $_POST['f']['userId'] ){
$user->loadFromDb(getCwsvJudoDbConn(), $_POST['f']['userId']);
var_dump($_POST);
var_dump($user);
var_dump($user->toAssoc());
$mysqli = @new mysqli($db_server, $db_user, $db_password, $db_name); $mysqli = @new mysqli($db_server, $db_user, $db_password, $db_name);
if ($mysqli->connect_error) { if ($mysqli->connect_error) {
$message['error'] = 'Datenbankverbindung fehlgeschlagen: ' . $mysqli->connect_error; $message['error'] = 'Datenbankverbindung fehlgeschlagen: ' . $mysqli->connect_error;

View File

@@ -18,31 +18,6 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
if ($mysqlConn->connect_error) { if ($mysqlConn->connect_error) {
$sqlMessage['error'] .= 'Datenbankverbindung fehlgeschlagen: ' . $mysqlConn->connect_error; $sqlMessage['error'] .= 'Datenbankverbindung fehlgeschlagen: ' . $mysqlConn->connect_error;
} }
// var_dump($_SESSION);
/// Stellt den cssCode mit den Variablendefinitionen bereit
/*
function colorThemeCss($colorArray = array('backgroundColor'=>"#FFAE00", 'highlightColor'=>"#FF8100", 'buttonColor'=>"#291670")){
//$colorTypes = ["backgroundColor", "highlightColor", "buttonColor"];
$defaultColors =['backgroundColor'=> "#FFAE00", 'highlightColor'=>"#FF8100", 'buttonColor'=>"#291670"];
//echo("DBG: colorArray:"); var_dump($colorArray);
// Inputdatenvalidierung
foreach($defaultColors as $key=>$value){
if( !preg_match("/^#(?:[0-9a-fA-F]{3}){1,2}$/", $colorArray[$key]) ){
$colorArray[$key] = $defaultColors[$key];
}
}
$ret = ":root{";
foreach($colorArray as $key=>$value){
$ret .= "--".$key.": ".$value."; ";
}
$ret .= "}";
return $ret;
}*/
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@@ -72,6 +47,7 @@ return $ret;
<nav class="navBar"> <nav class="navBar">
<ul> <ul>
<li><a href="./infoZettel.php">Infozettel</a></li>
<li> <li>
<a href ="./eventKalender.php">alle geplanten Wettkämpfe als Liste</a> <a href ="./eventKalender.php">alle geplanten Wettkämpfe als Liste</a>
</li> </li>
@@ -129,7 +105,6 @@ return $ret;
} }
else{ else{
foreach($wkEventData as $wkEvent){ foreach($wkEventData as $wkEvent){
// var_dump($wkEvent);
?> ?>
<div class="wkInfoCard"> <div class="wkInfoCard">
<time class="wkInfoCardDate" datetime="<?php echo( $wkEvent['date'] );?>"> <time class="wkInfoCardDate" datetime="<?php echo( $wkEvent['date'] );?>">
@@ -236,14 +211,11 @@ return $ret;
<?php <?php
} }
else{ else{
// var_dump($wkEvents);
foreach( $wkEvents as $wk){ foreach( $wkEvents as $wk){
//print_r($wk);
$wkEvent = getWkEventData($mysqlConn, $wk['id'], array('outCharset'=>"UTF-8")); $wkEvent = getWkEventData($mysqlConn, $wk['id'], array('outCharset'=>"UTF-8"));
?> ?>
<h3><?php echo( $wkEvent['Veranstaltung'] );?></h3> <h3><?php echo( $wkEvent['Veranstaltung'] );?></h3>
<?php <?php
//var_dump($wkEvent);
echo( echo(
htmlWkEvent( htmlWkEvent(
$wkEvent, $wkEvent,

View File

@@ -13,6 +13,8 @@ class user{
public $gebDatum; public $gebDatum;
public $eMail; public $eMail;
/// Setzen aller Attribute
/// @todo Inputvalidation
function set($userData){ function set($userData){
$this->id = $userData["id"]; $this->id = $userData["id"];
$this->loginName = $userData["loginName"]; $this->loginName = $userData["loginName"];

View File

@@ -27,6 +27,23 @@ $ret = "";
return $ret; return $ret;
} }
function arrayKeyed2htmlTableString($anArray, $keyList){
$ret = "";
if( !is_array($anArray) )
return "";
$ret .= "<table>";
foreach($anArray as $row){
if( !is_array($anArray) )
continue;
$ret .= "<tr>";
foreach( $keyList as $key )
$ret .= "<td>".$row[$key]."</td>";
$ret .= "</tr>";
}
$ret .= "</table>";
return $ret;
}
/// einem User ein Attribut zuordnen /// einem User ein Attribut zuordnen
/// ///
/// @param $aDbConnection PDO-Datenbankverbindung, die benutzt werden soll /// @param $aDbConnection PDO-Datenbankverbindung, die benutzt werden soll
@@ -185,13 +202,37 @@ $userAttributes =
<?php echo(array2htmlTableString($userAttributes));?> <?php echo(array2htmlTableString($userAttributes));?>
<?php <?php
foreach($userAttributes as $userAttribute){ foreach($userAttributes as $userAttribute){
echo("<h2>".$userAttribute["name"]."</h2>");
// get the users with the attribute by a cross join
// remark: there are two id-columns, from which one gets lost (the one from the user) in the phpArray.
// so we (have to) use the userId from the attribute
// in short attributed => userId, unattributed => id (is the id of the user)
$attributedUsers = $attributedUsers =
dbQuery( dbQuery(
$dbConn, $dbConn,
"SELECT * FROM wkParticipo_Users, `wkParticipo_user<=>userAttributes` WHERE wkParticipo_Users.id = `wkParticipo_user<=>userAttributes`.userId AND `wkParticipo_user<=>userAttributes`.attributeId=:attributeId;", "SELECT * FROM wkParticipo_Users, `wkParticipo_user<=>userAttributes` WHERE wkParticipo_Users.id = `wkParticipo_user<=>userAttributes`.userId AND `wkParticipo_user<=>userAttributes`.attributeId = :attributeId;",
array(":attributeId"=>array('value'=>$userAttribute['id'], 'data_type'=>PDO::PARAM_INT)) array(":attributeId"=>array('value'=>$userAttribute['id'], 'data_type'=>PDO::PARAM_INT))
); );
echo( "<h2>".$userAttribute['name']."</h2>".array2htmlTableString($attributedUsers) ); // Add a withthraw link entry
foreach($attributedUsers as $index => $user){
$attributedUsers[$index] += ["withdrawLink" => "<a href=\"?action=withdrawUsersAttribute&userId=".$user["userId"]."&attributeId=".$userAttribute["id"]."\">withdraw ".$userAttribute["name"]."</a>"];
}
echo( "<h3>have it</h3>".arrayKeyed2htmlTableString($attributedUsers, ["userId", "name", "vorname", "withdrawLink"]) );
$attributedKeyList = [];
foreach($attributedUsers as $user){
$attributedKeyList[] = $user["userId"];
}
$unattributedUsers = array();
foreach($users as $user){
if(!in_array($user["id"], $attributedKeyList)){
$unattributedUsers[] = $user;
}
}
// Add a giveAttribute link entry to every user
foreach($unattributedUsers as $index => $user){
$unattributedUsers[$index] += ["giveAttributeLink" => "<a href=\"?action=giveUserAnUserAttribute&userId=".$user["id"]."&attributeId=".$userAttribute["id"]."\">give Attribute ".$userAttribute["name"]."</a>"];
}
echo( "<h3>give it</h3>".arrayKeyed2htmlTableString($unattributedUsers, ["id", "name", "vorname", "giveAttributeLink"]) );
} }
?> ?>