From 1d1606ff13f73f6e0c0d92be2e591362eabd3402 Mon Sep 17 00:00:00 2001 From: neerholt Date: Thu, 11 Mar 2021 13:20:10 +0100 Subject: [PATCH] fixed some stuff --- .../Controllers/FileHandler/FileHandler.php | 2 +- .../Controllers/FileHandler/GetGameData.php | 21 +++++++++++++++++++ Backend/Controllers/Group/SigningUp.php | 3 +++ .../keyWord/genRandomKeyWinner.php | 21 +++++++++++++++++++ .../Controllers/keyWord/keyWordsRemaining.php | 11 +++++----- Backend/Main.php | 5 +++-- Frontend/adminGenKeyWord.php | 17 +++++++++++++++ Frontend/group.php | 1 - 8 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 Backend/Controllers/FileHandler/GetGameData.php create mode 100644 Frontend/adminGenKeyWord.php diff --git a/Backend/Controllers/FileHandler/FileHandler.php b/Backend/Controllers/FileHandler/FileHandler.php index 1e8d265..60f50cc 100644 --- a/Backend/Controllers/FileHandler/FileHandler.php +++ b/Backend/Controllers/FileHandler/FileHandler.php @@ -32,7 +32,7 @@ function imagesFileHandler(string $thumbnailFileName, string $thumbnailFileTmp){ $fileExtThumb = explode('.', $thumbnailFileName); $fileActualExtThumb = strtolower(end($fileExtThumb)); - $allowedFileTypeThumbnail = array('gif', 'jpeg', 'png', 'svg'); + $allowedFileTypeThumbnail = array('gif', 'jpeg', 'png', 'svg', 'jpg', 'jfif', 'pjpeg', 'pjp', 'webp'); if(in_array($fileActualExtThumb,$allowedFileTypeThumbnail)){ $thumbnailFileNewName = uniqid("", true). "." . $fileActualExtThumb; diff --git a/Backend/Controllers/FileHandler/GetGameData.php b/Backend/Controllers/FileHandler/GetGameData.php new file mode 100644 index 0000000..9081906 --- /dev/null +++ b/Backend/Controllers/FileHandler/GetGameData.php @@ -0,0 +1,21 @@ +GameData(); +}elseif (isset($_GET['gameJamId'])){ + $openGameDataStream = Group::where("game_jam_id",$_GET['gameJamId'])->GameData();/*->pluck("id")->toArray()*/; +}else{ + $openGameDataStream = GameData::all(); +} + + +header('Content-Type: application/json;charset=UTF-8'); +echo $openGameDataStream ->toJson(JSON_PRETTY_PRINT); \ No newline at end of file diff --git a/Backend/Controllers/Group/SigningUp.php b/Backend/Controllers/Group/SigningUp.php index 1807dcc..a46a789 100644 --- a/Backend/Controllers/Group/SigningUp.php +++ b/Backend/Controllers/Group/SigningUp.php @@ -1,6 +1,7 @@ id)->pluck("id")->toArray(); + $find_all_keywords = KeyWord::whereIn("group_id", $all_group_in_game_jam_id)->inRandomOrder()->get(); + $game_jam->key_word = $find_all_keywords->first()->key_word; + $game_jam->save(); + + header('Content-Type: application/json;charset=UTF-8'); + echo $find_all_keywords->pluck("key_word")->toJson(JSON_PRETTY_PRINT); + } +} \ No newline at end of file diff --git a/Backend/Controllers/keyWord/keyWordsRemaining.php b/Backend/Controllers/keyWord/keyWordsRemaining.php index a653e60..9981205 100644 --- a/Backend/Controllers/keyWord/keyWordsRemaining.php +++ b/Backend/Controllers/keyWord/keyWordsRemaining.php @@ -1,5 +1,6 @@ id)->count()<$group->groupAmount){ + if(KeyWord::where('group_id', $group->id)->count()<$group->group_amount){ //Make a new keyword[Only to be used if you need to make a new of something] $keyword = new KeyWord(); @@ -24,9 +25,9 @@ if (session_status() === PHP_SESSION_ACTIVE) { //Try to save it if(!$keyword->save()){ - header("location: ../Frontend/index.php?created=failed"); + header("location: ../../../Frontend/index.php?created=failed"); }else{ - header("location: ../Frontend/index.php?created=success"); + header("location:../../../Frontend/index.php?created=success"); } } diff --git a/Backend/Main.php b/Backend/Main.php index 01292b8..834ba1e 100644 --- a/Backend/Main.php +++ b/Backend/Main.php @@ -21,8 +21,9 @@ $gameJam = GameJam::firstOrCreate([ - - + + + diff --git a/Frontend/adminGenKeyWord.php b/Frontend/adminGenKeyWord.php new file mode 100644 index 0000000..19faa1b --- /dev/null +++ b/Frontend/adminGenKeyWord.php @@ -0,0 +1,17 @@ + + + + + + + Title + + + +
+ + +
+ + + diff --git a/Frontend/group.php b/Frontend/group.php index b987e74..1f32b9d 100644 --- a/Frontend/group.php +++ b/Frontend/group.php @@ -1,4 +1,3 @@ -