implement saving of Quest answers in database
This commit is contained in:
parent
9a5e61ce93
commit
2429bb4c8f
10 changed files with 201 additions and 32 deletions
|
|
@ -191,6 +191,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Has Character solved quest?
|
||||
$solved = $this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']);
|
||||
|
||||
|
||||
// Pass data to view
|
||||
$this->set('seminary', $seminary);
|
||||
|
|
@ -204,6 +207,7 @@
|
|||
$this->set('nextquestgroup', $nextQuestgroup);
|
||||
$this->set('task', $task);
|
||||
$this->set('media', $questmedia);
|
||||
$this->set('solved', $solved);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -336,14 +340,11 @@
|
|||
$questtypeAgent = $this->loadQuesttypeAgent($questtypeClassname, $request, $response);
|
||||
|
||||
// Solve Quest
|
||||
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('submit')))
|
||||
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('submit')) && !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']))
|
||||
{
|
||||
// Get user answers
|
||||
$answers = $this->request->getPostParam('answers');
|
||||
|
||||
// Store answers in session
|
||||
$_SESSION['answers'][$quest['id']] = $answers;
|
||||
|
||||
// Save answers in database
|
||||
$questtypeAgent->saveAnswersOfCharacter($quest['id'], $character['id'], $answers);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue