diff --git a/questtypes/choiceinput/ChoiceinputQuesttypeController.inc b/questtypes/choiceinput/ChoiceinputQuesttypeController.inc index be75b852..04bfbe55 100644 --- a/questtypes/choiceinput/ChoiceinputQuesttypeController.inc +++ b/questtypes/choiceinput/ChoiceinputQuesttypeController.inc @@ -119,13 +119,15 @@ } // Get Character answers - if($this->request->getGetParam('show-answer') == 'true') + if($this->request->getGetParam('show-answer') == 'true' || !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id'])) { foreach($choiceLists as &$list) { $list['answer'] = $this->Choiceinput->getCharacterSubmission($list['id'], $character['id']); } } + print_r($choiceLists); + // Pass data to view $this->set('texts', $textParts); diff --git a/questtypes/choiceinput/html/quest.tpl b/questtypes/choiceinput/html/quest.tpl index 489cbc2f..43a7d2df 100644 --- a/questtypes/choiceinput/html/quest.tpl +++ b/questtypes/choiceinput/html/quest.tpl @@ -3,7 +3,7 @@ 0) : ?> diff --git a/questtypes/crossword/CrosswordQuesttypeController.inc b/questtypes/crossword/CrosswordQuesttypeController.inc index 318271f9..9a2f7dcc 100644 --- a/questtypes/crossword/CrosswordQuesttypeController.inc +++ b/questtypes/crossword/CrosswordQuesttypeController.inc @@ -181,7 +181,7 @@ $maxY = 0; foreach($words as $index => &$word) { - if($this->request->getGetParam('show-answer') == 'true') { + if($this->request->getGetParam('show-answer') == 'true' || !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id'])) { $word['answer'] = $this->Crossword->getCharacterSubmission($word['id'], $character['id']); } // Insert word diff --git a/questtypes/dragndrop/DragndropQuesttypeController.inc b/questtypes/dragndrop/DragndropQuesttypeController.inc index 9797f8fd..f3e973d7 100644 --- a/questtypes/dragndrop/DragndropQuesttypeController.inc +++ b/questtypes/dragndrop/DragndropQuesttypeController.inc @@ -144,7 +144,7 @@ $drops = $this->Dragndrop->getDrops($dndField['quest_id']); // Get Character answers - if($this->request->getGetParam('show-answer') == 'true') + if($this->request->getGetParam('show-answer') == 'true' || !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id'])) { foreach($drops as &$drop) { diff --git a/questtypes/multiplechoice/MultiplechoiceQuesttypeController.inc b/questtypes/multiplechoice/MultiplechoiceQuesttypeController.inc index b025f758..cb384167 100644 --- a/questtypes/multiplechoice/MultiplechoiceQuesttypeController.inc +++ b/questtypes/multiplechoice/MultiplechoiceQuesttypeController.inc @@ -171,7 +171,7 @@ // Get previous user answers - if($this->request->getGetParam('show-answer') == 'true') + if($this->request->getGetParam('show-answer') == 'true' || !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id'])) { foreach($question['answers'] as &$answer) { $answer['useranswer'] = $this->Multiplechoice->getCharacterSubmission($answer['id'], $character['id']); diff --git a/questtypes/textinput/TextinputQuesttypeController.inc b/questtypes/textinput/TextinputQuesttypeController.inc index 02db2d8b..11512432 100644 --- a/questtypes/textinput/TextinputQuesttypeController.inc +++ b/questtypes/textinput/TextinputQuesttypeController.inc @@ -118,9 +118,12 @@ // Process text $textParts = preg_split('/(\$\$)/', ' '.$task['text'].' ', -1, PREG_SPLIT_NO_EMPTY); + // Has Character already solved Quest? + $solved = $this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']); + // Get Character answers $regexs = null; - if($this->request->getGetParam('show-answer') == 'true') + if(!$solved || $this->request->getGetParam('show-answer') == 'true') { $regexs = $this->Textinput->getTextinputRegexs($quest['id']); foreach($regexs as &$regex) { @@ -128,9 +131,6 @@ } } - // Has Character already solved Quest? - $solved = $this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']); - // Pass data to view $this->set('texts', $textParts);