From 5819a3abcb198fe9ff5bac3a1432d97218aaf202 Mon Sep 17 00:00:00 2001 From: marko Date: Sun, 30 Aug 2020 17:30:04 +0200 Subject: [PATCH 1/4] Added page for setting and removing user attributes --- homepage/wkParticipo/lib/wkParticipo-user.php | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 homepage/wkParticipo/lib/wkParticipo-user.php diff --git a/homepage/wkParticipo/lib/wkParticipo-user.php b/homepage/wkParticipo/lib/wkParticipo-user.php new file mode 100644 index 0000000..5d214d7 --- /dev/null +++ b/homepage/wkParticipo/lib/wkParticipo-user.php @@ -0,0 +1,53 @@ +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]; +} +?> From 4dc97198e67e34b158ddc80aebe8f17603732dba Mon Sep 17 00:00:00 2001 From: marko Date: Sun, 30 Aug 2020 17:57:09 +0200 Subject: [PATCH 2/4] Different changes that were made online --- homepage/wkParticipo/addEvent.php | 10 ++++- homepage/wkParticipo/admin/index.php | 9 ++-- homepage/wkParticipo/admin/listEvents.php | 9 +--- homepage/wkParticipo/admin/showUser.php | 8 ++++ homepage/wkParticipo/index.php | 30 +------------ homepage/wkParticipo/lib/wkParticipo-user.php | 2 + .../lib/wkParticipo-userAttribute.php | 45 ++++++++++++++++++- 7 files changed, 69 insertions(+), 44 deletions(-) diff --git a/homepage/wkParticipo/addEvent.php b/homepage/wkParticipo/addEvent.php index de4df97..275f9cd 100644 --- a/homepage/wkParticipo/addEvent.php +++ b/homepage/wkParticipo/addEvent.php @@ -54,8 +54,14 @@
Benutzerdaten -
/>
-
/>
+
+ + /> +
+
+ + /> +
diff --git a/homepage/wkParticipo/admin/index.php b/homepage/wkParticipo/admin/index.php index ad967ae..12a3ad8 100644 --- a/homepage/wkParticipo/admin/index.php +++ b/homepage/wkParticipo/admin/index.php @@ -15,10 +15,11 @@

Inhalt

-

Neuen Benutzer anlegen.

-

Neuen Event anlegen.

-

User anzeigen.

-

Events anzeigen.

+

Neuen Benutzer anlegen

+

Neuen Event anlegen

+

User anzeigen

+

Events anzeigen

+

Newsletter manuel senden

">Attribute verteilen

diff --git a/homepage/wkParticipo/admin/listEvents.php b/homepage/wkParticipo/admin/listEvents.php index 5c370a9..5a5f906 100644 --- a/homepage/wkParticipo/admin/listEvents.php +++ b/homepage/wkParticipo/admin/listEvents.php @@ -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 @@ } ?> - - - diff --git a/homepage/wkParticipo/admin/showUser.php b/homepage/wkParticipo/admin/showUser.php index 2f856ab..8bded86 100644 --- a/homepage/wkParticipo/admin/showUser.php +++ b/homepage/wkParticipo/admin/showUser.php @@ -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; diff --git a/homepage/wkParticipo/index.php b/homepage/wkParticipo/index.php index aad2387..bc81a01 100644 --- a/homepage/wkParticipo/index.php +++ b/homepage/wkParticipo/index.php @@ -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; -}*/ ?> @@ -72,6 +47,7 @@ return $ret;