diff --git a/homepage/machs/index.php b/homepage/machs/index.php index b78054c..f657d9c 100644 --- a/homepage/machs/index.php +++ b/homepage/machs/index.php @@ -1,7 +1,13 @@ @@ -38,34 +58,56 @@ processPostData($dbConnection, $_POST); - - - - - - + + Eigene Achievements" ); - echo( "
"); - foreach($achievementGroups as $g){ - echo($g->asHtmlCard($_SESSION['user']['userId'])); - } - echo("
" ); + echo( htmlUsersUploadBox($dbConnection, $_SESSION['user']['userId']) ); + echo(htmlAchievementListForUser( + $dbConnection, + $achievementGroups, + $_SESSION['user']['userId'], + getUsersAchievements($dbConnection, $_SESSION['user']['userId']) + )); } ?> - - ".$k['vorname']." ".$k['name']."" ); - echo( "
"); - foreach($achievementGroups as $g){ - echo($g->asHtmlCard($k['kidId'], ['noForm'=>false])); + + ".$k['vorname']." ".$k['name']."" ); + echo( htmlUsersUploadBox($dbConnection, $k['kidId']) ); + echo(htmlAchievementListForUser( + $dbConnection, + $achievementGroups, + $k['id'], + getUsersAchievements($dbConnection, $k['id']) + )); } - echo("
" ); } - } ?> - + +Add Achievements"); + echo(htmlAddAchievementBox()); + + echo("

Update Achievements

"); + $achievements = getAchievements($dbConnection); + foreach($achievements as $a){ + echo( htmlUpdateAchievementBox( + $a['id'], + $a['name'], + $a['description'], + $a['rootId'], + $a['level'] + )); + echo("
"); + } + } + ?> + + diff --git a/homepage/mams/index.php b/homepage/mams/index.php index 938b2ac..bc45acd 100644 --- a/homepage/mams/index.php +++ b/homepage/mams/index.php @@ -23,8 +23,8 @@ foreach($lastAttendances as $a){ array_push( $lastAttendancesAssocArray[ $a['date'] ], $a ); } -$dateLastWendsday = new DateTime("wednesday this week"); -$dateLastFriday = new DateTime("friday this week"); +$dateLastWendsday = new DateTime("tomorrow last wednesday"); +$dateLastFriday = new DateTime("tomorrow last friday"); $lastTrainingDay = max($dateLastWendsday, $dateLastFriday); ?> @@ -34,18 +34,43 @@ $lastTrainingDay = max($dateLastWendsday, $dateLastFriday); + + + + + Corona-Anwesenheitsliste der Judoka des Chemnitzer WSV -

Corona-Anwesenheitsliste der Judoka des Chemnitzer WSV

-

Anwesenheiten hinzufügen

+ + ☰ mams + +

Anwesenheiten hinzufügen

+
@@ -56,7 +81,28 @@ $lastTrainingDay = max($dateLastWendsday, $dateLastFriday);
-

Anwesenheiten

+ +

Corona-Trainee hinzufügen

+ Added user."); + }else{ + echo("
ERROR
"); + } + } + ?> +
+ + + + + + + +
+ +

Anwesenheiten

Sende Anwesenheitsliste an eMail

@@ -86,15 +132,5 @@ $lastTrainingDay = max($dateLastWendsday, $dateLastFriday); echo(""); } ?> -

Trainee hinzufügen

- - - - - - - - -
diff --git a/homepage/mams/lib/api.php b/homepage/mams/lib/api.php index 3b54862..04910fa 100644 --- a/homepage/mams/lib/api.php +++ b/homepage/mams/lib/api.php @@ -9,14 +9,27 @@ function processPostData($db, $post, $redirectLocation = "."){ updateCoronaData($db, $post['userId'], $post['columnName'], $post['columnValue']); } if($post['action'] == "addCoronaUser"){ - addCoronaUser( - $db, - $post['name'], - $post['vorname'], - $post['corona_PLZ'], - $post['corona_telephon'], - $post['corona_eMail'] - ); + if( + isValid($post['corona_PLZ'], "plz") + // && isValid($post['name'], "name") + // && isValid($post['vorname'], "name") + // && isValid($post['corona_telephon'], "phonenumber") + // && isValid($post['corona_eMail'], "email") + ){ + addCoronaUser( + $db, + $post['name'], + $post['vorname'], + $post['corona_PLZ'], + $post['corona_telephon'], + $post['corona_eMail'] + ); + $redirectLocation .= "?addCoronaUserSuccess=true"; + } + else{ + $redirectLocation .= "?addCoronaUserSuccess=false"; + } + $redirectLocation .= "#addCoronaUser"; } if($post['action'] == "sendAttandeesPerEmail"){ sendEmail( @@ -78,4 +91,38 @@ function attendancesAssocArray2mdList($attendancesAssocArray, $date=null){ } return $ret; } + +/// Validaing a phone number +/// true if it validates, false if not +function validate_phone_number($phone) +{ + // Allow +, - and . in phone number + $filtered_phone_number = filter_var($phone, FILTER_SANITIZE_NUMBER_INT); + // Remove "-" from number + $phone_to_check = str_replace("-", "", $filtered_phone_number); + // Check the lenght of number + // This can be customized if you want phone number from a specific country + if (strlen($phone_to_check) < 10 || strlen($phone_to_check) > 14) { + return false; + } else { + return true; + } +} + +/// validate different types of input +function isValid($toValidate, $type){ + // for now we disable the name validation: what do i know how people can be called! + // $regexName="/^[A-Z][a-zA-Z]*$/"; + $regexPlz ="/^[0-9]{5}$/"; + if($type == "plz" ) + return preg_match($regexPlz, $toValidate) > 0; + if($type == "name") + return preg_match($regexName, $toValidate) > 0; + if($type == "phonenumber" ) + return validate_phone_number($toValidate); + if($type == "email") + return filter_var($toValidate, FILTER_VALIDATE_EMAIL); + + return false; +} ?>