From 77ff175794c13741ae9e61261bb2a3d4c399496f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Vigh?= Date: Wed, 19 May 2021 17:55:04 +0200 Subject: [PATCH] MAPG-235 added radio button for time limit type and fixed saving restrictions for challenge --- public/static/css/maps.css | 6 +++++- src/Controller/GameController.php | 11 +++++++---- src/PersistentData/Model/Challenge.php | 6 +++--- views/maps.php | 7 +++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/public/static/css/maps.css b/public/static/css/maps.css index 6678c09..8e32d05 100644 --- a/public/static/css/maps.css +++ b/public/static/css/maps.css @@ -84,7 +84,7 @@ div.mapItem>div.buttonContainer { font-weight: 500; } -#restrictions input[type=checkbox] { +#restrictions input { height: auto; margin: 0.5em; } @@ -94,6 +94,10 @@ div.mapItem>div.buttonContainer { margin-left: 2em; } +#timeLimitType { + margin-left: 2em; +} + @media screen and (min-width: 1504px) { #mapContainer { grid-template-columns: auto auto auto auto; diff --git a/src/Controller/GameController.php b/src/Controller/GameController.php index a4d0210..ecacef4 100644 --- a/src/Controller/GameController.php +++ b/src/Controller/GameController.php @@ -112,16 +112,19 @@ class GameController $challenge->setToken($challengeToken); $challenge->setCreatedDate(new DateTime()); - if($this->request->post('timerEnabled') !== null && $this->request->post('timeLimit') !== null) { + if ($this->request->post('timerEnabled') !== null && $this->request->post('timeLimit') !== null) { $challenge->setTimeLimit($this->request->post('timeLimit')); } - if($this->request->post('noMove') !== null) { + if ($this->request->post('timeLimitType') !== null) { + $challenge->setTimeLimitType($this->request->post('timeLimitType')); + } + if ($this->request->post('noMove') !== null) { $challenge->setNoMove(true); } - if($this->request->post('noPan') !== null) { + if ($this->request->post('noPan') !== null) { $challenge->setNoPan(true); } - if($this->request->post('noZoom') !== null) { + if ($this->request->post('noZoom') !== null) { $challenge->setNoZoom(true); } diff --git a/src/PersistentData/Model/Challenge.php b/src/PersistentData/Model/Challenge.php index a484fe3..6b159f0 100644 --- a/src/PersistentData/Model/Challenge.php +++ b/src/PersistentData/Model/Challenge.php @@ -47,17 +47,17 @@ class Challenge extends Model public function setNoMove(bool $noMove): void { - $this->$noMove = $noMove; + $this->noMove = $noMove; } public function setNoPan(bool $noPan): void { - $this->$noPan = $noPan; + $this->noPan = $noPan; } public function setNoZoom(bool $noZoom): void { - $this->$noZoom = $noZoom; + $this->noZoom = $noZoom; } public function setCreatedDate(DateTime $created): void diff --git a/views/maps.php b/views/maps.php index d151ff6..dfb9d2f 100644 --- a/views/maps.php +++ b/views/maps.php @@ -53,6 +53,13 @@ TODO: condition!
+
+ Time limit + + + + +