57 $this->values = array();
58 include_once
"./Modules/Test/classes/class.ilRandomTestData.php";
59 if (is_array($a_value[
'qpl']))
61 foreach ($a_value[
'qpl'] as $idx => $qpl)
63 array_push($this->values,
new ilRandomTestData($a_value[
'count'][$idx], $qpl));
80 $this->equal_points = $a_value;
100 $this->values = $a_values;
120 $this->random_pools = $a_values;
130 $this->question_count = $a_value;
153 if (is_array($foundvalues))
155 if (is_array($foundvalues[
'count']))
160 foreach ($foundvalues[
'count'] as $idx => $answervalue)
162 if ((strlen($answervalue)) == 0)
164 $this->
setAlert($lng->txt(
"msg_input_is_required"));
167 if (!is_numeric($answervalue))
169 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
172 if ($answervalue < 1)
174 $this->
setAlert($lng->txt(
"msg_question_count_too_low"));
177 if ($answervalue > $this->random_pools[$foundvalues[
'qpl'][$idx]][
'count'])
179 $this->
setAlert($lng->txt(
"tst_random_selection_question_count_too_high"));
189 $this->
setAlert($lng->txt(
"msg_question_count_too_low"));
194 if (is_array($foundvalues[
'qpl']))
196 foreach ($foundvalues[
'qpl'] as $qpl)
200 $this->
setAlert($lng->txt(
"msg_input_is_required"));
208 $this->
setAlert($lng->txt(
"msg_input_is_required"));
223 $tpl =
new ilTemplate(
"tpl.prop_randomtestinput.html",
true,
true,
"Modules/Test");
226 foreach ($this->values as $value)
228 if (array_key_exists($value->qpl, $this->random_pools)) unset($pools[$value->qpl]);
230 foreach ($this->values as $value)
234 if (is_object($value))
236 $tpl->setCurrentBlock(
"prop_text_propval");
238 $tpl->parseCurrentBlock();
240 $tpl->setCurrentBlock(
'question_count');
241 $tpl->setVariable(
"SIZE", 3);
242 $tpl->setVariable(
"QUESTION_COUNT_ID", $this->
getPostVar() .
"[count][$i]");
243 $tpl->setVariable(
"QUESTION_COUNT_ROW_NUMBER", $i);
245 $tpl->setVariable(
"MAXLENGTH", 5);
248 $tpl->setVariable(
"DISABLED_QUESTION_COUNT",
" disabled=\"disabled\"");
250 $tpl->parseCurrentBlock();
253 $tpl->setCurrentBlock(
"option");
254 $tpl->setVariable(
"OPTION_VALUE", 0);
256 $tpl->parseCurrentBlock();
257 foreach ($this->random_pools as $qpl => $pool)
259 if (($value->qpl == $qpl) || (array_key_exists($qpl, $pools)))
261 $tpl->setCurrentBlock(
"option");
262 if ($value->qpl == $qpl)
264 $tpl->setVariable(
"OPTION_SELECTED",
' selected="selected"');
266 $tpl->setVariable(
"OPTION_VALUE", $qpl);
268 $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(
"CMD_ADD",
"cmd[add" . $this->
getPostVar() .
"][$i]");
281 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getPostVar() .
"][$i]");
284 $tpl->parseCurrentBlock();
289 $a_tpl->setCurrentBlock(
"prop_generic");
290 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
291 $a_tpl->parseCurrentBlock();