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']))
157 if (count($foundvalues[
'qpl']) != count(array_unique($foundvalues[
'qpl'])))
159 $this->
setAlert($lng->txt(
"msg_randompool_duplicate_qpl"));
165 foreach ($foundvalues[
'count'] as $idx => $answervalue)
167 if ((strlen($answervalue)) == 0)
169 $this->
setAlert($lng->txt(
"msg_input_is_required"));
172 if (!is_numeric($answervalue))
174 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
177 if ($answervalue < 1)
179 $this->
setAlert($lng->txt(
"msg_question_count_too_low"));
182 if ($answervalue > $this->random_pools[$foundvalues[
'qpl'][$idx]][
'count'])
184 $this->
setAlert($lng->txt(
"tst_random_selection_question_count_too_high"));
194 $this->
setAlert($lng->txt(
"msg_question_count_too_low"));
199 if (is_array($foundvalues[
'qpl']))
201 foreach ($foundvalues[
'qpl'] as $qpl)
205 $this->
setAlert($lng->txt(
"msg_input_is_required"));
213 $this->
setAlert($lng->txt(
"msg_input_is_required"));
228 $tpl =
new ilTemplate(
"tpl.prop_randomtestinput.html",
true,
true,
"Modules/Test");
231 foreach ($this->values as $value)
233 if (array_key_exists($value->qpl, $this->random_pools)) unset($pools[$value->qpl]);
235 foreach ($this->values as $value)
239 if (is_object($value))
241 $tpl->setCurrentBlock(
"prop_text_propval");
243 $tpl->parseCurrentBlock();
245 $tpl->setCurrentBlock(
'question_count');
246 $tpl->setVariable(
"SIZE", 3);
247 $tpl->setVariable(
"QUESTION_COUNT_ID", $this->
getPostVar() .
"[count][$i]");
248 $tpl->setVariable(
"QUESTION_COUNT_ROW_NUMBER", $i);
250 $tpl->setVariable(
"MAXLENGTH", 5);
253 $tpl->setVariable(
"DISABLED_QUESTION_COUNT",
" disabled=\"disabled\"");
255 $tpl->parseCurrentBlock();
258 $tpl->setCurrentBlock(
"option");
259 $tpl->setVariable(
"OPTION_VALUE", 0);
261 $tpl->parseCurrentBlock();
262 foreach ($this->random_pools as $qpl => $pool)
264 if (($value->qpl == $qpl) || (array_key_exists($qpl, $pools)))
266 $tpl->setCurrentBlock(
"option");
267 if ($value->qpl == $qpl)
269 $tpl->setVariable(
"OPTION_SELECTED",
' selected="selected"');
271 $tpl->setVariable(
"OPTION_VALUE", $qpl);
273 $tpl->parseCurrentBlock();
277 $tpl->setCurrentBlock(
"row");
278 $class = ($i % 2 == 0) ?
"even" :
"odd";
279 if ($i == 0) $class .=
" first";
280 if ($i == count($this->values)-1) $class .=
" last";
281 $tpl->setVariable(
"ROW_CLASS", $class);
283 $tpl->setVariable(
"ROW_NUMBER", $i);
285 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getPostVar() .
"][$i]");
286 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getPostVar() .
"][$i]");
289 $tpl->parseCurrentBlock();
294 $a_tpl->setCurrentBlock(
"prop_generic");
295 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
296 $a_tpl->parseCurrentBlock();