53 $this->glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
54 $this->renderer = $DIC->ui()->renderer();
57 $this->validationRegexp =
"";
62 $this->values = array();
63 if (is_array($a_value)) {
64 if (is_array($a_value[
'answer'])) {
65 foreach ($a_value[
'answer'] as $index =>
$value) {
67 if (isset($a_value[
'imagename'][$index])) {
68 $answer->setImage($a_value[
'imagename'][$index]);
70 array_push($this->values, $answer);
83 $this->values = $a_values;
103 $this->singleline = $a_value;
123 $this->qstObject = &$a_value;
143 $this->allowMove = $a_allow_move;
198 $this->minvalue = $a_minvalue;
220 if (is_array($foundvalues)) {
223 if (is_array($foundvalues[
'answer'])) {
224 foreach ($foundvalues[
'answer'] as $aidx => $answervalue) {
225 if ((strlen($answervalue)) == 0) {
233 if (is_array($foundvalues[
'points'])) {
234 foreach ($foundvalues[
'points'] as $points) {
235 if ($points > $max) {
238 if (((strlen($points)) == 0) || (!is_numeric($points))) {
243 if (trim($points) !=
"" &&
251 if (trim($points) !=
"" &&
280 foreach ($this->values as
$value) {
282 if (is_object($value)) {
283 $tpl->setCurrentBlock(
"prop_text_propval");
288 $tpl->parseCurrentBlock();
289 $tpl->setCurrentBlock(
"prop_points_propval");
294 $tpl->parseCurrentBlock();
296 $tpl->setCurrentBlock(
'singleline');
297 $tpl->setVariable(
"SIZE", $this->
getSize());
298 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]");
299 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
300 $tpl->setVariable(
"SINGLELINE_POST_VAR", $this->
getPostVar());
303 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"");
305 $tpl->parseCurrentBlock();
307 if (is_object($value)) {
308 $tpl->setCurrentBlock(
"prop_points_propval");
313 $tpl->parseCurrentBlock();
315 $tpl->setCurrentBlock(
'multiline');
317 $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() .
"[answer][$i]");
318 $tpl->setVariable(
"MULTILINE_ROW_NUMBER", $i);
319 $tpl->setVariable(
"MULTILINE_POST_VAR", $this->
getPostVar());
321 $tpl->setVariable(
"DISABLED_MULTILINE",
" disabled=\"disabled\"");
323 $tpl->parseCurrentBlock();
326 $tpl->setCurrentBlock(
"move");
327 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
328 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
329 $tpl->setVariable(
"ID", $this->
getPostVar() .
"[$i]");
330 $tpl->setVariable(
"UP_BUTTON", $this->renderer->render(
331 $this->glyph_factory->up()->withAction(
'#')
333 $tpl->setVariable(
"DOWN_BUTTON", $this->renderer->render(
334 $this->glyph_factory->down()->withAction(
'#')
336 $tpl->parseCurrentBlock();
338 $tpl->setCurrentBlock(
"row");
339 $tpl->setVariable(
"POST_VAR", $this->
getPostVar());
340 $tpl->setVariable(
"ROW_NUMBER", $i);
341 $tpl->setVariable(
"ID", $this->
getPostVar() .
"[answer][$i]");
342 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]");
344 $tpl->setVariable(
"ADD_REMOVE_ID", $this->
getPostVar() .
"[$i]");
345 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
346 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
347 $tpl->setVariable(
"ADD_BUTTON", $this->renderer->render(
348 $this->glyph_factory->add()->withAction(
'#')
350 $tpl->setVariable(
"REMOVE_BUTTON", $this->renderer->render(
351 $this->glyph_factory->remove()->withAction(
'#')
355 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"");
357 $tpl->parseCurrentBlock();
361 $tpl->setVariable(
"ELEMENT_ID", $this->
getPostVar());
364 $tpl->setVariable(
"COMMANDS_TEXT",
$lng->
txt(
'actions'));
372 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/answerwizardinput.js");
373 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/answerwizard.js");
382 return $lng->
txt(
'answer_text');
399 return "tpl.prop_answerwizardinput.html";
404 $input = $this->
refinery->kindlyTo()->string()->transform($input);
406 $input = htmlspecialchars($input, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, null,
false);
407 return str_replace([
'{',
'}',
'\\'], [
'{',
'}',
'\'], $input);
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
An entity that renders components to a string output.
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Class for answers with a binary state indicator.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This is how a factory for glyphs looks like.
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)