From bfb024d288ff5562353e125fe6cb6f5d8dcbb2ad Mon Sep 17 00:00:00 2001 From: marko Date: Thu, 23 Dec 2021 17:04:53 +0100 Subject: [PATCH 1/7] layout corrections --- homepage/participo/css/parsedownCard.css | 9 +- homepage/participo/images/info.svg | 164 +++++++++++++++--- .../participo/lib/participoLib/participo.php | 2 +- homepage/participo/machs.php | 12 ++ homepage/wkParticipo/infoZettel.php | 2 +- 5 files changed, 166 insertions(+), 23 deletions(-) create mode 100644 homepage/participo/machs.php diff --git a/homepage/participo/css/parsedownCard.css b/homepage/participo/css/parsedownCard.css index 99f4a47..6bc18cb 100644 --- a/homepage/participo/css/parsedownCard.css +++ b/homepage/participo/css/parsedownCard.css @@ -3,4 +3,11 @@ } .parsedownCard h2{ font-size: 1.75rem; -} \ No newline at end of file +} +.parsedownCard ul li { + list-style-type: disc; +} +.parsedownCard img{ + max-width: 100%; +} + diff --git a/homepage/participo/images/info.svg b/homepage/participo/images/info.svg index 2356748..b9a5ef1 100644 --- a/homepage/participo/images/info.svg +++ b/homepage/participo/images/info.svg @@ -1,21 +1,145 @@ - - - - - - - - - - - - - - - i - - - - nfo - + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + i + + nfo diff --git a/homepage/participo/lib/participoLib/participo.php b/homepage/participo/lib/participoLib/participo.php index b0eaa15..29ed584 100644 --- a/homepage/participo/lib/participoLib/participo.php +++ b/homepage/participo/lib/participoLib/participo.php @@ -78,7 +78,7 @@ class AppCard{ return "
". "
". - (($this->link!=null)?("appLink."\">"):(""))."
". + (($this->link!=null)?("link."\">"):(""))."
". "".$this->title."". (($this->imgUrl!=null)?("imgUrl."\" />"):("")). "

".$this->description."

". diff --git a/homepage/participo/machs.php b/homepage/participo/machs.php new file mode 100644 index 0000000..b86864c --- /dev/null +++ b/homepage/participo/machs.php @@ -0,0 +1,12 @@ + diff --git a/homepage/wkParticipo/infoZettel.php b/homepage/wkParticipo/infoZettel.php index 777443e..aac7966 100644 --- a/homepage/wkParticipo/infoZettel.php +++ b/homepage/wkParticipo/infoZettel.php @@ -49,7 +49,7 @@ }
Date: Fri, 24 Dec 2021 11:34:42 +0100 Subject: [PATCH 2/7] bring list of next events to eventPlaner appCard (currently breakes appCardLinking) --- homepage/participo/css/parsedownCard.css | 3 + homepage/participo/index.php | 96 +++++++++++++++++-- .../participo/lib/participoLib/participo.php | 4 +- homepage/participo/machs.php | 1 + 4 files changed, 96 insertions(+), 8 deletions(-) diff --git a/homepage/participo/css/parsedownCard.css b/homepage/participo/css/parsedownCard.css index 6bc18cb..22fe9f9 100644 --- a/homepage/participo/css/parsedownCard.css +++ b/homepage/participo/css/parsedownCard.css @@ -4,6 +4,9 @@ .parsedownCard h2{ font-size: 1.75rem; } +.parsedownCard h3{ + font-size: 1.5rem; +} .parsedownCard ul li { list-style-type: disc; } diff --git a/homepage/participo/index.php b/homepage/participo/index.php index a30f3cd..db9f924 100644 --- a/homepage/participo/index.php +++ b/homepage/participo/index.php @@ -21,6 +21,90 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge'); $cwsvJudoConfig["db"]["password"] ); $userData = getUserData($dbConnection, $_SESSION['user']['userId']); + +function getCommingWkEvents($dbConn, $someOptions=array() ){ + // wir befinden uns in der Übergangsphase: + // - als Standard wird das derzeitige Verhalten definiert (ISO-8859-1 + // und die Konvertierung erfolgt ausserhalb) + // - wenn einmal alle mbConvertEncoding weg sind, kann der Standard auf + // das gewünschte Verhalten umgestellt werden + $dbCharset = $someOptions['dbCharset'] ?? "ISO-8859-1"; + // dbCharset = $someOptions['outCharset'] ?? "UTF-8";// das spätere, gewünschte Verhalten + $outCharset = $someOptions['outCharset'] ?? "ISO-8859-1"; + + $query = + "SELECT ". + "wkParticipo_Events.id, ". + "wkParticipo_Events.date, ". + "wkParticipo_Events.wkId, ". + "wkParticipo_Events.meldefrist, ". + "wkParticipo_Events.bemerkungen, ". + "wkParticipo_Events.kvOptions, ". + "wettkampfkalender.Datum, ". + "wettkampfkalender.Veranstaltung, ". + "wettkampfkalender.Altersklassen, ". + "wettkampfkalender.Ort, ". + "wettkampfkalender.Ausschreibung, ". + "wettkampfkalender.Routenplaner ". + "FROM wkParticipo_Events ". + "LEFT JOIN wettkampfkalender ". + "ON wettkampfkalender.lfdeNr = wkParticipo_Events.wkId ". + "WHERE wkParticipo_Events.date >= CURDATE() ". + "ORDER BY wkParticipo_Events.date;"; + $ret = dbQuery($dbConn, $query); + // $results = $anMysqlConn->query($query); + + // // Bei einem Fehler bei der Abfrage soll NULL zurückgeliefert werden + // if( !$results ){ + // echo("No Results: ".$anMysqlConn->error); + // return NULL; + // } + // // Bei einem leeren Ergebnis (NULL oder leeres Array) soll ein leeres Array zurückgeliefert werden + // if( empty($results) ) return array(); + + // while( $result = $results->fetch_assoc() ){ + // array_walk( + // $result, + // function (&$value, $key, $someOptions) { + // $value = iconv($someOptions['dbCharset'], $someOptions['outCharset'], $value); + // }, + // $someOptions + // ); + // array_push( $ret, $result); + // } + return $ret; +} + +// array(12) { +// ["id"]=> string(3) "139" +// ["date"]=> string(10) "2021-12-29" +// ["wkId"]=> string(0) "" +// ["meldefrist"]=> string(10) "2021-12-28" +// ["bemerkungen"]=> string(374) "{ "Datum": "2021-12-29", "Veranstaltung": "Jahresabschlusstraining", "Altersklassen": "alle", "bemerkungen": " + +// Zum Abschluss des Jahres noch einmal eine kleine Einheit hauptsächlich zum Spielen +// Zeit: 16:00--19:00 Uhr + +// ", "Ort": "unser Dojo, Str. Usti nad Labem 42, 09120 Chemnitz", "Routenplaner": "https://osm.org/go/0MIYhLf3Q-" }" +// ["kvOptions"]=> string(0) "" +// ["Datum"]=> string(0) "" +// ["Veranstaltung"]=> string(0) "" +// ["Altersklassen"]=> string(0) "" +// ["Ort"]=> string(0) "" +// ["Ausschreibung"]=> string(0) "" +// ["Routenplaner"]=> string(0) "" +// } +function getHtmlEventTable($eventList){ + $ret = ""; + foreach($eventList as $event){ + $e = json_decode($event['bemerkungen'], true); + $e = (($e==null)?$event:$e); + $e['id']=$event['id']; + $ret .= ""; + } + $ret .= "
".$e['Datum']."".$e['Veranstaltung']."
"; + return $ret; +} ?> @@ -65,10 +149,10 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
"; diff --git a/homepage/participo/machs.php b/homepage/participo/machs.php index b86864c..005b180 100644 --- a/homepage/participo/machs.php +++ b/homepage/participo/machs.php @@ -1,4 +1,5 @@ Date: Sat, 25 Dec 2021 17:25:55 +0100 Subject: [PATCH 3/7] bring back modern look for achievement cards --- homepage/machs/index.php | 40 +++++++++---------- homepage/machs/lib/achievementsLib.php | 14 +++---- homepage/machs/lib/machs/achievementGroup.php | 13 +++++- homepage/machs/lib/record.php | 4 +- homepage/participo/css/parsedownCard.css | 1 - 5 files changed, 39 insertions(+), 33 deletions(-) diff --git a/homepage/machs/index.php b/homepage/machs/index.php index 2b946a9..cb8dd44 100644 --- a/homepage/machs/index.php +++ b/homepage/machs/index.php @@ -72,34 +72,30 @@ processPostData($dbConnection, $_POST); } ?> - Eigene Achievements" ); - // echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) ); - echo(htmlAchievementListForUser( - $dbConnection, - $achievementGroups, - $_SESSION['user']['userId'], - getUsersAchievements($dbConnection, $_SESSION['user']['userId']) - )); + echo( "
"); + foreach($achievementGroups as $g){ + echo($g->asHtmlCard($_SESSION['user']['userId'])); + } + echo("
" ); } - ?> +?> - ".$k['vorname']." ".$k['name']."" ); - // echo( htmlUsersUploadBox($dbConnection, $k['kidId']) ); - echo(htmlAchievementListForUser( - $dbConnection, - $achievementGroups, - $k['id'], - getUsersAchievements($dbConnection, $k['id']) - )); +".$k['vorname']." ".$k['name']."" ); + echo( "
"); + foreach($achievementGroups as $g){ + echo($g->asHtmlCard($k['kidId'], ['noForm'=>false])); } } - ?> + echo("
" ); + } +?>
"; - $html .= "
Upload Link
".$userData['machsUploadUrl']."
"; - $html .= "
Upload Passwort
".$userData['machsUploadPw']."
"; - $html .= "
"; -return $html; + $html = ""; + $userData = getUserData($db, $userId); + $html .= "
"; + $html .= "
Upload Link
".$userData['machsUploadUrl']."
"; + $html .= "
Upload Passwort
".$userData['machsUploadPw']."
"; + $html .= "
"; + return $html; } function htmlAchievementListForUser($db, $achievementGroups, $userId, $usersAchievmentIds, $noForm=false){ diff --git a/homepage/machs/lib/machs/achievementGroup.php b/homepage/machs/lib/machs/achievementGroup.php index ee5af83..942e558 100644 --- a/homepage/machs/lib/machs/achievementGroup.php +++ b/homepage/machs/lib/machs/achievementGroup.php @@ -197,7 +197,18 @@ SQL; // image + title if($this->imageUrl != null){ - $retHtml .= "
imageUrl."\">"; + $retHtml .= "
"; + $ext = pathinfo($this->imageUrl, PATHINFO_EXTENSION); + $ret."
".$this->imageUrl."
"; + $ret."
".$ext."
"; + switch($ext){ + case "webm": + $retHtml .= ""; + break; + default: + $retHtml .= "imageUrl."\">"; + break; + }; $retHtml .= "".$this->name.""; $retHtml .= "
"; } diff --git a/homepage/machs/lib/record.php b/homepage/machs/lib/record.php index 01f5f13..3d8e852 100644 --- a/homepage/machs/lib/record.php +++ b/homepage/machs/lib/record.php @@ -41,12 +41,12 @@ class record{ "ON `wkParticipo_Users`.`id` = `achievements<=>user`.`userId` ". ( ($from!=null&&$to!=null)? - ("BETWEEN CONVERT(\"".$from."\", datetime) AND CONVERT(\"".$to."\", datetime) "): + (" WHERE `achievements<=>user`.`timestamp` BETWEEN CONVERT(\"".$from."\", datetime) AND CONVERT(\"".$to."\", datetime) "): ("") ). "GROUP BY `wkParticipo_Users`.`id` ". "ORDER BY `COUNT(*)` DESC;"; - return dbQuery(self::$db, $query); + return dbQuery(self::$db, $query); } public static function getAllRecords(){ diff --git a/homepage/participo/css/parsedownCard.css b/homepage/participo/css/parsedownCard.css index 22fe9f9..1576171 100644 --- a/homepage/participo/css/parsedownCard.css +++ b/homepage/participo/css/parsedownCard.css @@ -13,4 +13,3 @@ .parsedownCard img{ max-width: 100%; } - From fb0bcd02a2daf62b3f0210ece302791aa8cc2c7c Mon Sep 17 00:00:00 2001 From: marko Date: Sun, 26 Dec 2021 13:24:10 +0100 Subject: [PATCH 4/7] syncronize materialize imports --- homepage/participo/attendence.php | 242 ++++++++++++++++++++ homepage/participo/index.php | 11 +- homepage/participo/infoZettel.php | 11 +- homepage/participo/kyu.php | 8 +- homepage/participo/lib/planerLib/planer.php | 64 ++++++ homepage/participo/login.php | 2 +- homepage/participo/shared/imports.php | 4 +- homepage/participo/user.php | 4 +- 8 files changed, 315 insertions(+), 31 deletions(-) create mode 100644 homepage/participo/attendence.php create mode 100644 homepage/participo/lib/planerLib/planer.php diff --git a/homepage/participo/attendence.php b/homepage/participo/attendence.php new file mode 100644 index 0000000..def6ef2 --- /dev/null +++ b/homepage/participo/attendence.php @@ -0,0 +1,242 @@ += CURDATE() ". + "ORDER BY wkParticipo_Events.date;"; + $ret = dbQuery($dbConn, $query); + // $results = $anMysqlConn->query($query); + + // // Bei einem Fehler bei der Abfrage soll NULL zurückgeliefert werden + // if( !$results ){ + // echo("No Results: ".$anMysqlConn->error); + // return NULL; + // } + // // Bei einem leeren Ergebnis (NULL oder leeres Array) soll ein leeres Array zurückgeliefert werden + // if( empty($results) ) return array(); + + // while( $result = $results->fetch_assoc() ){ + // array_walk( + // $result, + // function (&$value, $key, $someOptions) { + // $value = iconv($someOptions['dbCharset'], $someOptions['outCharset'], $value); + // }, + // $someOptions + // ); + // array_push( $ret, $result); + // } + return $ret; +} + +// array(12) { +// ["id"]=> string(3) "139" +// ["date"]=> string(10) "2021-12-29" +// ["wkId"]=> string(0) "" +// ["meldefrist"]=> string(10) "2021-12-28" +// ["bemerkungen"]=> string(374) "{ "Datum": "2021-12-29", "Veranstaltung": "Jahresabschlusstraining", "Altersklassen": "alle", "bemerkungen": " + +// Zum Abschluss des Jahres noch einmal eine kleine Einheit hauptsächlich zum Spielen +// Zeit: 16:00--19:00 Uhr + +// ", "Ort": "unser Dojo, Str. Usti nad Labem 42, 09120 Chemnitz", "Routenplaner": "https://osm.org/go/0MIYhLf3Q-" }" +// ["kvOptions"]=> string(0) "" +// ["Datum"]=> string(0) "" +// ["Veranstaltung"]=> string(0) "" +// ["Altersklassen"]=> string(0) "" +// ["Ort"]=> string(0) "" +// ["Ausschreibung"]=> string(0) "" +// ["Routenplaner"]=> string(0) "" +// } +function getHtmlEventTable($eventList){ + $ret = ""; + foreach($eventList as $event){ + $e = json_decode($event['bemerkungen'], true); + $e = (($e==null)?$event:$e); + $e['id']=$event['id']; + $ret .= ""; + } + $ret .= "
".$e['Datum']."".$e['Veranstaltung']."
"; + return $ret; +} +?> + + + + + + + + + + + + participo + + + + + + + + +
+ + +
+ + +
+ +
+ "kyu", + 'title' => "Kyu", + 'description'=> "Die Prüfungsprogamme der einzelnen Gürtelstufen in Bild, Ton und Text", + 'imgUrl' => "images/obi.svg", + 'actions' => [ + AppCardAction::fromArray(['caption'=>"Kyu-Programme", 'link'=>"kyu"]), + ], + ])->htmlCode(). + AppCard::fromArray([ + 'link' => "/machs", + 'title' => "Mein Achievement System", + 'description'=> "Ein kleines Achievementsystem für die tägliche Herausforderung", + 'imgUrl' => "images/mountain-climber.svg", + 'actions' => [ + AppCardAction::fromArray(['caption'=>"MAchS", 'link'=>"/machs"]), + ], + ])->htmlCode(). + AppCard::fromArray([ + 'link' => "/pages/desktop/wkParticipo", + 'title' => "Event-Planer", + 'description'=> "Organisieren der Teilnahmen (und nicht-Teilnahmen) an Wettkämpfen, Sondertrainingseinheiten, Feiern etc.

".getHtmlEventTable(getCommingWkEvents($dbConnection))."

", + 'imgUrl' => "/ressourcen/graphiken/icons/terminKalender.svg", + 'actions' => [ + AppCardAction::fromArray(['caption'=>"Planer", 'link'=>"/pages/desktop/wkParticipo"]), + ], + ])->htmlCode(). + AppCard::fromArray([ + 'link' => "infoZettel", + 'title' => "Infozettel", + 'description'=> "Online-Variante der Infozettel und Newsletter", + 'imgUrl' => "images/info.svg", + 'actions' => [ + AppCardAction::fromArray(['caption'=>"Info", 'link'=>"infoZettel"]), + ], + ])->htmlCode() +); +?> +

+ +
+ + +
+ "user", + 'title' => "User-Config", + 'description' => "Einstellungen zum aktuellen Benutzer dessen Kindern", + 'imgUrl' => "images/account.svg", + 'actions' => [ + AppCardAction::fromArray(['caption'=>"Config", 'link'=>"user"]), + ], + ])->htmlCode() +); +// AdminStuff, thats only visible for Admins +if( isUserAdmin($dbConnection, $userData['id']) ){ + echo( + AppCard::fromArray([ + 'title' =>"lastLogins", + 'description' => "

".lastLoginTable()."

" + ])->htmlCode() + ); +} +?> +
+
+ + + diff --git a/homepage/participo/index.php b/homepage/participo/index.php index db9f924..def6ef2 100644 --- a/homepage/participo/index.php +++ b/homepage/participo/index.php @@ -112,16 +112,7 @@ function getHtmlEventTable($eventList){ - - - - - - - - - - + - - - - - + diff --git a/homepage/participo/kyu.php b/homepage/participo/kyu.php index b04847f..c70576e 100644 --- a/homepage/participo/kyu.php +++ b/homepage/participo/kyu.php @@ -138,12 +138,8 @@ function ytLightEmbed($item){ Gürtelprüfungsordnung - - - - - - + + diff --git a/homepage/participo/lib/planerLib/planer.php b/homepage/participo/lib/planerLib/planer.php new file mode 100644 index 0000000..2e5422f --- /dev/null +++ b/homepage/participo/lib/planerLib/planer.php @@ -0,0 +1,64 @@ +$db = $db; + } +} + +class shiai{ + private $id = null; //< unique id + private $date = null; //< date of the shiai + private $name = null; //< name of the shiai as string + private $ageclasses = null; //< age classes as space separated Uxy in a string + private $place = null; //< place of the shiai as string + private $announcementUrl = null; //< url to the announcement + private $routeUrl = null; //< url to a routing planner + private $galleryUrl = null; //< url of the gallery to a gallery of the shiai + private $promoImgUrl = null; //< promotional image for the shiai (as url) + + function __construct($id, $date, $name, $ageclasses, $place, $announcementUrl, $routeUrl, $galleryUrl, $promoImgUrl){ + //! @todo input validation and sanitation + $this->$id = (int) $id; + $this->$date = DateTime::createFromFormat("Y-m-d", $date); + $this->$name = $name; + $this->ageclasses = $ageclasses; + $this->place = $place; + $this->announcementUrl = $announcementUrl; + $this->routeUrl = $routeUrl; + $this->galleryUrl = $galleryUrl; + $this->promoImgUrl = $promoImgUrl; + } + static public function fromArray($member){ + $id = $member['lfdeNr'] ?? null; + $date = $member['Datum'] ?? null; + $name = $member['Veranstaltung'] ?? ""; + $ageclasses = $member['Altersklassen'] ?? null; + $place = $member['Ort'] ?? ""; + $announcementUrl = $member['Ausschreibung'] ?? null; + $routeUrl = $member['Routenplaner'] ?? null; + $galleryUrl = $member['galleryLink'] ?? null; + $promoImgUrl = $member['promoPic'] ?? null; + } +} +class event{ + private $id = null; //< unique id of the event in the db + private $date = null; //< date for the event (@todo ranges?) + private $shiaiId = null; //< unique id of the shiai in the db (if appropriate) + private $deadline = null; //< until when one can register for the event + private $remarks = null; //< remarks to the event (special rules) or a json object for missing data (e.g. non-shiai events) + + private $shiai = null; + + function __construct($id, $date, $shiaiId, $deadline, $remarks){ + //! @todo InputValidation + $this->$id = (int) $id; + $this->$date = DateTime::createFromFormat("Y-m-d", $date); + $this->shiaiId = (($shiaiId!=null)?((int)$shiaiId):(null)); + $this->deadline = DateTime::createFromFormat("Y-m-d"); + $this->remarks = $remarks; + } +} + +?> \ No newline at end of file diff --git a/homepage/participo/login.php b/homepage/participo/login.php index aae2fb5..8a15930 100644 --- a/homepage/participo/login.php +++ b/homepage/participo/login.php @@ -102,7 +102,7 @@ else{ - Login des Achievementsystemes der Judoka des Chemnitzer WSV + cwsvJudo Online Apps diff --git a/homepage/participo/shared/imports.php b/homepage/participo/shared/imports.php index 0243b8c..e305237 100644 --- a/homepage/participo/shared/imports.php +++ b/homepage/participo/shared/imports.php @@ -1,8 +1,10 @@ - + + + diff --git a/homepage/participo/user.php b/homepage/participo/user.php index 2289dd6..4ccad3b 100644 --- a/homepage/participo/user.php +++ b/homepage/participo/user.php @@ -32,9 +32,7 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge'); - + + + participo @@ -132,11 +134,13 @@ function getHtmlEventTable($eventList){ -
- +