diff --git a/questtypes/bossfight/BossfightQuesttypeController.inc b/questtypes/bossfight/BossfightQuesttypeController.inc index 8ddc22dc..de07fd43 100644 --- a/questtypes/bossfight/BossfightQuesttypeController.inc +++ b/questtypes/bossfight/BossfightQuesttypeController.inc @@ -99,7 +99,7 @@ { // Get Boss-Fight $fight = $this->Bossfight->getBossFight($quest['id']); - if(!is_null($fight['boss_seminarymedia_id'])) { + if(!is_null($fight) && !is_null($fight['boss_seminarymedia_id'])) { $fight['bossmedia'] = $this->Media->getSeminaryMediaById($fight['boss_seminarymedia_id']); } diff --git a/questtypes/bossfight/BossfightQuesttypeModel.inc b/questtypes/bossfight/BossfightQuesttypeModel.inc index 318a2933..9b866d2d 100644 --- a/questtypes/bossfight/BossfightQuesttypeModel.inc +++ b/questtypes/bossfight/BossfightQuesttypeModel.inc @@ -71,7 +71,6 @@ /** * Get a Boss-Fight. * - * @throws \nre\exceptions\IdNotFoundException * @param int $questId ID of Quest * @return array Boss-Fight data */ @@ -84,12 +83,11 @@ 'i', $questId ); - if(empty($data)) { - throw new \nre\exceptions\IdNotFoundException($questId); + if(!empty($data)) { + return $data[0]; } - - return $data[0]; + return null; } diff --git a/questtypes/bossfight/html/quest.tpl b/questtypes/bossfight/html/quest.tpl index 9c6e309a..e47b1fe8 100644 --- a/questtypes/bossfight/html/quest.tpl +++ b/questtypes/bossfight/html/quest.tpl @@ -1,34 +1,36 @@ +
-
-

-

-

- 0) : ?> - - - - - - -

-
-
-

-

-

- 0) : ?> - - - - - - -

-
+
+

+

+

+ 0) : ?> + + + + + + +

+
+
+

+

+

+ 0) : ?> + + + + + + +

+
+ +

-
+ diff --git a/questtypes/dragndrop/DragndropQuesttypeController.inc b/questtypes/dragndrop/DragndropQuesttypeController.inc index f4f262c6..9a1290a7 100644 --- a/questtypes/dragndrop/DragndropQuesttypeController.inc +++ b/questtypes/dragndrop/DragndropQuesttypeController.inc @@ -131,18 +131,26 @@ { // Get Drag&Drop field $dndField = $this->Dragndrop->getDragndrop($quest['id']); - $dndField['media'] = $this->Media->getSeminaryMediaById($dndField['questmedia_id']); + if(!is_null($dndField) && !is_null($dndField['questmedia_id'])) { + $dndField['media'] = $this->Media->getSeminaryMediaById($dndField['questmedia_id']); + } // Get Drags $drags = array(); - $dragsByIndex = $this->Dragndrop->getDrags($dndField['quest_id']); - foreach($dragsByIndex as &$drag) { - $drag['media'] = $this->Media->getSeminaryMediaById($drag['questmedia_id']); - $drags[$drag['id']] = $drag; - } + if(!is_null($dndField)) + { + $dragsByIndex = $this->Dragndrop->getDrags($dndField['quest_id']); + foreach($dragsByIndex as &$drag) { + $drag['media'] = $this->Media->getSeminaryMediaById($drag['questmedia_id']); + $drags[$drag['id']] = $drag; + } + } // Get Drops - $drops = $this->Dragndrop->getDrops($dndField['quest_id']); + $drops = array(); + if(!is_null($dndField)) { + $this->Dragndrop->getDrops($dndField['quest_id']); + } // Get Character answers if($this->request->getGetParam('show-answer') == 'true' || !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']) || $this->request->getGetParam('status') == 'solved') diff --git a/questtypes/multiplechoice/MultiplechoiceQuesttypeController.inc b/questtypes/multiplechoice/MultiplechoiceQuesttypeController.inc index 591356ae..173f3cc2 100644 --- a/questtypes/multiplechoice/MultiplechoiceQuesttypeController.inc +++ b/questtypes/multiplechoice/MultiplechoiceQuesttypeController.inc @@ -172,18 +172,19 @@ // Get current question $question = $this->Multiplechoice->getQuestionOfQuest($quest['id'], $pos); - - // Get answers - $question['answers'] = $this->Multiplechoice->getAnswersOfQuestion($question['id']); - - - // Get previous user answers - if($this->request->getGetParam('show-answer') == 'true' || !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']) || $this->request->getGetParam('status') == 'solved') - { - foreach($question['answers'] as &$answer) { - $answer['useranswer'] = $this->Multiplechoice->getCharacterSubmission($answer['id'], $character['id']); - } - } + if(!is_null($question)) + { + // Get answers + $question['answers'] = $this->Multiplechoice->getAnswersOfQuestion($question['id']); + + // Get previous user answers + if($this->request->getGetParam('show-answer') == 'true' || !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']) || $this->request->getGetParam('status') == 'solved') + { + foreach($question['answers'] as &$answer) { + $answer['useranswer'] = $this->Multiplechoice->getCharacterSubmission($answer['id'], $character['id']); + } + } + } // Pass data to view diff --git a/questtypes/textinput/TextinputQuesttypeController.inc b/questtypes/textinput/TextinputQuesttypeController.inc index a4b62267..271eb238 100644 --- a/questtypes/textinput/TextinputQuesttypeController.inc +++ b/questtypes/textinput/TextinputQuesttypeController.inc @@ -134,12 +134,16 @@ $correctAnswersCount += $this->isMatching($field['regex'], $field['answer']); } } + + // Show count + $showcount = (count($this->request->getGetParams()) > 1); // Pass data to view $this->set('task', $task); $this->set('fields', $fields); $this->set('count', $correctAnswersCount); + $this->set('showcount', $showcount); } diff --git a/questtypes/textinput/html/quest.tpl b/questtypes/textinput/html/quest.tpl index 0e786e56..4cbcc7f9 100644 --- a/questtypes/textinput/html/quest.tpl +++ b/questtypes/textinput/html/quest.tpl @@ -9,6 +9,8 @@ t(mb_substr($task['text'], $posStart, mb_strlen($task['text'], 'UTF-8')-$posStart, 'UTF-8'))?>

+

.

+