37 $this->values = array();
38 include_once
"./Modules/Test/classes/class.ilRandomTestData.php";
39 if (is_array($a_value[
'qpl']))
41 foreach ($a_value[
'qpl'] as $idx => $qpl)
43 array_push($this->values,
new ilRandomTestData($a_value[
'count'][$idx], $qpl));
60 $this->equal_points = $a_value;
80 $this->values = $a_values;
100 $this->random_pools = $a_values;
110 $this->question_count = $a_value;
133 if (is_array($foundvalues))
135 if (is_array($foundvalues[
'count']))
137 if (count($foundvalues[
'qpl']) != count(array_unique($foundvalues[
'qpl'])))
139 $this->
setAlert($lng->txt(
"msg_randompool_duplicate_qpl"));
145 foreach ($foundvalues[
'count'] as $idx => $answervalue)
147 if ((strlen($answervalue)) == 0)
149 $this->
setAlert($lng->txt(
"msg_input_is_required"));
152 if (!is_numeric($answervalue))
154 $this->
setAlert($lng->txt(
"form_msg_numeric_value_required"));
157 if ($answervalue < 1)
159 $this->
setAlert($lng->txt(
"msg_question_count_too_low"));
162 if ($answervalue > $this->random_pools[$foundvalues[
'qpl'][$idx]][
'count'])
164 $this->
setAlert($lng->txt(
"tst_random_selection_question_count_too_high"));
174 $this->
setAlert($lng->txt(
"msg_question_count_too_low"));
179 if (is_array($foundvalues[
'qpl']))
181 foreach ($foundvalues[
'qpl'] as $qpl)
185 $this->
setAlert($lng->txt(
"msg_input_is_required"));
193 $this->
setAlert($lng->txt(
"msg_input_is_required"));
208 $tpl =
new ilTemplate(
"tpl.prop_randomtestinput.html",
true,
true,
"Modules/Test");
211 foreach ($this->values as $value)
213 if (array_key_exists($value->qpl, $this->random_pools)) unset($pools[$value->qpl]);
215 foreach ($this->values as $value)
219 if (is_object($value))
221 $tpl->setCurrentBlock(
"prop_text_propval");
223 $tpl->parseCurrentBlock();
225 $tpl->setCurrentBlock(
'question_count');
226 $tpl->setVariable(
"SIZE", 3);
227 $tpl->setVariable(
"QUESTION_COUNT_ID", $this->
getPostVar() .
"[count][$i]");
228 $tpl->setVariable(
"QUESTION_COUNT_ROW_NUMBER", $i);
230 $tpl->setVariable(
"MAXLENGTH", 5);
233 $tpl->setVariable(
"DISABLED_QUESTION_COUNT",
" disabled=\"disabled\"");
235 $tpl->parseCurrentBlock();
238 $tpl->setCurrentBlock(
"option");
239 $tpl->setVariable(
"OPTION_VALUE", 0);
241 $tpl->parseCurrentBlock();
242 foreach ($this->random_pools as $qpl => $pool)
244 if (($value->qpl == $qpl) || (array_key_exists($qpl, $pools)))
246 $tpl->setCurrentBlock(
"option");
247 if ($value->qpl == $qpl)
249 $tpl->setVariable(
"OPTION_SELECTED",
' selected="selected"');
251 $tpl->setVariable(
"OPTION_VALUE", $qpl);
253 $tpl->parseCurrentBlock();
257 $tpl->setCurrentBlock(
"row");
258 $class = ($i % 2 == 0) ?
"even" :
"odd";
259 if ($i == 0) $class .=
" first";
260 if ($i == count($this->values)-1) $class .=
" last";
261 $tpl->setVariable(
"ROW_CLASS", $class);
263 $tpl->setVariable(
"ROW_NUMBER", $i);
265 $tpl->setVariable(
"CMD_ADD",
"cmd[add" . $this->
getPostVar() .
"][$i]");
266 $tpl->setVariable(
"CMD_REMOVE",
"cmd[remove" . $this->
getPostVar() .
"][$i]");
269 $tpl->parseCurrentBlock();
274 $a_tpl->setCurrentBlock(
"prop_generic");
275 $a_tpl->setVariable(
"PROP_GENERIC",
$tpl->get());
276 $a_tpl->parseCurrentBlock();