4 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
47 public function insert(&$a_tpl)
52 $a_tpl->setCurrentBlock(
"prop_generic");
53 $a_tpl->setVariable(
"PROP_GENERIC", $this->
getHtml());
54 $a_tpl->parseCurrentBlock();
60 $this->ordering_type = $a_ordering_type;
69 $this->image_path = $a_image_path;
77 $this->image_path_web = $a_image_path_web;
85 $this->thumb_prefix = $a_thumb_prefix;
115 shuffle($a_answers_array);
119 foreach($a_answers_array as $obj_answer)
121 $this->answers[$i][
'random_id'] = $obj_answer->getRandomId();
122 $this->answers[$i][
'answertext'] = (string)$obj_answer->getAnswertext();
123 $this->answers[$i][
'answer_id'] = $obj_answer->getAnswerId();
124 $this->answers[$i][
'ordering_depth'] = $obj_answer->getOrderingDepth();
132 $js_include_tpl =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_html.html", TRUE, TRUE,
"Modules/TestQuestionPool");
133 $js_include_tpl->setCurrentBlock(
'begin_sortablecontainer');
134 $js_include_tpl->setVariable(
'INSTANCE_ID', $this->
getInstanceId());
135 $js_include_tpl->parseCurrentBlock();
137 return $js_include_tpl->get();
141 $js_include_tpl =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_html.html", TRUE, TRUE,
"Modules/TestQuestionPool");
142 $js_include_tpl->touchBlock(
'end_sortablecontainer');
144 return $js_include_tpl->get();
149 $js_include_tpl =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_html.html", TRUE, TRUE,
"Modules/TestQuestionPool");
150 $js_include_tpl->touchBlock(
'begin_list_item');
152 $js_include_tpl->setCurrentBlock(
'item_value');
153 $js_include_tpl->setVariable(
'LIST_ITEM_VALUE', $this->
renderAnswerOutput($cur_answer[
'answertext'], $i));
154 $js_include_tpl->setVariable(
'LIST_ITEM_ID', $i);
160 if($cur_answer[
'ok'] ===
true)
163 $text_ok = $lng->txt(
"answer_is_right");
168 $text_ok = $lng->txt(
"answer_is_wrong");
171 $js_include_tpl->setVariable(
'ICON_OK', $icon_ok);
172 $js_include_tpl->setVariable(
'TEXT_OK', $text_ok);
175 $js_include_tpl->parseCurrentBlock();
177 return $js_include_tpl->get();
182 $js_include_tpl =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_html.html", TRUE, TRUE,
"Modules/TestQuestionPool");
183 $js_include_tpl->touchBlock(
'end_list_item');
185 return $js_include_tpl->get();
190 $js_include_tpl =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_html.html", TRUE, TRUE,
"Modules/TestQuestionPool");
191 $js_include_tpl->touchBlock(
'begin_sublist');
193 return $js_include_tpl->get();
198 $js_include_tpl =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_html.html", TRUE, TRUE,
"Modules/TestQuestionPool");
199 $js_include_tpl->touchBlock(
'end_sublist');
201 return $js_include_tpl->get();
212 $input_tpl =
new ilTemplate(
"tpl.prop_nestable_value.html",
true,
true,
"Modules/TestQuestionPool");
214 if(strlen($text_value))
218 $input_tpl->setCurrentBlock(
'nested_terms');
220 $input_tpl->setVariable(
"INPUT_POST_VAR", $this->
getPostVar() .
"[$i]");
221 $input_tpl->setVariable(
"NON_EDITABLE_ID", $this->
getPostVar() .
"[$i]");
224 $input_tpl->setVariable(
"ID", $this->
getFieldId() .
"[$i]");
228 $input_tpl->setCurrentBlock(
'nested_pictures');
232 $input_tpl->setVariable(
"PICTURE_HREF",$thumbweb);
233 $input_tpl->setVariable(
"THUMB_ALT", $lng->txt(
"thumbnail"));
234 $input_tpl->setVariable(
"THUMB_TITLE", $lng->txt(
"thumbnail"));
235 $input_tpl->setVariable(
"NON_EDITABLE_ID", $this->
getPostVar() .
"[$i]");
236 $input_tpl->setVariable(
"HVALUE", $text_value);
237 $input_tpl->setVariable(
"ID", $this->
getFieldId() .
"[$i]");
242 $input_tpl->parseCurrentBlock();
244 return $input_tpl->get();
260 if($shuffle_depth == 1)
263 foreach($this->answers as $cur_answer)
265 $html_output .= $this->
renderListItem($cur_answer,$cur_answer[
'random_id']);
274 $tmp_array[count($tmp_array)][
'ordering_depth'] =
'END_OF_LIST';
276 foreach($this->answers as $cur_answer)
278 $current_depth = $cur_answer[
'ordering_depth'];
279 $next_depth = $tmp_array[$i+1][
'ordering_depth'];
281 if($next_depth ==
'END_OF_LIST')
286 if($previous_depth == $current_depth)
290 if($current_depth == $next_depth)
294 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
297 else if($current_depth > $next_depth)
299 if($previous_depth == $next_depth)
303 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
308 else if($previous_depth > $next_depth)
312 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
314 for($openlists = $next_depth; $openlists < $current_depth; $openlists++)
322 else if($current_depth < $next_depth)
326 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
330 else if($previous_depth > $current_depth)
332 if($current_depth == $next_depth)
336 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
339 else if($current_depth > $next_depth)
343 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
347 else if($current_depth < $next_depth)
349 if($previous_depth == $next_depth)
353 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
356 else if($previous_depth > $next_depth)
360 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
361 for($openlists = $next_depth; $openlists < $current_depth; $openlists++)
369 else if($previous_depth < $current_depth)
371 if($current_depth == $next_depth)
375 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
378 else if($current_depth > $next_depth)
380 if($previous_depth == $next_depth)
384 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
390 else if($previous_depth > $next_depth)
394 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
395 for($openlists = $next_depth; $openlists < $current_depth; $openlists++)
402 else if($current_depth < $next_depth)
406 $html_output .= $this->
renderListItem($cur_answer, $cur_answer[
'random_id']);
410 $previous_depth = $current_depth;
417 include_once
"Services/jQuery/classes/class.iljQueryUtil.php";
420 $tpl->addJavaScript(
"./Services/jQuery/js/jquery.nestable.js");
425 $js_include_tpl =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_javascript.html", TRUE, TRUE,
"Modules/TestQuestionPool");
426 if(!array_key_exists(
"pdf",
$_GET) ||
$_GET[
"pdf"] != 1)
428 $js_include_tpl->touchBlock(
"css_include");
430 $js_include_tpl->setCurrentBlock(
'js_include');
432 $js_include_tpl->setVariable(
'INSTANCE_ID', $this->
getInstanceId());
433 $js_include_tpl->setVariable(
'HTML_OUTPUT', $html_output);
434 $js_include_tpl->parseCurrentBlock();
436 return $js_include_tpl->get();
452 $tmp_array = $a_solution_array;
453 $tmp_array[count($tmp_array)][
'depth'] =
'END_OF_LIST';
455 foreach($a_solution_array as $cur_answer)
457 $current_depth = $cur_answer[
'depth'];
458 $next_depth = $tmp_array[$i+1][
'depth'];
459 if($next_depth ==
'END_OF_LIST')
464 if($previous_depth == $current_depth)
468 if($current_depth == $next_depth)
475 else if($current_depth > $next_depth)
477 if($previous_depth == $next_depth)
486 else if($previous_depth > $next_depth)
492 for($openlists = $next_depth; $openlists < $current_depth; $openlists++)
500 else if($current_depth < $next_depth)
509 else if($previous_depth > $current_depth)
511 if($current_depth == $next_depth)
518 else if($current_depth > $next_depth)
526 else if($current_depth < $next_depth)
528 if($previous_depth == $next_depth)
535 else if($previous_depth > $next_depth)
540 for($openlists = $next_depth; $openlists < $current_depth; $openlists++)
548 else if($previous_depth < $current_depth)
550 if($current_depth == $next_depth)
557 else if($current_depth > $next_depth)
559 if($previous_depth == $next_depth)
569 else if($previous_depth > $next_depth)
574 for($openlists = $next_depth; $openlists < $current_depth; $openlists++)
581 else if($current_depth < $next_depth)
589 $previous_depth = $current_depth;
598 include_once
"Services/jQuery/classes/class.iljQueryUtil.php";
601 $tpl->addJavaScript(
"./Services/jQuery/js/jquery.nestable.js");
606 $js_include_tpl =
new ilTemplate(
"tpl.il_as_qpl_nested_ordering_output_javascript.html", TRUE, TRUE,
"Modules/TestQuestionPool");
607 if(!array_key_exists(
"pdf",
$_GET) ||
$_GET[
"pdf"] != 1)
609 $js_include_tpl->touchBlock(
"css_include");
611 $js_include_tpl->setCurrentBlock(
'js_include');
616 $js_include_tpl->setVariable(
'HTML_OUTPUT', $html_output);
618 $js_include_tpl->parseCurrentBlock();
620 return $js_include_tpl->get();
625 $this->perform_js = $a_bool;