MAPG-235 added radio button for time limit type and fixed saving restrictions for challenge

This commit is contained in:
Balázs Vigh 2021-05-19 17:55:04 +02:00
parent ae7fd98256
commit 77ff175794
4 changed files with 22 additions and 8 deletions

View File

@ -84,7 +84,7 @@ div.mapItem>div.buttonContainer {
font-weight: 500; font-weight: 500;
} }
#restrictions input[type=checkbox] { #restrictions input {
height: auto; height: auto;
margin: 0.5em; margin: 0.5em;
} }
@ -94,6 +94,10 @@ div.mapItem>div.buttonContainer {
margin-left: 2em; margin-left: 2em;
} }
#timeLimitType {
margin-left: 2em;
}
@media screen and (min-width: 1504px) { @media screen and (min-width: 1504px) {
#mapContainer { #mapContainer {
grid-template-columns: auto auto auto auto; grid-template-columns: auto auto auto auto;

View File

@ -112,16 +112,19 @@ class GameController
$challenge->setToken($challengeToken); $challenge->setToken($challengeToken);
$challenge->setCreatedDate(new DateTime()); $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')); $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); $challenge->setNoMove(true);
} }
if($this->request->post('noPan') !== null) { if ($this->request->post('noPan') !== null) {
$challenge->setNoPan(true); $challenge->setNoPan(true);
} }
if($this->request->post('noZoom') !== null) { if ($this->request->post('noZoom') !== null) {
$challenge->setNoZoom(true); $challenge->setNoZoom(true);
} }

View File

@ -47,17 +47,17 @@ class Challenge extends Model
public function setNoMove(bool $noMove): void public function setNoMove(bool $noMove): void
{ {
$this->$noMove = $noMove; $this->noMove = $noMove;
} }
public function setNoPan(bool $noPan): void public function setNoPan(bool $noPan): void
{ {
$this->$noPan = $noPan; $this->noPan = $noPan;
} }
public function setNoZoom(bool $noZoom): void public function setNoZoom(bool $noZoom): void
{ {
$this->$noZoom = $noZoom; $this->noZoom = $noZoom;
} }
public function setCreatedDate(DateTime $created): void public function setCreatedDate(DateTime $created): void

View File

@ -53,6 +53,13 @@ TODO: condition!
<div> <div>
<input type="range" id="timeLimit" name="timeLimit" min="10" max="600" value="120" /> <input type="range" id="timeLimit" name="timeLimit" min="10" max="600" value="120" />
</div> </div>
<div id="timeLimitType">
Time limit
<input type="radio" id="timeLimitTypeGame" name="timeLimitType" value="game" checked />
<label for="timeLimitTypeGame">for the whole game</label>
<input type="radio" id="timeLimitTypeRound" name="timeLimitType" value="round" />
<label for="timeLimitTypeRound">per round</label>
</div>
</div> </div>
<div> <div>
<input type="checkbox" id="noMove" name="noMove" value="noMove" /> <input type="checkbox" id="noMove" name="noMove" value="noMove" />