Questtype ?Textinput?: improve injection of input-fields
This commit is contained in:
parent
e9d2b96571
commit
a6040c3484
1 changed files with 10 additions and 10 deletions
|
@ -1,14 +1,14 @@
|
|||
<form method="post" class="textinput">
|
||||
<p>
|
||||
<?php $posStart = 0; ?>
|
||||
<?php foreach($fields as &$field) : ?>
|
||||
<?php $posEnd = mb_strpos($task['text'], '[textinput]', $posStart, 'UTF-8'); ?>
|
||||
<?=$t->t(mb_substr($task['text'], $posStart, $posEnd-$posStart, 'UTF-8'))?>
|
||||
<input type="text" name="answers[]" value="<?=(array_key_exists('answer', $field)) ? $field['answer'] : ''?>" <?php if($field['size'] != 'default') : ?>class="<?=$field['size']?>"<?php endif ?> />
|
||||
<?php $posStart = $posEnd + mb_strlen('[textinput]', 'UTF-8'); ?>
|
||||
<?php endforeach ?>
|
||||
<?=$t->t(mb_substr($task['text'], $posStart, mb_strlen($task['text'], 'UTF-8')-$posStart, 'UTF-8'))?>
|
||||
</p>
|
||||
<?php $text = $t->t($task['text']); ?>
|
||||
<?php $posStart = 0; ?>
|
||||
<?php foreach($fields as &$field) : ?>
|
||||
<?php $posEnd = mb_strpos($text, '[textinput]', $posStart, 'UTF-8'); ?>
|
||||
<?=mb_substr($text, $posStart, $posEnd-$posStart, 'UTF-8')?>
|
||||
<input type="text" name="answers[]" value="<?=(array_key_exists('answer', $field)) ? $field['answer'] : ''?>" <?php if($field['size'] != 'default') : ?>class="<?=$field['size']?>"<?php endif ?> />
|
||||
<?php $posStart = $posEnd + mb_strlen('[textinput]', 'UTF-8'); ?>
|
||||
<?php endforeach ?>
|
||||
<?=mb_substr($text, $posStart, mb_strlen($text, 'UTF-8')-$posStart, 'UTF-8')?>
|
||||
|
||||
<?php if(!is_null($nCorrectAnswers)) : ?>
|
||||
<p><?=sprintf(_('You filled %d of %d fields correctly'), $nCorrectAnswers, count($fields))?>.</p>
|
||||
<?php endif ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue