50 $this->validationRegexp =
"";
60 $this->values = array();
61 if (is_array($a_value))
63 if (is_array($a_value[
'answer']))
65 foreach ($a_value[
'answer'] as $index =>
$value)
67 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
69 array_push($this->values, $answer);
82 $this->values = $a_values;
102 $this->singleline = $a_value;
122 $this->qstObject =& $a_value;
142 $this->allowMove = $a_allow_move;
181 $this->minvalue = $a_minvalue;
203 if (is_array($foundvalues))
206 if (is_array($foundvalues[
'answer']))
208 foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
210 if ((strlen($answervalue)) == 0)
212 $this->
setAlert($lng->txt(
"msg_input_is_required"));
219 if (is_array($foundvalues[
'points']))
221 foreach ($foundvalues[
'points'] as $points)
223 if ($points > $max) $max = $points;
224 if (((strlen($points)) == 0) || (!is_numeric($points)))
226 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
231 if (trim($points) !=
"" &&
235 $this->
setAlert($lng->txt(
"form_msg_value_too_low"));
242 if (trim($points) !=
"" &&
246 $this->
setAlert($lng->txt(
"form_msg_value_too_low"));
256 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
262 $this->
setAlert($lng->txt(
"msg_input_is_required"));
278 $tpl =
new ilTemplate(
"tpl.prop_answerwizardinput.html",
true,
true,
"Modules/TestQuestionPool");
280 foreach ($this->values as
$value)
284 if (is_object($value))
286 $tpl->setCurrentBlock(
"prop_text_propval");
288 $tpl->parseCurrentBlock();
289 $tpl->setCurrentBlock(
"prop_points_propval");
291 $tpl->parseCurrentBlock();
293 $tpl->setCurrentBlock(
'singleline');
295 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]");
296 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
301 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"");
303 $tpl->parseCurrentBlock();
307 if (is_object($value))
309 $tpl->setCurrentBlock(
"prop_points_propval");
311 $tpl->parseCurrentBlock();
313 $tpl->setCurrentBlock(
'multiline');
314 $tpl->setVariable(
"PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext()));
315 $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() .
"[answer][$i]");
316 $tpl->setVariable(
"MULTILINE_ROW_NUMBER", $i);
320 $tpl->setVariable(
"DISABLED_MULTILINE",
" disabled=\"disabled\"");
322 $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]");
332 $tpl->parseCurrentBlock();
334 $tpl->setCurrentBlock(
"row");
335 $class = ($i % 2 == 0) ?
"even" :
"odd";
336 if ($i == 0) $class .=
" first";
337 if ($i == count($this->values)-1) $class .=
" last";
338 $tpl->setVariable(
"ROW_CLASS", $class);
340 $tpl->setVariable(
"ROW_NUMBER", $i);
342 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]");
343 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
344 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
347 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"");
351 $tpl->parseCurrentBlock();
356 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
357 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
358 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
360 $a_tpl->setCurrentBlock(
"prop_generic");
361 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
362 $a_tpl->parseCurrentBlock();
365 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
367 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/answerwizard.js");