49 $this->values = array();
50 if (is_array($a_value)) {
51 if (is_array($a_value[
'key'])) {
52 foreach ($a_value[
'key'] as $idx =>
$key) {
53 $this->values[] =
new assAnswerErrorText(
$key, $a_value[
'value'][$idx], (
float) str_replace(
",",
".", $a_value[
'points'][$idx]));
66 $this->key_size = $a_size;
86 $this->value_size = $a_size;
106 $this->key_maxlength = $a_maxlength;
126 $this->value_maxlength = $a_maxlength;
146 $this->value_name = $a_name;
166 $this->key_name = $a_name;
186 $this->values = $a_values;
211 $foundvalues = $_POST[$this->
getPostVar()] ?? null;
215 if (is_array($foundvalues) && count($foundvalues) > 0) {
217 if (is_array($foundvalues[
'key']) && is_array($foundvalues[
'value'])) {
218 foreach ($foundvalues[
'key'] as $val) {
224 foreach ($foundvalues[
'value'] as $val) {
230 foreach ($foundvalues[
'points'] as $val) {
231 $val_num = str_replace(
",",
".", $val);
236 if (!is_numeric($val_num)) {
268 $tpl =
new ilTemplate(
"tpl.prop_errortextwizardinput.html",
true,
true,
"Modules/TestQuestionPool");
270 foreach ($this->values as
$value) {
271 if (is_object($value)) {
272 if (strlen($value->getTextWrong())) {
273 $tpl->setCurrentBlock(
"prop_key_propval");
275 $tpl->parseCurrentBlock();
277 if (strlen($value->getTextCorrect())) {
278 $tpl->setCurrentBlock(
"prop_value_propval");
283 $tpl->parseCurrentBlock();
285 if (strlen($value->getPoints())) {
286 $tpl->setCurrentBlock(
"prop_points_propval");
288 $tpl->parseCurrentBlock();
292 $tpl->setCurrentBlock(
"row");
293 $class = ($i % 2 == 0) ?
"even" :
"odd";
297 if ($i == count($this->values) - 1) {
300 $tpl->setVariable(
"ROW_CLASS", $class);
301 $tpl->setVariable(
"ROW_NUMBER", $i);
303 $tpl->setVariable(
"KEY_SIZE", $this->
getKeySize());
304 $tpl->setVariable(
"KEY_ID", $this->
getPostVar() .
"[key][$i]");
308 $tpl->setVariable(
"VALUE_ID", $this->
getPostVar() .
"[value][$i]");
311 $tpl->setVariable(
"POST_VAR", $this->
getPostVar());
313 $tpl->parseCurrentBlock();
317 $tpl->setVariable(
"ELEMENT_ID", $this->
getPostVar());
318 $tpl->setVariable(
"KEY_TEXT", $this->
getKeyName());
320 $tpl->setVariable(
"POINTS_TEXT",
$lng->
txt(
'points'));
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setKeySize($a_size)
Set key size.
getKeyName()
Get key name.
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...
setValueName($a_name)
Set value name.
__construct($a_title="", $a_postvar="")
Constructor.
checkInput()
Check input, strip slashes etc.
getKeySize()
Get key size.
setKeyMaxlength($a_maxlength)
Set key maxlength.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValueMaxlength($a_maxlength)
Set value maxlength.
setKeyName($a_name)
Set key name.
setVariable($variable, $value='')
Sets a variable value.
getValueName()
Get value name.
getValueSize()
Get value size.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
getValueMaxlength()
Get value maxlength.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValueSize($a_size)
Set value size.
getKeyMaxlength()
Get key maxlength.
setValues($a_values)
Set Values.
insert(ilTemplate $a_tpl)
Insert property html.