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; ?>
<fieldset>
<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><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>
<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>
<div><input type="submit" name="submit" value="Erstellen" /></div>

View File

@@ -15,10 +15,11 @@
<body>
<?php echo $login_status; ?>
<h1>Inhalt</h1>
<p><a href="./register.php">Neuen Benutzer 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="./listEvents.php">Events anzeigen.</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="./listUsers.php">User 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>
</body>
</html>

View File

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

View File

@@ -3,9 +3,12 @@
require_once('../auth.php');
require_once('../local/db.php.inc');
require_once('../lib/wkParticipoLib.inc.php');
require_once('../lib/wkParticipo-user.php');
$message = array();
$eventData = array();
$user = new participo\user();
if(empty($_POST)){
$message['error'] = "Fehler: leeres POST!";
@@ -16,6 +19,11 @@
}
else{
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);
if ($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) {
$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>
<html>
@@ -72,6 +47,7 @@ return $ret;
<nav class="navBar">
<ul>
<li><a href="./infoZettel.php">Infozettel</a></li>
<li>
<a href ="./eventKalender.php">alle geplanten Wettkämpfe als Liste</a>
</li>
@@ -129,7 +105,6 @@ return $ret;
}
else{
foreach($wkEventData as $wkEvent){
// var_dump($wkEvent);
?>
<div class="wkInfoCard">
<time class="wkInfoCardDate" datetime="<?php echo( $wkEvent['date'] );?>">
@@ -236,14 +211,11 @@ return $ret;
<?php
}
else{
// var_dump($wkEvents);
foreach( $wkEvents as $wk){
//print_r($wk);
$wkEvent = getWkEventData($mysqlConn, $wk['id'], array('outCharset'=>"UTF-8"));
?>
<h3><?php echo( $wkEvent['Veranstaltung'] );?></h3>
<?php
//var_dump($wkEvent);
echo(
htmlWkEvent(
$wkEvent,

View File

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

View File

@@ -27,6 +27,23 @@ $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
///
/// @param $aDbConnection PDO-Datenbankverbindung, die benutzt werden soll
@@ -185,13 +202,37 @@ $userAttributes =
<?php echo(array2htmlTableString($userAttributes));?>
<?php
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 =
dbQuery(
$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))
);
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"]) );
}
?>