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