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;
161 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
164 if (is_array($foundvalues))
167 if (is_array($foundvalues[
'answer']))
169 foreach ($foundvalues[
'answer'] as $aidx => $answervalue)
171 if ((strlen($answervalue)) == 0)
173 $this->
setAlert($lng->txt(
"msg_input_is_required"));
180 if (is_array($foundvalues[
'points']))
182 foreach ($foundvalues[
'points'] as
$points)
184 if ($points > $max) $max =
$points;
185 if (((strlen($points)) == 0) || (!is_numeric($points)))
187 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
194 $this->
setAlert($lng->txt(
"enter_enough_positive_points"));
200 $this->
setAlert($lng->txt(
"msg_input_is_required"));
216 $tpl =
new ilTemplate(
"tpl.prop_answerwizardinput.html",
true,
true,
"Modules/TestQuestionPool");
218 foreach ($this->values as
$value)
222 if (is_object($value))
224 $tpl->setCurrentBlock(
"prop_text_propval");
226 $tpl->parseCurrentBlock();
227 $tpl->setCurrentBlock(
"prop_points_propval");
229 $tpl->parseCurrentBlock();
231 $tpl->setCurrentBlock(
'singleline');
233 $tpl->setVariable(
"SINGLELINE_ID", $this->
getPostVar() .
"[answer][$i]");
234 $tpl->setVariable(
"SINGLELINE_ROW_NUMBER", $i);
239 $tpl->setVariable(
"DISABLED_SINGLELINE",
" disabled=\"disabled\"");
241 $tpl->parseCurrentBlock();
245 if (is_object($value))
247 $tpl->setCurrentBlock(
"prop_points_propval");
249 $tpl->parseCurrentBlock();
251 $tpl->setCurrentBlock(
'multiline');
252 $tpl->setVariable(
"PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext()));
253 $tpl->setVariable(
"MULTILINE_ID", $this->
getPostVar() .
"[answer][$i]");
254 $tpl->setVariable(
"MULTILINE_ROW_NUMBER", $i);
258 $tpl->setVariable(
"DISABLED_MULTILINE",
" disabled=\"disabled\"");
260 $tpl->parseCurrentBlock();
264 $tpl->setCurrentBlock(
"move");
265 $tpl->setVariable(
"CMD_UP",
"cmd[up" . $this->
getFieldId() .
"][$i]");
266 $tpl->setVariable(
"CMD_DOWN",
"cmd[down" . $this->
getFieldId() .
"][$i]");
270 $tpl->parseCurrentBlock();
272 $tpl->setCurrentBlock(
"row");
273 $class = ($i % 2 == 0) ?
"even" :
"odd";
274 if ($i == 0) $class .=
" first";
275 if ($i == count($this->values)-1) $class .=
" last";
276 $tpl->setVariable(
"ROW_CLASS", $class);
278 $tpl->setVariable(
"ROW_NUMBER", $i);
280 $tpl->setVariable(
"POINTS_ID", $this->
getPostVar() .
"[points][$i]");
281 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getFieldId() .
"][$i]");
282 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getFieldId() .
"][$i]");
285 $tpl->setVariable(
"DISABLED_POINTS",
" disabled=\"disabled\"");
289 $tpl->parseCurrentBlock();
294 $tpl->setVariable(
"ANSWER_TEXT", $lng->txt(
'answer_text'));
295 $tpl->setVariable(
"POINTS_TEXT", $lng->txt(
'points'));
296 $tpl->setVariable(
"COMMANDS_TEXT", $lng->txt(
'actions'));
298 $a_tpl->setCurrentBlock(
"prop_generic");
299 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
300 $a_tpl->parseCurrentBlock();
303 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
305 $tpl->addJavascript(
"./Modules/TestQuestionPool/templates/default/answerwizard.js");