From fd62691c1708bc846d5d53abab5fb6e9db746fcd Mon Sep 17 00:00:00 2001 From: marko Date: Sun, 3 Jul 2022 19:39:51 +0200 Subject: [PATCH] activate modal on events app card, add class for user --- homepage/participo/events.php | 12 ++-- homepage/participo/index.php | 2 +- .../participo/lib/participoLib/participo.php | 72 ++++++++++++++++++- .../participo/lib/participoLib/planer.php | 27 +++++-- 4 files changed, 96 insertions(+), 17 deletions(-) diff --git a/homepage/participo/events.php b/homepage/participo/events.php index 39fcf27..9e31b89 100644 --- a/homepage/participo/events.php +++ b/homepage/participo/events.php @@ -19,12 +19,12 @@ include_once("events.inc.php"); // specify options here }); }); - document.addEventListener('DOMContentLoaded', function() { - var elems = document.querySelectorAll('.modal'); - var instances = M.Modal.init(elems, { - // specify options here - }); - }); + // document.addEventListener('DOMContentLoaded', function() { + // var elems = document.querySelectorAll('.modal'); + // var instances = M.Modal.init(elems, { + // // specify options here + // }); + // }); // Open the given modal document.addEventListener('DOMContentLoaded', function () { diff --git a/homepage/participo/index.php b/homepage/participo/index.php index 57d0b23..b589754 100644 --- a/homepage/participo/index.php +++ b/homepage/participo/index.php @@ -102,7 +102,7 @@ echo( AppCard::fromArray([ 'link' => '/pages/desktop/wkParticipo', 'title' => 'Event-Planer', - 'description' => 'Organisieren der Teilnahmen (und nicht-Teilnahmen) an Wettkämpfen, Sondertrainingseinheiten, Feiern etc.

' . eventPlaner::getHtmlEventTable(eventPlaner::getCommingWkEvents()) . '

', + 'description' => 'Organisieren der Teilnahmen (und nicht-Teilnahmen) an Wettkämpfen, Sondertrainingseinheiten, Feiern etc.' . eventPlaner::getHtmlEventTable(eventPlaner::getCommingWkEvents()), 'imgUrl' => '/ressourcen/graphiken/icons/terminKalender.svg', 'actions' => [ AppCardAction::fromArray(['caption' => 'Planer', 'link' => '/pages/desktop/wkParticipo']), diff --git a/homepage/participo/lib/participoLib/participo.php b/homepage/participo/lib/participoLib/participo.php index 4ea60e3..e161304 100644 --- a/homepage/participo/lib/participoLib/participo.php +++ b/homepage/participo/lib/participoLib/participo.php @@ -214,11 +214,11 @@ class AppCard{ return "

". "
". - (($this->link!=null)?("link."\">"):(""))."
". - "".$this->title."". + "
". + (($this->link!=null)?("link."\">"):(""))."".$this->title."".(($this->link!=null)?(""):("")). (($this->imgUrl!=null)?("\"".$this-title."\" style=\"display:block;margin-left:auto;margin-right:auto;max-height:10vh;\" class=\"responsive-img\" src=\"".$this->imgUrl."\" />"):("")). "

".$this->description."

". - "
".(($this->link!=null)?(""):("")). + "
". "
".$actionListCode."
". "
". "
"; @@ -474,4 +474,70 @@ class dbConnector{ } + +/** + * User for the Participo system + */ +class user{ + private $id; + private $loginName; + private $name; + private $firstName; + private $dateOfBirth; + private $eMail; + + public function __construct($id, $loginName, $name, $firstName, $dateOfBirth, $eMail) + { + $this->id = (int) id; + $this->loginName = $loginName; + $this->name = $name; + $this->firstName = $firstName; + $this->dateOfBirth = $dateOfBirth!=null?DateTime::createFromFormat('Y-m-d', $dateOfBirth):null; + $this->eMail = $eMail; + } + + /** + * Create a User from an assoziative array + * + * @param array $member associative array with the UserData from the dbRequest + * @return User initialized user + */ + public static function fromArray($member){ + return new User( + $member['id']??null, + $member['loginName']??null, + $member['name']??null, + $member['vorname']??null, + $member['gebDatum']??null, + array_key_exist('eMail', $member)?explode(',', $member['eMail']):null + ); + } + + /// 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) + ); + } +} + ?> \ No newline at end of file diff --git a/homepage/participo/lib/participoLib/planer.php b/homepage/participo/lib/participoLib/planer.php index ea7ea0c..12099af 100644 --- a/homepage/participo/lib/participoLib/planer.php +++ b/homepage/participo/lib/participoLib/planer.php @@ -84,8 +84,8 @@ class shiai '
Datum:
' . $this->getHtmlDate() . '
' . '
Altersklassen
' . $this->getAgeClasses() . '
' . '
Ort
' . $this->getPlace() . '
' . - ''; - + '' . + ''; return $retHtml; } } // end class shiai @@ -142,10 +142,13 @@ class event public function htmlModal() { return - '