Merge branch 'wkParticipo' of /media/marko/mmcblk0p1-mmc-USD00_0x62b76940/gitReops/cwsvJudo into wkParticipo

This commit is contained in:
marko
2021-06-13 07:58:11 +02:00
10 changed files with 484 additions and 22 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

@@ -72,11 +72,8 @@ return $ret;
<nav class="navBar">
<ul>
<<<<<<< Updated upstream
=======
<li><a href="/machs">Achievementsystem</a></li>
<li><a href="./infoZettel.php">Infozettel</a></li>
>>>>>>> Stashed changes
<li>
<a href ="./eventKalender.php">alle geplanten Wettkämpfe als Liste</a>
</li>
@@ -134,7 +131,6 @@ return $ret;
}
else{
foreach($wkEventData as $wkEvent){
// var_dump($wkEvent);
?>
<div class="wkInfoCard">
<time class="wkInfoCardDate" datetime="<?php echo( $wkEvent['date'] );?>">
@@ -241,14 +237,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

@@ -0,0 +1,55 @@
<?php
namespace participo;
$basePath = "/users/cwsvjudo/www";
require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
require_once($basePath."/config/cwsvJudo.config.php");
class user{
public $id;
public $loginName;
public $name;
public $vorname;
public $gebDatum;
public $eMail;
/// Setzen aller Attribute
/// @todo Inputvalidation
function set($userData){
$this->id = $userData["id"];
$this->loginName = $userData["loginName"];
$this->name = $userData["name"];
$this->vorname = $userData["vorname"];
$this->gebDatum = $userData["gebDatum"];
$this->eMail = $userData["eMail"];
return;
}
function toAssoc(){
return array(
"id" => $this->id,
"loginName"=> $this->loginName,
"name" => $this->name,
"vorname" => $this->vorname,
"gebDatum" => $this->gebDatum,
"eMail" => $this->eMail);
}
function loadFromDb($dbConn, $id){
$this->set(
loadUserDataFromDb($dbConn, $id)
);
}
}
/// request user from db via id
/// return user as assoziative array
function loadUserDataFromDb($dbConn, $userId){
return
dbQuery(
$dbConn,
"SELECT * FROM `wkParticipo_Users` WHERE id = :userId;",
array(
":userId"=>array('value'=>(int)$userId, 'data_type'=>\PDO::PARAM_INT)
)
)[0];
}
?>

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"]) );
}
?>

View File

@@ -37,6 +37,7 @@ if (isset($_SESSION['login'])) {
),
);
$message['success'] = 'Anmeldung erfolgreich, <a href="index.php">weiter zum Inhalt.';
// PHPCount::AddHit("wkParticipo-Login ".$_POST['f']['username']);
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/pages/desktop/wkParticipo/index.php?user=' . $_POST['f']['username']);
} else {
sleep(1);