55 $this->validationRegexp =
"";
65 $this->values = array();
66 if (is_array($a_value))
68 if (is_array($a_value[
'answer']))
70 foreach ($a_value[
'answer'] as $index =>
$value)
72 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
74 array_push($this->values, $answer);
87 $this->values = $a_values;
107 $this->singleline = $a_value;
127 $this->qstObject =& $a_value;
147 $this->allowMove = $a_allow_move;
186 $this->minvalue = $a_minvalue;
208 if (is_array($foundvalues))
211 if (is_array($foundvalues[
'answer']))
213 foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
215 if ((strlen($answervalue)) == 0)
217 $this->
setAlert($lng->txt(
"msg_input_is_required"));
224 if (is_array($foundvalues[
'points']))
226 foreach ($foundvalues[
'points'] as $points)
228 if ($points > $max) $max = $points;
229 if (((strlen($points)) == 0) || (!is_numeric($points)))
231 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
236 if (trim($points) !=
"" &&
240 $this->
setAlert($lng->txt(
"form_msg_value_too_low"));
247 if (trim($points) !=
"" &&
251 $this->
setAlert($lng->txt(
"form_msg_value_too_low"));
261 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
267 $this->
setAlert($lng->txt(
"msg_input_is_required"));
283 $tpl =
new ilTemplate(
"tpl.prop_answerwizardinput.html",
true,
true,
"Modules/TestQuestionPool");
285 foreach ($this->values as
$value)
289 if (is_object($value))
291 $tpl->setCurrentBlock(
"prop_text_propval");
293 $tpl->parseCurrentBlock();
294 $tpl->setCurrentBlock(
"prop_points_propval");
296 $tpl->parseCurrentBlock();
298 $tpl->setCurrentBlock(
'singleline');
300 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]");
301 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
306 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"");
308 $tpl->parseCurrentBlock();
312 if (is_object($value))
314 $tpl->setCurrentBlock(
"prop_points_propval");
316 $tpl->parseCurrentBlock();
318 $tpl->setCurrentBlock(
'multiline');
319 $tpl->setVariable(
"PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext()));
320 $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() .
"[answer][$i]");
321 $tpl->setVariable(
"MULTILINE_ROW_NUMBER", $i);
325 $tpl->setVariable(
"DISABLED_MULTILINE",
" disabled=\"disabled\"");
327 $tpl->parseCurrentBlock();
331 $tpl->setCurrentBlock(
"move");
332 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
333 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
337 $tpl->parseCurrentBlock();
339 $tpl->setCurrentBlock(
"row");
340 $class = ($i % 2 == 0) ?
"even" :
"odd";
341 if ($i == 0) $class .=
" first";
342 if ($i == count($this->values)-1) $class .=
" last";
343 $tpl->setVariable(
"ROW_CLASS", $class);
345 $tpl->setVariable(
"ROW_NUMBER", $i);
346 if(!$this->disable_actions)
349 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]" );
350 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]" );
351 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]" );
355 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"");
357 if(!$this->disable_actions)
362 $tpl->parseCurrentBlock();
367 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
368 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
369 if(!$this->disable_actions)
371 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
374 $a_tpl->setCurrentBlock(
"prop_generic");
375 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
376 $a_tpl->parseCurrentBlock();
379 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
381 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/answerwizard.js");