show correct answer only with link (Issue #46)
This commit is contained in:
parent
277ed9f2af
commit
918a3d40f9
10 changed files with 48 additions and 41 deletions
|
|
@ -347,13 +347,15 @@
|
|||
$questtypeAgent = $this->loadQuesttypeAgent($questtypeClassname, $request, $response);
|
||||
|
||||
// Solve Quest
|
||||
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('submit')) && !$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']))
|
||||
if($this->request->getRequestMethod() == 'POST' && !is_null($this->request->getPostParam('submit')))
|
||||
{
|
||||
// Get user answers
|
||||
$answers = $this->request->getPostParam('answers');
|
||||
|
||||
// Save answers in database
|
||||
if(!$this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id'])) {
|
||||
$questtypeAgent->saveAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
}
|
||||
|
||||
// Match answers with correct ones
|
||||
$status = $questtypeAgent->matchAnswersofCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,8 +1,8 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: The Legend of Z\n"
|
||||
"POT-Creation-Date: 2014-03-22 14:37+0100\n"
|
||||
"PO-Revision-Date: 2014-03-22 14:37+0100\n"
|
||||
"POT-Creation-Date: 2014-03-22 21:17+0100\n"
|
||||
"PO-Revision-Date: 2014-03-22 21:18+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: de_DE\n"
|
||||
|
|
@ -20,20 +20,6 @@ msgstr ""
|
|||
msgid "Error"
|
||||
msgstr "Fehler"
|
||||
|
||||
#: ../../../views/html/charactergroups/group.tpl:1
|
||||
#: ../../../views/html/charactergroups/groupsgroup.tpl:1
|
||||
#: ../../../views/html/charactergroups/index.tpl:1
|
||||
#: ../../../views/html/charactergroupsquests/quest.tpl:1
|
||||
#: ../../../views/html/menu/index.tpl:4 ../../../views/html/quests/quest.tpl:1
|
||||
#: ../../../views/html/quests/submission.tpl:1
|
||||
#: ../../../views/html/quests/submissions.tpl:1
|
||||
#: ../../../views/html/seminaries/create.tpl:1
|
||||
#: ../../../views/html/seminaries/delete.tpl:1
|
||||
#: ../../../views/html/seminaries/edit.tpl:1
|
||||
#: ../../../views/html/seminaries/index.tpl:1
|
||||
msgid "Seminaries"
|
||||
msgstr "Kurse"
|
||||
|
||||
#: ../../../views/html/charactergroups/group.tpl:3
|
||||
#: ../../../views/html/charactergroups/groupsgroup.tpl:3
|
||||
#: ../../../views/html/charactergroups/index.tpl:3
|
||||
|
|
@ -103,6 +89,14 @@ msgstr "Einführung"
|
|||
msgid "Users"
|
||||
msgstr "Benutzer"
|
||||
|
||||
#: ../../../views/html/menu/index.tpl:4
|
||||
#: ../../../views/html/seminaries/create.tpl:1
|
||||
#: ../../../views/html/seminaries/delete.tpl:1
|
||||
#: ../../../views/html/seminaries/edit.tpl:1
|
||||
#: ../../../views/html/seminaries/index.tpl:1
|
||||
msgid "Seminaries"
|
||||
msgstr "Kurse"
|
||||
|
||||
#: ../../../views/html/menu/index.tpl:10 ../../../views/html/users/login.tpl:2
|
||||
#: ../../../views/html/users/login.tpl:11
|
||||
msgid "Login"
|
||||
|
|
@ -118,34 +112,38 @@ msgstr "Logout"
|
|||
msgid "locked"
|
||||
msgstr "gesperrt"
|
||||
|
||||
#: ../../../views/html/quests/quest.tpl:21
|
||||
#: ../../../views/html/quests/submissions.tpl:28
|
||||
#: ../../../views/html/quests/quest.tpl:20
|
||||
#: ../../../views/html/quests/submissions.tpl:27
|
||||
msgid "solved"
|
||||
msgstr "gelöst"
|
||||
|
||||
#: ../../../views/html/quests/quest.tpl:23
|
||||
#: ../../../views/html/quests/submissions.tpl:19
|
||||
#: ../../../views/html/quests/quest.tpl:22
|
||||
#: ../../../views/html/quests/submissions.tpl:18
|
||||
msgid "unsolved"
|
||||
msgstr "ungelöst"
|
||||
|
||||
#: ../../../views/html/quests/quest.tpl:60
|
||||
#: ../../../views/html/quests/quest.tpl:59
|
||||
msgid "Task"
|
||||
msgstr "Aufgabe"
|
||||
|
||||
#: ../../../views/html/quests/quest.tpl:68
|
||||
#: ../../../views/html/quests/quest.tpl:67
|
||||
msgid "Task successfully solved"
|
||||
msgstr "Du hast die Aufgabe erfolgreich gelöst"
|
||||
|
||||
#: ../../../views/html/quests/quest.tpl:69
|
||||
#: ../../../views/html/quests/quest.tpl:67
|
||||
msgid "Show correct answer"
|
||||
msgstr "Richtige Lösung anzeigen"
|
||||
|
||||
#: ../../../views/html/quests/quest.tpl:68
|
||||
msgid "Go on"
|
||||
msgstr "Hier geht es weiter"
|
||||
|
||||
#: ../../../views/html/quests/quest.tpl:74
|
||||
#: ../../../views/html/quests/quest.tpl:76
|
||||
#: ../../../views/html/quests/quest.tpl:73
|
||||
#: ../../../views/html/quests/quest.tpl:75
|
||||
msgid "Quest"
|
||||
msgstr "Quest"
|
||||
|
||||
#: ../../../views/html/quests/submission.tpl:11
|
||||
#: ../../../views/html/quests/submission.tpl:10
|
||||
#, php-format
|
||||
msgid "Submission of %s"
|
||||
msgstr "Lösungen von %s"
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@
|
|||
$this->set('field', $dndField);
|
||||
$this->set('drops', $drops);
|
||||
$this->set('drags', $drags);
|
||||
$this->set('solved', $solved);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@
|
|||
</div>
|
||||
|
||||
<br />
|
||||
<input type="submit" name="submit" value="<?=_('solve')?>" <?=($solved) ? 'disabled="disabled"' : '' ?> />
|
||||
<input type="submit" name="submit" value="<?=_('solve')?>" />
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -96,9 +96,14 @@
|
|||
{
|
||||
// Get questions
|
||||
$questions = $this->Multiplechoice->getQuestionsOfQuest($quest['id']);
|
||||
|
||||
// Get user answers
|
||||
if($this->request->getGetParam('show-answer') == 'true')
|
||||
{
|
||||
foreach($questions as &$question) {
|
||||
$question['answer'] = $this->Multiplechoice->getCharacterSubmission($question['id'], $character['id']);
|
||||
}
|
||||
}
|
||||
|
||||
// Has Character already solved Quest?
|
||||
$solved = $this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']);
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
<ol>
|
||||
<?php foreach($questions as $i => &$question) : ?>
|
||||
<li>
|
||||
<input type="checkbox" id="answers[<?=$i?>]" name="answers[<?=$i?>]" value="true" <?=($question['answer']) ? 'checked="checked"' : '' ?> <?=($solved) ? 'disabled="disabled"' : '' ?>/>
|
||||
<input type="checkbox" id="answers[<?=$i?>]" name="answers[<?=$i?>]" value="true" <?=(array_key_exists('answer', $question) && $question['answer']) ? 'checked="checked"' : '' ?> />
|
||||
<label for="answers[<?=$i?>]"><?=\hhu\z\Utils::t($question['question'])?></label>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
<input type="submit" name="submit" value="<?=_('solve')?>" <?=($solved) ? 'disabled="disabled"' : '' ?> />
|
||||
<input type="submit" name="submit" value="<?=_('solve')?>" />
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -104,10 +104,14 @@
|
|||
$textParts = preg_split('/(\$\$)/', $task['text'], -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
// Get Character answers
|
||||
$regexs = null;
|
||||
if($this->request->getGetParam('show-answer') == 'true')
|
||||
{
|
||||
$regexs = $this->Textinput->getTextinputRegexs($quest['id']);
|
||||
foreach($regexs as &$regex) {
|
||||
$regex['answer'] = $this->Textinput->getCharacterSubmission($regex['id'], $character['id']);
|
||||
}
|
||||
}
|
||||
|
||||
// Has Character already solved Quest?
|
||||
$solved = $this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']);
|
||||
|
|
@ -116,7 +120,6 @@
|
|||
// Pass data to view
|
||||
$this->set('texts', $textParts);
|
||||
$this->set('regexs', $regexs);
|
||||
$this->set('solved', $solved);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<form method="post">
|
||||
<?php foreach($texts as $i => &$text) : ?>
|
||||
<?php if($i > 0) : ?>
|
||||
<input type="text" name="answers[<?=$i-1?>]" value="<?=$regexs[$i-1]['answer']?>" <?=($solved) ? 'disabled="disabled"' : '' ?>/>
|
||||
<input type="text" name="answers[<?=$i-1?>]" value="<?=$regexs[$i-1]['answer']?>" />
|
||||
<?php endif ?>
|
||||
<?=\hhu\z\Utils::t($text)?>
|
||||
<?php endforeach ?>
|
||||
|
||||
<br /><br />
|
||||
<input type="submit" name="submit" value="<?=_('solve')?>" <?=($solved) ? 'disabled="disabled"' : '' ?> />
|
||||
<input type="submit" name="submit" value="<?=_('solve')?>" />
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
<?php if(!is_null($nextquests) || !is_null($nextquestgroup)) : ?>
|
||||
<section>
|
||||
<p><?=_('Task successfully solved')?></p>
|
||||
<p><?=_('Task successfully solved')?> (<a href="<?=$linker->link(null,0,false,array('show-answer'=>'true'))?>"><?=_('Show correct answer')?></a>)</p>
|
||||
<h1><?=_('Go on') ?></h1>
|
||||
<?php if(count($nextquests) > 0) : ?>
|
||||
<ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue