ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.assOrderingQuestionGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once './Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
7require_once './Modules/Test/classes/inc.AssessmentConstants.php';
8
24{
28 public $object;
29
30 public $old_ordering_depth = array();
31 public $leveled_ordering = array();
32
37
47 public function __construct($id = -1)
48 {
49 parent::__construct();
50 include_once "./Modules/TestQuestionPool/classes/class.assOrderingQuestion.php";
51 $this->object = new assOrderingQuestion();
52 if ($id >= 0)
53 {
54 $this->object->loadFromDb($id);
55 }
56 $this->clearAnswersOnWritingPostDataEnabled = false;
57 }
58
63 {
64 $this->clearAnswersOnWritingPostDataEnabled = $clearAnswersOnWritingPostDataEnabled;
65 }
66
71 {
73 }
74
75 public function changeToPictures()
76 {
77 if($this->object->getOrderingType() != OQ_NESTED_PICTURES && $this->object->getOrderingType() != OQ_PICTURES)
78 {
80 }
81
82 $form = $this->buildEditForm();
83 $form->setValuesByPost();
84 $this->persistAuthoringForm($form);
85
86 $this->object->setOrderingType(OQ_PICTURES);
87 $this->object->saveToDb();
88
89 $form->ensureReprintableFormStructure($this->object);
90 $this->renderEditForm($form);
91 }
92
93 public function changeToText()
94 {
95 if($this->object->getOrderingType() != OQ_NESTED_TERMS && $this->object->getOrderingType() != OQ_TERMS)
96 {
98 }
99
100 $form = $this->buildEditForm();
101 $form->setValuesByPost();
102 $this->persistAuthoringForm($form);
103
104 $this->object->setOrderingType(OQ_TERMS);
105 $this->object->saveToDb();
106
107 $form->ensureReprintableFormStructure($this->object);
108 $this->renderEditForm($form);
109 }
110
111 public function orderNestedTerms()
112 {
113 $this->writePostData(true);
114 $this->object->setOrderingType(OQ_NESTED_TERMS);
115 $this->object->saveToDb();
116
117 $this->renderEditForm($this->buildEditForm());
118 }
119
120 public function orderNestedPictures()
121 {
122 $this->writePostData(true);
123 $this->object->setOrderingType(OQ_NESTED_PICTURES);
124 $this->object->saveToDb();
125
126 $this->renderEditForm($this->buildEditForm());
127 }
128
129 public function removeElementImage()
130 {
131 $orderingInput = $this->object->buildOrderingImagesInputGui();
132 $this->object->initOrderingElementAuthoringProperties($orderingInput);
133
134 $form = $this->buildEditForm();
135 $form->replaceFormItemByPostVar($orderingInput);
136 $form->setValuesByPost();
137
138 $replacementElemList = ilAssOrderingElementList::buildInstance(
139 $this->object->getId(), array()
140 );
141
142 $storedElementList = $this->object->getOrderingElementList();
143
144 foreach($orderingInput->getElementList($this->object->getId()) as $submittedElement)
145 {
146 if( $submittedElement->isImageRemovalRequest() )
147 {
148 if( $this->object->isImageFileStored($submittedElement->getContent()) )
149 {
150 $this->object->dropImageFile($submittedElement->getContent());
151 }
152
153 $submittedElement->setContent(null);
154 }
155
156 if( $storedElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier()) )
157 {
158 $storedElement = $storedElementList->getElementByRandomIdentifier(
159 $submittedElement->getRandomIdentifier()
160 );
161
162 $submittedElement->setSolutionIdentifier($storedElement->getSolutionIdentifier());
163 $submittedElement->setIndentation($storedElement->getIndentation());
164 }
165
166 $replacementElemList->addElement($submittedElement);
167 }
168
169 $replacementElemList->saveToDb();
170
171 $orderingInput->setElementList( $replacementElemList );
172 $this->renderEditForm($form);
173 }
174
175 public function uploadElementImage()
176 {
177 $orderingInput = $this->object->buildOrderingImagesInputGui();
178 $this->object->initOrderingElementAuthoringProperties($orderingInput);
179
180 $form = $this->buildEditForm();
181 $form->replaceFormItemByPostVar($orderingInput);
182 $form->setValuesByPost();
183
184 if(!$orderingInput->checkInput())
185 {
186 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
187 }
188
189 $this->writeAnswerSpecificPostData($form);
190 $this->object->getOrderingElementList()->saveToDb();
191 $orderingInput->setElementList($this->object->getOrderingElementList());
192
193 $this->renderEditForm($form);
194 }
195
197 {
198 $this->object->setThumbGeometry( $_POST["thumb_geometry"] );
199 $this->object->setElementHeight( $_POST["element_height"] );
200 //$this->object->setOrderingType( $_POST["ordering_type"] );
201 $this->object->setPoints($_POST["points"]);
202 }
203
205 {
207 {
208 throw new ilTestQuestionPoolException('form submit request missing the form submit!?');
209 }
210
211 #$submittedElementList = $this->object->fetchSolutionListFromFormSubmissionData($_POST);
212 $submittedElementList = $this->object->fetchSolutionListFromSubmittedForm($form);
213
214 $replacementElementList = new ilAssOrderingElementList();
215 $replacementElementList->setQuestionId($this->object->getId());
216
217 $currentElementList = $this->object->getOrderingElementList();
218
219 foreach($submittedElementList as $submittedElement)
220 {
221 if( $this->object->hasOrderingTypeUploadSupport() )
222 {
223 if( $submittedElement->isImageUploadAvailable() )
224 {
225 $suffix = strtolower(array_pop(explode(".", $submittedElement->getUploadImageName())));
226 if( in_array($suffix, array("jpg", "jpeg", "png", "gif")) )
227 {
228 $submittedElement->setUploadImageName( $this->object->buildHashedImageFilename(
229 $submittedElement->getUploadImageName(), true
230 ));
231
232 $wasImageFileStored = $this->object->storeImageFile(
233 $submittedElement->getUploadImageFile(), $submittedElement->getUploadImageName()
234 );
235
236 if( $wasImageFileStored )
237 {
238 if( $this->object->isImageFileStored( $submittedElement->getContent() ) )
239 {
240 $this->object->dropImageFile( $submittedElement->getContent() );
241 }
242
243 $submittedElement->setContent( $submittedElement->getUploadImageName() );
244 }
245 }
246 }
247 }
248
249 if( $currentElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier()) )
250 {
251 $storedElement = $currentElementList->getElementByRandomIdentifier(
252 $submittedElement->getRandomIdentifier()
253 );
254
255 $submittedElement->setSolutionIdentifier($storedElement->getSolutionIdentifier());
256
257 if( $this->isAdjustmentEditContext() || $this->object->isOrderingTypeNested() )
258 {
259 $submittedElement->setContent($storedElement->getContent());
260 }
261
262 if( !$this->object->isOrderingTypeNested() )
263 {
264 $submittedElement->setIndentation($storedElement->getIndentation());
265 }
266
267 if( $this->object->isImageReplaced($submittedElement, $storedElement) )
268 {
269 $this->object->dropImageFile($storedElement->getContent());
270 }
271 }
272
273 $replacementElementList->addElement($submittedElement);
274 }
275
276 if( $this->object->isImageOrderingType() )
277 {
278 $this->object->handleThumbnailCreation($replacementElementList);
279 }
280
282 {
283 $replacementElementList->clearElementContents();
284 }
285
286 if( $this->object->hasOrderingTypeUploadSupport() )
287 {
288 $obsoleteElementList = $currentElementList->getDifferenceElementList($replacementElementList);
289
290 foreach($obsoleteElementList as $obsoleteElement)
291 {
292 $this->object->dropImageFile($obsoleteElement->getContent());
293 }
294 }
295
296 $this->object->setOrderingElementList($replacementElementList);
297 }
298
300 {
302 $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
303 $form->addItem($header);
304
305 if( $this->isAdjustmentEditContext() )
306 {
307 $orderingElementInput = $this->object->buildNestedOrderingElementInputGui();
308 }
309 else
310 {
311 $orderingElementInput = $this->object->buildOrderingElementInputGui();
312 }
313
314 $orderingElementInput->setStylingDisabled($this->isRenderPurposePrintPdf());
315 $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
316
317 $orderingElementInput->setElementList( $this->object->getOrderingElementList() );
318
319 $form->addItem($orderingElementInput);
320
321 return $form;
322 }
323
325 {
326 if (!$this->object->getSelfAssessmentEditingMode())
327 {
328 $element_height = new ilNumberInputGUI($this->lng->txt( "element_height" ), "element_height");
329 $element_height->setValue( $this->object->getElementHeight() );
330 $element_height->setRequired( false );
331 $element_height->setMaxLength( 6 );
332 $element_height->setMinValue( 20 );
333 $element_height->setSize( 6 );
334 $element_height->setInfo( $this->lng->txt( "element_height_info" ) );
335 $form->addItem( $element_height );
336 }
337
338 if( $this->object->isImageOrderingType() )
339 {
340 $geometry = new ilNumberInputGUI($this->lng->txt( "thumb_geometry" ), "thumb_geometry");
341 $geometry->setValue( $this->object->getThumbGeometry() );
342 $geometry->setRequired( true );
343 $geometry->setMaxLength( 6 );
344 $geometry->setMinValue( 20 );
345 $geometry->setSize( 6 );
346 $geometry->setInfo( $this->lng->txt( "thumb_geometry_info" ) );
347 $form->addItem( $geometry );
348 }
349
350 // points
351 $points = new ilNumberInputGUI($this->lng->txt( "points" ), "points");
352 $points->allowDecimals( true );
353 $points->setValue( $this->object->getPoints() );
354 $points->setRequired( TRUE );
355 $points->setSize( 3 );
356 $points->setMinValue( 0 );
357 $points->setMinvalueShouldBeGreater( true );
358 $form->addItem( $points );
359
360 return $form;
361 }
362
366 protected function writePostData($forceSaving = false)
367 {
368 $savingAllowed = true; // assume saving allowed first
369
370 if( !$forceSaving )
371 {
372 // this case seems to be a regular save call, so we consider
373 // the validation result for the decision of saving as well
374
375 // inits {this->editForm} and performs validation
376 $form = $this->buildEditForm();
377 $form->setValuesByPost(); // manipulation and distribution of values
378
379 if( !$form->checkInput() ) // manipulations regular style input propeties
380 {
381 $form->prepareValuesReprintable($this->object);
382 $this->renderEditForm($form);
383
384 // consequence of vaidation
385 $savingAllowed = false;
386 }
387 }
388 elseif( !$this->isSaveCommand() )
389 {
390 // this case handles form workflow actions like the mode/view switching requests,
391 // so saving must not be skipped, even for inputs invalid by business rules
392
393 $form = $this->buildEditForm();
394 $form->setValuesByPost(); // manipulation and distribution of values
395 $form->checkInput(); // manipulations regular style input propeties
396 }
397
398 if( $savingAllowed )
399 {
400 $this->persistAuthoringForm($form);
401
402 return 0; // return 0 = all fine, was saved either forced or validated
403 }
404
405 return 1; // return 1 = something went wrong, no saving happened
406 }
407
411 public function editQuestion($checkonly = FALSE)
412 {
413 $this->renderEditForm( $this->buildEditForm() );
414 }
415
419 protected function buildEditForm()
420 {
421 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingQuestionAuthoringFormGUI.php';
423 $this->editForm = $form;
424
425 $form->setFormAction($this->ctrl->getFormAction($this));
426 $form->setTitle($this->outQuestionType());
427 $form->setMultipart(( $this->object->getOrderingType() == OQ_PICTURES ) ? TRUE : FALSE);
428 $form->setTableWidth("100%");
429 $form->setId("ordering");
430 // title, author, description, question, working time (assessment mode)
431 $this->addBasicQuestionFormProperties($form);
433 $this->populateAnswerSpecificFormPart($form);
434
435 $this->populateTaxonomyFormSection($form);
436
437 $form->addSpecificOrderingQuestionCommandButtons($this->object);
438 $form->addGenericAssessmentQuestionCommandButtons($this->object);
439
440 return $form;
441 }
442
459 $active_id,
460 $pass = NULL,
461 $graphicalOutput = FALSE,
462 $result_output = FALSE,
463 $show_question_only = TRUE,
464 $show_feedback = FALSE,
465 $forceCorrectSolution = FALSE,
466 $show_manual_scoring = FALSE,
467 $show_question_text = TRUE
468 )
469 {
470 $solutionOrderingList = $this->object->getOrderingElementListForSolutionOutput(
471 $forceCorrectSolution, $active_id, $pass
472 );
473
474 $answers_gui = $this->object->buildNestedOrderingElementInputGui();
475
476 if( $forceCorrectSolution )
477 {
479 }
480 else
481 {
483 }
484
485 $answers_gui->setInteractionEnabled(false);
486
487 $answers_gui->setElementList( $solutionOrderingList );
488
489 $answers_gui->setCorrectnessTrueElementList(
490 $solutionOrderingList->getParityTrueElementList($this->object->getOrderingElementList())
491 );
492
493 $solution_html = $answers_gui->getHTML();
494
495 $template = new ilTemplate("tpl.il_as_qpl_nested_ordering_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
496 $template->setVariable('SOLUTION_OUTPUT', $solution_html);
497 if ($show_question_text==true)
498 {
499 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
500 }
501 $questionoutput = $template->get();
502
503 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
504 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
505
506 if($show_feedback)
507 {
508 $feedback = '';
509
510 if( !$this->isTestPresentationContext() )
511 {
512 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
513 $feedback .= strlen($fb) ? $fb : '';
514 }
515
516 $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
517 $feedback .= strlen($fb) ? $fb : '';
518
519 if (strlen($feedback))
520 {
521 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
523 );
524
525 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
526 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
527 }
528 }
529
530 if( $show_question_only )
531 {
532 return $solutiontemplate->get();
533 }
534
535 return $this->getILIASPage( $solutiontemplate->get() );
536
537 // is this template still in use? it is not used at this point any longer!
538 // $template = new ilTemplate("tpl.il_as_qpl_ordering_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
539 }
540
541 function getPreview($show_question_only = FALSE, $showInlineFeedback = false)
542 {
543 if( $this->getPreviewSession() && $this->getPreviewSession()->hasParticipantSolution() )
544 {
545 $solutionOrderingElementList = unserialize(
546 $this->getPreviewSession()->getParticipantsSolution()
547 );
548 }
549 else
550 {
551 $solutionOrderingElementList = $this->object->getShuffledOrderingElementList();
552 }
553
554 $answers = $this->object->buildNestedOrderingElementInputGui();
555 $answers->setNestingEnabled($this->object->isOrderingTypeNested());
557 $answers->setInteractionEnabled($this->isInteractivePresentation());
558 $answers->setElementList($solutionOrderingElementList);
559
560 $template = new ilTemplate("tpl.il_as_qpl_ordering_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
561
562 $template->setCurrentBlock('nested_ordering_output');
563 $template->setVariable('NESTED_ORDERING', $answers->getHTML());
564 $template->parseCurrentBlock();
565
566 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
567
568 if( $show_question_only )
569 {
570 return $template->get();
571 }
572
573 return $this->getILIASPage($template->get());
574
575 //$this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/ordering.js");
576 }
577
578 // hey: prevPassSolutions - pass will be always available from now on
579 public function getTestOutput($activeId, $pass, $isPostponed = FALSE, $userSolutionPost = FALSE, $inlineFeedback = false)
580 // hey.
581 {
582 $userSolutionPost = is_array($userSolutionPost) ? $userSolutionPost : array();
583
584 $orderingGUI = $this->object->buildNestedOrderingElementInputGui();
585 $orderingGUI->setNestingEnabled($this->object->isOrderingTypeNested());
586
587 $solutionOrderingElementList = $this->object->getSolutionOrderingElementListForTestOutput(
588 $orderingGUI, $userSolutionPost, $activeId, $pass
589 );
590
591 $template = new ilTemplate('tpl.il_as_qpl_ordering_output.html', TRUE, TRUE, 'Modules/TestQuestionPool');
592
594 $orderingGUI->setElementList( $solutionOrderingElementList );
595
596 $template->setCurrentBlock('nested_ordering_output');
597 $template->setVariable('NESTED_ORDERING',$orderingGUI->getHTML());
598 $template->parseCurrentBlock();
599
600 $template->setVariable('QUESTIONTEXT', $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
601
602 $pageoutput = $this->outQuestionPage('', $isPostponed, $activeId, $template->get());
603
604 return $pageoutput;
605 }
606
607 protected function isInteractivePresentation()
608 {
609 if( $this->isRenderPurposePlayback() )
610 {
611 return true;
612 }
613
614 if( $this->isRenderPurposeDemoplay() )
615 {
616 return true;
617 }
618
619 return false;
620 }
621
630 {
631 global $rbacsystem, $ilTabs;
632
633 $ilTabs->clearTargets();
634
635 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
636 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
637 $q_type = $this->object->getQuestionType();
638
639 if (strlen($q_type))
640 {
641 $classname = $q_type . "GUI";
642 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
643 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
644 }
645
646 if ($_GET["q_id"])
647 {
648 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
649 {
650 // edit page
651 $ilTabs->addTarget("edit_page",
652 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
653 array("edit", "insert", "exec_pg"),
654 "", "", false);
655 }
656
657 $this->addTab_QuestionPreview($ilTabs);
658 }
659
660 $force_active = false;
661 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
662 {
663 $url = "";
664 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
665 $commands = $_POST["cmd"];
666 if (is_array($commands))
667 {
668 foreach ($commands as $key => $value)
669 {
670 if (preg_match("/^delete_.*/", $key, $matches))
671 {
672 $force_active = true;
673 }
674 }
675 }
676 // edit question properties
677 $ilTabs->addTarget("edit_question",
678 $url,
679 array("orderNestedTerms","orderNestedPictures","editQuestion", "save", "saveEdit", "addanswers", "removeanswers", "changeToPictures", "uploadElementImage", "changeToText", "upanswers", "downanswers", "originalSyncForm"),
680 $classname, "", $force_active);
681 }
682
683 // add tab for question feedback within common class assQuestionGUI
684 $this->addTab_QuestionFeedback($ilTabs);
685
686 // add tab for question hint within common class assQuestionGUI
687 $this->addTab_QuestionHints($ilTabs);
688
689 // add tab for question's suggested solution within common class assQuestionGUI
690 $this->addTab_SuggestedSolution($ilTabs, $classname);
691
692 // Assessment of questions sub menu entry
693 if ($_GET["q_id"])
694 {
695 $ilTabs->addTarget("statistics",
696 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
697 array("assessment"),
698 $classname, "");
699 }
700
701 $this->addBackTab($ilTabs);
702 }
703
704 function getSpecificFeedbackOutput($active_id, $pass)
705 {
706 if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists($this->object->getOrderingElementList()) )
707 {
708 return '';
709 }
710
711 $tpl = new ilTemplate('tpl.il_as_qpl_ordering_elem_fb.html', true, true, 'Modules/TestQuestionPool');
712
713 foreach( $this->object->getOrderingElementList() as $element)
714 {
715 $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
716 $this->object->getId(), $element->getPosition()
717 );
718
719 if( $this->object->isImageOrderingType() )
720 {
721 $imgSrc = $this->object->getImagePathWeb().$element->getContent();
722 $tpl->setCurrentBlock('image');
723 $tpl->setVariable('IMG_SRC', $imgSrc);
724 }
725 else
726 {
727 $tpl->setCurrentBlock('text');
728 }
729 $tpl->setVariable('CONTENT', $element->getContent());
730 $tpl->parseCurrentBlock();
731
732 $tpl->setCurrentBlock('element');
733 $tpl->setVariable('FEEDBACK', $feedback);
734 $tpl->parseCurrentBlock();
735 }
736
737 return $this->object->prepareTextareaOutput($tpl->get(), TRUE);
738 }
739
744 protected function persistAuthoringForm($form)
745 {
747 $this->writeQuestionSpecificPostData($form);
748 $this->writeAnswerSpecificPostData($form);
750 }
751
752 private function getOldLeveledOrdering()
753 {
754 global $ilDB;
755
756 $res = $ilDB->queryF('SELECT depth FROM qpl_a_ordering WHERE question_fi = %s ORDER BY solution_key ASC',
757 array('integer'), array($this->object->getId()));
758 while($row = $ilDB->fetchAssoc($res))
759 {
760 $this->old_ordering_depth[] = $row['depth'];
761 }
763 }
764
775 {
776 return array();
777 }
778
789 {
790 return array();
791 }
792
801 public function getAggregatedAnswersView($relevant_answers)
802 {
803 $aggView = $this->aggregateAnswers(
804 $relevant_answers, $this->object->getOrderingElementList()
805 );
806
807 return $this->renderAggregateView($aggView)->get();
808 }
809
810 public function aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)
811 {
812 $passdata = array(); // Regroup answers into units of passes.
813 foreach($relevant_answers_chosen as $answer_chosen)
814 {
815 $passdata[$answer_chosen['active_fi'].'-'. $answer_chosen['pass']][$answer_chosen['value2']] = $answer_chosen['value1'];
816 }
817
818 $variants = array(); // Determine unique variants.
819 foreach($passdata as $key => $data)
820 {
821 $hash = md5(implode('-', $data));
822 $value_set = false;
823 foreach ($variants as $vkey => $variant)
824 {
825 if ($variant['hash'] == $hash)
826 {
827 $variant['count']++;
828 $value_set = true;
829 }
830 }
831 if (!$value_set)
832 {
833 $variants[$key]['hash'] = $hash;
834 $variants[$key]['count'] = 1;
835 }
836 }
837
838 $aggregate = array(); // Render aggregate from variant.
839 foreach ($variants as $key => $variant_entry)
840 {
841 $variant = $passdata[$key];
842
843 foreach($variant as $variant_key => $variant_line)
844 {
845 $i = 0;
846 $aggregated_info_for_answer['count'] = $variant_entry['count'];
847 foreach ($answers_defined_on_question as $element)
848 {
849 $i++;
850
851 if($this->object->isImageOrderingType())
852 {
853 $element->setImageThumbnailPrefix($this->object->getThumbPrefix());
854 $element->setImagePathWeb($this->object->getImagePathWeb());
855 $element->setImagePathFs($this->object->getImagePath());
856
857 $src = $element->getPresentationImageUrl();
858 $alt = $element->getContent();
859 $content = "<img src='{$src}' alt='{$alt}' title='{$alt}'/>";
860 }
861 else
862 {
863 $content = $element->getContent();
864 }
865
866 $aggregated_info_for_answer[$i . ' - ' . $content]
867 = $passdata[$key][$i];
868 }
869
870 }
871 $aggregate[] = $aggregated_info_for_answer;
872 }
873 return $aggregate;
874 }
875
881 public function renderAggregateView($aggregate)
882 {
883 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
884
885 foreach ($aggregate as $line_data)
886 {
887 $tpl->setCurrentBlock( 'aggregaterow' );
888 $count = array_shift($line_data);
889 $html = '<ul>';
890 foreach($line_data as $key => $line)
891 {
892 $html .= '<li>'. ++$line .'&nbsp;-&nbsp;' .$key. '</li>';
893 }
894 $html .= '</ul>';
895 $tpl->setVariable( 'COUNT', $count );
896 $tpl->setVariable( 'OPTION', $html );
897
898 $tpl->parseCurrentBlock();
899 }
900 return $tpl;
901 }
902}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Ordering question GUI representation.
setQuestionTabs()
Sets the ILIAS tabs for this question type.
__construct($id=-1)
assOrderingQuestionGUI constructor
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
Adds the answer specific form parts to a question property form gui.
getSolutionOutput( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $forceCorrectSolution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
Get the question solution output.
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
setClearAnswersOnWritingPostDataEnabled($clearAnswersOnWritingPostDataEnabled)
getTestOutput($activeId, $pass, $isPostponed=FALSE, $userSolutionPost=FALSE, $inlineFeedback=false)
writePostData($forceSaving=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
Class for ordering questions.
Basic GUI class for assessment questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
getILIASPage($html="")
Returns the ILIAS Page around a question.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
addBackTab(ilTabsGUI $ilTabs)
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
static buildInstance($questionId, $orderingElements=array())
This class represents a section header in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
special template class to simplify handling of ITX/PEAR
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$html
Definition: example_001.php:87
$header
const OQ_NESTED_PICTURES
const OQ_TERMS
const OQ_NESTED_TERMS
const OQ_PICTURES
Ordering question constants.
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.
$url
Definition: shib_logout.php:72
global $ilDB