Questtype ?textinput?: show count of correctly filled fields (implements #3)
This commit is contained in:
parent
c6142fb5cf
commit
2bab62026e
4 changed files with 17 additions and 5 deletions
Binary file not shown.
|
|
@ -1,8 +1,8 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: The Legend of Z\n"
|
||||
"POT-Creation-Date: 2015-04-08 15:55+0100\n"
|
||||
"PO-Revision-Date: 2015-04-08 15:56+0100\n"
|
||||
"POT-Creation-Date: 2015-04-08 16:22+0100\n"
|
||||
"PO-Revision-Date: 2015-04-08 16:22+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: de_DE\n"
|
||||
|
|
@ -135,7 +135,7 @@ msgstr "Wählen"
|
|||
#: questtypes/crossword/html/quest.tpl:30
|
||||
#: questtypes/dragndrop/html/quest.tpl:16
|
||||
#: questtypes/multiplechoice/html/quest.tpl:19
|
||||
#: questtypes/submit/html/quest.tpl:23 questtypes/textinput/html/quest.tpl:12
|
||||
#: questtypes/submit/html/quest.tpl:23 questtypes/textinput/html/quest.tpl:13
|
||||
msgid "solve"
|
||||
msgstr "lösen"
|
||||
|
||||
|
|
@ -339,6 +339,11 @@ msgstr "Der reguläre Ausdruck ist ungültig"
|
|||
msgid "Fields"
|
||||
msgstr "Felder"
|
||||
|
||||
#: questtypes/textinput/html/quest.tpl:12
|
||||
#, php-format
|
||||
msgid "You filled %d of %d fields correctly"
|
||||
msgstr "Du hast %d von %d Feldern korrekt ausgefüllt"
|
||||
|
||||
#: views/ajax/quests/index.tpl:9 views/html/quests/create.tpl:79
|
||||
#: views/html/quests/edit.tpl:82 views/html/quests/index.tpl:27
|
||||
#: views/html/quests/index.tpl:59
|
||||
|
|
|
|||
|
|
@ -124,9 +124,14 @@
|
|||
$solved = $this->Quests->hasCharacterSolvedQuest($quest['id'], $character['id']);
|
||||
|
||||
// Get Character answers
|
||||
if(!$solved || $this->request->getGetParam('show-answer') == 'true' || $this->request->getGetParam('status') == 'solved') {
|
||||
foreach($fields as &$field) {
|
||||
$correctAnswersCount = null;
|
||||
if(!$solved || $this->request->getGetParam('show-answer') == 'true' || $this->request->getGetParam('status') == 'solved')
|
||||
{
|
||||
$correctAnswersCount = 0;
|
||||
foreach($fields as &$field)
|
||||
{
|
||||
$field['answer'] = $this->Textinput->getCharacterSubmission($field['id'], $character['id']);
|
||||
$correctAnswersCount += $this->isMatching($field['regex'], $field['answer']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -134,6 +139,7 @@
|
|||
// Pass data to view
|
||||
$this->set('task', $task);
|
||||
$this->set('fields', $fields);
|
||||
$this->set('count', $correctAnswersCount);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@
|
|||
<?php endforeach ?>
|
||||
<?=$t->t(mb_substr($task['text'], $posStart, mb_strlen($task['text'], 'UTF-8')-$posStart, 'UTF-8'))?>
|
||||
</p>
|
||||
<p><?=sprintf(_('You filled %d of %d fields correctly'), $count, count($fields))?>.</p>
|
||||
<input type="submit" name="submit" value="<?=_('solve')?>" />
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue