48 $this->validationRegexp =
"";
58 $this->values = array();
59 if (is_array($a_value))
61 if (is_array($a_value[
'answer']))
63 foreach ($a_value[
'answer'] as $index =>
$value)
65 include_once
"./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
67 array_push($this->values, $answer);
80 $this->values = $a_values;
100 $this->singleline = $a_value;
120 $this->qstObject =& $a_value;
140 $this->allowMove = $a_allow_move;
163 if (is_array($foundvalues))
166 if (is_array($foundvalues[
'answer']))
168 foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
170 if ((strlen($answervalue)) == 0)
172 $this->
setAlert($lng->txt(
"msg_input_is_required"));
179 if (is_array($foundvalues[
'points']))
181 foreach ($foundvalues[
'points'] as
$points)
183 if ($points > $max) $max =
$points;
184 if (((strlen($points)) == 0) || (!is_numeric($points)))
186 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
193 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
199 $this->
setAlert($lng->txt(
"msg_input_is_required"));
215 $tpl =
new ilTemplate(
"tpl.prop_answerwizardinput.html",
true,
true,
"Modules/TestQuestionPool");
217 foreach ($this->values as
$value)
221 if (is_object($value))
223 $tpl->setCurrentBlock(
"prop_text_propval");
225 $tpl->parseCurrentBlock();
226 $tpl->setCurrentBlock(
"prop_points_propval");
228 $tpl->parseCurrentBlock();
230 $tpl->setCurrentBlock(
'singleline');
232 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]");
233 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
238 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"");
240 $tpl->parseCurrentBlock();
244 if (is_object($value))
246 $tpl->setCurrentBlock(
"prop_points_propval");
248 $tpl->parseCurrentBlock();
250 $tpl->setCurrentBlock(
'multiline');
251 $tpl->setVariable(
"PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext()));
252 $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() .
"[answer][$i]");
253 $tpl->setVariable(
"MULTILINE_ROW_NUMBER", $i);
257 $tpl->setVariable(
"DISABLED_MULTILINE",
" disabled=\"disabled\"");
259 $tpl->parseCurrentBlock();
263 $tpl->setCurrentBlock(
"move");
264 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
265 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
269 $tpl->parseCurrentBlock();
271 $tpl->setCurrentBlock(
"row");
272 $class = ($i % 2 == 0) ?
"even" :
"odd";
273 if ($i == 0) $class .=
" first";
274 if ($i == count($this->values)-1) $class .=
" last";
275 $tpl->setVariable(
"ROW_CLASS", $class);
277 $tpl->setVariable(
"ROW_NUMBER", $i);
279 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]");
280 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
281 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
284 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"");
288 $tpl->parseCurrentBlock();
293 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
294 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
295 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
297 $a_tpl->setCurrentBlock(
"prop_generic");
298 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
299 $a_tpl->parseCurrentBlock();
302 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
304 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/answerwizard.js");