4 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
32 $this->validationRegexp =
"";
42 $this->values = array();
43 if (is_array($a_value))
45 if (is_array($a_value[
'answer']))
47 foreach ($a_value[
'answer'] as $index =>
$value)
49 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
51 array_push($this->values, $answer);
64 $this->values = $a_values;
84 $this->singleline = $a_value;
104 $this->qstObject =& $a_value;
124 $this->allowMove = $a_allow_move;
163 $this->minvalue = $a_minvalue;
185 if (is_array($foundvalues))
188 if (is_array($foundvalues[
'answer']))
190 foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
192 if ((strlen($answervalue)) == 0)
194 $this->
setAlert($lng->txt(
"msg_input_is_required"));
201 if (is_array($foundvalues[
'points']))
203 foreach ($foundvalues[
'points'] as $points)
205 if ($points > $max) $max = $points;
206 if (((strlen($points)) == 0) || (!is_numeric($points)))
208 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
213 if (trim($points) !=
"" &&
217 $this->
setAlert($lng->txt(
"form_msg_value_too_low"));
224 if (trim($points) !=
"" &&
228 $this->
setAlert($lng->txt(
"form_msg_value_too_low"));
238 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
244 $this->
setAlert($lng->txt(
"msg_input_is_required"));
260 $tpl =
new ilTemplate(
"tpl.prop_answerwizardinput.html",
true,
true,
"Modules/TestQuestionPool");
262 foreach ($this->values as
$value)
266 if (is_object($value))
268 $tpl->setCurrentBlock(
"prop_text_propval");
270 $tpl->parseCurrentBlock();
271 $tpl->setCurrentBlock(
"prop_points_propval");
273 $tpl->parseCurrentBlock();
275 $tpl->setCurrentBlock(
'singleline');
277 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]");
278 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
283 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"");
285 $tpl->parseCurrentBlock();
289 if (is_object($value))
291 $tpl->setCurrentBlock(
"prop_points_propval");
293 $tpl->parseCurrentBlock();
295 $tpl->setCurrentBlock(
'multiline');
296 $tpl->setVariable(
"PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext()));
297 $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() .
"[answer][$i]");
298 $tpl->setVariable(
"MULTILINE_ROW_NUMBER", $i);
302 $tpl->setVariable(
"DISABLED_MULTILINE",
" disabled=\"disabled\"");
304 $tpl->parseCurrentBlock();
308 $tpl->setCurrentBlock(
"move");
309 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
310 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
314 $tpl->parseCurrentBlock();
316 $tpl->setCurrentBlock(
"row");
318 $tpl->setVariable(
"ROW_NUMBER", $i);
320 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]");
321 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
322 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
325 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"");
329 $tpl->parseCurrentBlock();
334 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
335 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
336 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
338 $a_tpl->setCurrentBlock(
"prop_generic");
339 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
340 $a_tpl->parseCurrentBlock();
343 $tpl->addJavascript(
"./Services/Form/js/ServiceFormWizardInput.js");
344 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/answerwizard.js");