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