Questtype ?Drag&Drop?: correct step-handling for task editing

This commit is contained in:
oliver 2015-05-14 16:13:40 +02:00
commit 433e4b3a81

View file

@ -276,7 +276,7 @@
if($this->request->getRequestMethod() == 'POST') if($this->request->getRequestMethod() == 'POST')
{ {
// Get current step // Get current step
$step = max(0, min(2, intval($this->request->getPostParam('step')))); $step = max(0, min($steps, intval($this->request->getPostParam('step'))));
// Drag&Drop-field (background image) // Drag&Drop-field (background image)
if($step == 0) if($step == 0)
@ -495,21 +495,17 @@
} }
// Go to next/previous step // Go to next/previous step
if(!is_null($this->request->getPostParam('prev'))) { if($validation === true && $dragsValidation === true)
$step--;
}
else {
$step++;
}
// Redirect after last step
if($step > $steps)
{ {
if($validation === true && $dragsValidation === true) { if(!is_null($this->request->getPostParam('prev'))) {
$this->redirect($this->linker->link(array('quest', $seminary['url'], $questgroup['url'], $quest['url']), 1)); $step--;
} }
else { else {
$step--; $step++;
}
// Redirect after last step
if($step > $steps) {
$this->redirect($this->linker->link(array('quest', $seminary['url'], $questgroup['url'], $quest['url']), 1));
} }
} }
} }