ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
assOrderingQuestionGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assOrderingQuestionGUI:
+ Collaboration diagram for assOrderingQuestionGUI:

Public Member Functions

 __construct ($id=-1)
 assOrderingQuestionGUI constructor More...
 
 changeToPictures ()
 
 changeToText ()
 
 saveNesting ()
 
 removeElementImage ()
 
 uploadElementImage ()
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 editQuestion ($checkonly=false)
 
 editNesting ()
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 Get the question solution output. More...
 
 renderSolutionOutput (mixed $user_solutions, int $active_id, ?int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getPresentationJavascripts ()
 
 getTestOutput ($activeId, $pass, $isPostponed=false, $userSolutionPost=false, $inlineFeedback=false)
 
 getSpecificFeedbackOutput (array $userSolution)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView (array $relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 aggregateAnswers ($relevant_answers_chosen, $answers_defined_on_question)
 
 renderAggregateView ($aggregate)
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 hasInlineFeedback ()
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 geCommentsPanelHTML ()
 
 executeCommand ()
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext (string $presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled (bool $previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose (string $renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext (string $editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI (?ilTestQuestionNavigationGUI $navigationGUI)
 
 setTaxonomyIds (array $taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder (\ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd (string $questionActionCmd)
 
 getQuestionActionCmd ()
 
 assessment ()
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 
 getILIASPage (string $html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 
 cancel ()
 
 originalSyncForm (string $return_to="", string $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 
 save ()
 
 saveReturn ()
 
 apply ()
 
 getContextPath ($cont_obj, int $a_endnode_id, int $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber (int $nr)
 
 getSequenceNumber ()
 
 setQuestionCount (int $a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage (string $errormessage)
 
 addErrorMessage (string $errormessage)
 
 outAdditionalOutput ()
 Why are you here? Some magic for plugins? More...
 
 getQuestionType ()
 
 getAsValueAttribute (string $a_value)
 
 addNewIdListener ($a_object, string $a_method, string $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners (int $a_new_id)
 
 addQuestionFormCommandButtons (ilPropertyFormGUI $form)
 
 addBasicQuestionFormProperties (ilPropertyFormGUI $form)
 
 getGenericFeedbackOutput (int $active_id, ?int $pass)
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 suggestedsolution ()
 
 outSolutionExplorer ()
 
 saveSuggestedSolutionType ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, string $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 renderSolutionOutput (mixed $user_solutions, int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest (string $formaction, int $active_id, ?int $pass, bool $is_question_postponed=false, $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFrequencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 isInLearningModuleContext ()
 
 setInLearningModuleContext (bool $flag)
 
 getAutoSavedSolutionOutput (int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 

Data Fields

const CMD_EDIT_NESTING = 'editNesting'
 
const CMD_SAVE_NESTING = 'saveNesting'
 
const CMD_SWITCH_TO_TERMS = 'changeToText'
 
const CMD_SWITCH_TO_PICTURESS = 'changeToPictures'
 
const TAB_EDIT_QUESTION = 'edit_question'
 
const TAB_EDIT_NESTING = 'edit_nesting'
 
const F_USE_NESTED = 'nested_answers'
 
const F_NESTED_ORDER = 'order_elems'
 
const F_NESTED_ORDER_ORDER = 'content'
 
const F_NESTED_ORDER_INDENT = 'indentation'
 
const F_NESTED_IDENTIFIER_PREFIX = ilIdentifiedMultiValuesJsPositionIndexRemover::IDENTIFIER_INDICATOR_PREFIX
 
assQuestion $object
 
 $old_ordering_depth = []
 
 $leveled_ordering = []
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const CORRECTNESS_NOT_OK = 0
 
const CORRECTNESS_MOSTLY_OK = 1
 
const CORRECTNESS_OK = 2
 
const ALLOWED_PLAIN_TEXT_TAGS = "<em>, <strong>"
 sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI. More...
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
assQuestion $object
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
 $error
 
string $errormessage
 
int $sequence_no
 sequence number in test More...
 
int $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 

Protected Member Functions

 fetchSolutionListFromSubmittedForm (ilPropertyFormGUI $form)
 
 updateImageFiles ()
 
 writePostData (bool $always=false)
 {} More...
 
 addEditSubtabs ($active=self::TAB_EDIT_QUESTION)
 
 buildEditForm ()
 
 buildNestingForm ()
 
 isInteractivePresentation ()
 
 getTabs ()
 
 getAnswerStatisticOrderingElementHtml (ilAssOrderingElement $element)
 
 getAnswerStatisticOrderingVariantHtml (ilAssOrderingElementList $list)
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 writePostData (bool $always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm (ilPropertyFormGUI $form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 addNumberOfTriesToFormIfNecessary (ilPropertyFormGUI $form)
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 genericFeedbackOutputBuilder (string $feedback_correct, string $feedback_incorrect, int $active_id, ?int $pass)
 
 getTypeOptions ()
 
 createSuggestedSolutionLinkingTo (string $type, string $target)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 
 addTab_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 generateCorrectnessIconsForCorrectness (int $correctness)
 
 getSuggestedSolutionsRepo ()
 
 cleanupAnswerText (array $answer_text, bool $is_rte)
 sk - 12.05.2023: This is one more of those that we need, but don't want. More...
 
 addSaveOnEnterOnLoadCode ()
 

Private Member Functions

 buildEditFormAfterTypeChange (array $values)
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI (string $question_type='', int $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants (string $guiClassName, string $cmdConstantNameBegin='CMD_')
 
static prepareTextareaOutput (?string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output where latex code may be in it If the text is HTML-free, CHR(13) will be converted to a line break. More...
 
- Protected Attributes inherited from assQuestionGUI
const SUGGESTED_SOLUTION_COMMANDS_CANCEL = 'cancelSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_SAVE = 'saveSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_DEFAULT = 'suggestedsolution'
 
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
ilLogger $logger
 
ILIAS TestQuestionPool QuestionInfoService $questioninfo
 
ILIAS Notes GUIService $notes_gui
 
ilCtrl $ctrl
 
Refinery $refinery
 
ilPropertyFormGUI $editForm
 
ILIAS TestQuestionPool InternalRequestService $request
 
bool $parent_type_is_lm = false
 
assQuestionSuggestedSolutionsDatabaseRepository $suggestedsolution_repo = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Ordering question GUI representation

The assOrderingQuestionGUI class encapsulates the GUI representation for ordering questions.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Nils Haagen nils..nosp@m.haag.nosp@m.en@co.nosp@m.ncep.nosp@m.ts-an.nosp@m.d-tr.nosp@m.ainin.nosp@m.g.de
Version
$Id$

assOrderingQuestionGUI: ilFormPropertyDispatchGUI

Definition at line 36 of file class.assOrderingQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assOrderingQuestionGUI::__construct (   $id = -1)

assOrderingQuestionGUI constructor

The constructor takes possible arguments an creates an instance of the assOrderingQuestionGUI object.

Parameters
integer$idThe database id of a ordering question object

Definition at line 64 of file class.assOrderingQuestionGUI.php.

References $id, and ILIAS\MetaData\Repository\Validation\Data\__construct().

65  {
67  $this->object = new assOrderingQuestion();
68  if ($id >= 0) {
69  $this->object->loadFromDb($id);
70  }
71  }
__construct(VocabulariesInterface $vocabularies)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Member Function Documentation

◆ addEditSubtabs()

assOrderingQuestionGUI::addEditSubtabs (   $active = self::TAB_EDIT_QUESTION)
protected

Definition at line 340 of file class.assOrderingQuestionGUI.php.

References ILIAS\Repository\ctrl(), getTabs(), assQuestionGUI\isInLearningModuleContext(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by buildEditFormAfterTypeChange(), editNesting(), editQuestion(), and writePostData().

341  {
342  $tabs = $this->getTabs();
343  $tabs->addSubTab(
344  self::TAB_EDIT_QUESTION,
345  $this->lng->txt('edit_question'),
346  $this->ctrl->getLinkTarget($this, 'editQuestion')
347  );
348  if ($this->object->isOrderingTypeNested() && !$this->isInLearningModuleContext()) {
349  $tabs->addSubTab(
350  self::TAB_EDIT_NESTING,
351  $this->lng->txt('tab_nest_answers'),
352  $this->ctrl->getLinkTarget($this, self::CMD_EDIT_NESTING)
353  );
354  }
355  $tabs->setTabActive('edit_question');
356  $tabs->setSubTabActive($active);
357  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ aggregateAnswers()

assOrderingQuestionGUI::aggregateAnswers (   $relevant_answers_chosen,
  $answers_defined_on_question 
)

Definition at line 700 of file class.assOrderingQuestionGUI.php.

References $data, ILIAS\LTI\ToolProvider\$key, and ILIAS\Repository\object().

Referenced by getAggregatedAnswersView().

700  : array
701  {
702  $passdata = []; // Regroup answers into units of passes.
703  foreach ($relevant_answers_chosen as $answer_chosen) {
704  $passdata[$answer_chosen['active_fi'] . '-' . $answer_chosen['pass']][$answer_chosen['value2']] = $answer_chosen['value1'];
705  }
706 
707  $variants = []; // Determine unique variants.
708  foreach ($passdata as $key => $data) {
709  $hash = md5(implode('-', $data));
710  $value_set = false;
711  foreach ($variants as $vkey => $variant) {
712  if ($variant['hash'] == $hash) {
713  $variant['count']++;
714  $value_set = true;
715  }
716  }
717  if (!$value_set) {
718  $variants[$key]['hash'] = $hash;
719  $variants[$key]['count'] = 1;
720  }
721  }
722 
723  $aggregate = []; // Render aggregate from variant.
724  foreach ($variants as $key => $variant_entry) {
725  $variant = $passdata[$key];
726 
727  foreach ($variant as $variant_key => $variant_line) {
728  $i = 0;
729  $aggregated_info_for_answer['count'] = $variant_entry['count'];
730  foreach ($answers_defined_on_question as $element) {
731  $i++;
732 
733  if ($this->object->isImageOrderingType()) {
734  $element->setImageThumbnailPrefix($this->object->getThumbPrefix());
735  $element->setImagePathWeb($this->object->getImagePathWeb());
736  $element->setImagePathFs($this->object->getImagePath());
737 
738  $src = $element->getPresentationImageUrl();
739  $alt = $element->getContent();
740  $content = "<img src='{$src}' alt='{$alt}' title='{$alt}'/>";
741  } else {
742  $content = $element->getContent();
743  }
744 
745  $aggregated_info_for_answer[$i . ' - ' . $content]
746  = $passdata[$key][$i];
747  }
748  }
749  $aggregate[] = $aggregated_info_for_answer;
750  }
751  return $aggregate;
752  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildEditForm()

assOrderingQuestionGUI::buildEditForm ( )
protected

Definition at line 373 of file class.assOrderingQuestionGUI.php.

References assQuestionGUI\addBasicQuestionFormProperties(), ILIAS\Repository\ctrl(), ILIAS\Repository\object(), assQuestionGUI\outQuestionType(), populateAnswerSpecificFormPart(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by buildEditFormAfterTypeChange(), editQuestion(), uploadElementImage(), and writePostData().

374  {
376  $form->setFormAction($this->ctrl->getFormAction($this));
377  $form->setTitle($this->outQuestionType());
378  $form->setMultipart($this->object->isImageOrderingType());
379  $form->setTableWidth("100%");
380  $form->setId("ordering");
381 
382  $this->addBasicQuestionFormProperties($form);
383  $this->populateQuestionSpecificFormPart($form);
384  $this->populateAnswerSpecificFormPart($form);
385  $this->populateTaxonomyFormSection($form);
386 
387  $form->addSpecificOrderingQuestionCommandButtons($this->object);
388  $form->addGenericAssessmentQuestionCommandButtons($this->object);
389 
390  return $form;
391  }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
Adds the answer specific form parts to a question property form gui.
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildEditFormAfterTypeChange()

assOrderingQuestionGUI::buildEditFormAfterTypeChange ( array  $values)
private

Definition at line 96 of file class.assOrderingQuestionGUI.php.

References addEditSubtabs(), buildEditForm(), assOrderingQuestion\ORDERING_ELEMENT_FORM_FIELD_POSTVAR, and assQuestionGUI\renderEditForm().

Referenced by changeToPictures(), and changeToText().

96  : void
97  {
98  $form = $this->buildEditForm();
99 
100  $ordering_element_list = $this->object->getOrderingElementList();
101  $ordering_element_list->resetElements();
102 
104  $form->setValuesByArray($values);
105  $form->getItemByPostVar(assOrderingQuestion::ORDERING_ELEMENT_FORM_FIELD_POSTVAR)->setElementList($ordering_element_list);
106  $this->renderEditForm($form);
107  $this->addEditSubtabs();
108  }
addEditSubtabs($active=self::TAB_EDIT_QUESTION)
renderEditForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildNestingForm()

assOrderingQuestionGUI::buildNestingForm ( )
protected

Definition at line 393 of file class.assOrderingQuestionGUI.php.

References ILIAS\Repository\ctrl(), assQuestionGUI\isRenderPurposePrintPdf(), ILIAS\Repository\lng(), and assQuestionGUI\outQuestionType().

Referenced by editNesting(), and saveNesting().

394  {
396  $form->setFormAction($this->ctrl->getFormAction($this));
397  $form->setTitle($this->outQuestionType());
398  $form->setTableWidth("100%");
399 
400  $header = new ilFormSectionHeaderGUI();
401  $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
402  $form->addItem($header);
403 
404  $orderingElementInput = $this->object->buildNestedOrderingElementInputGui();
405  $orderingElementInput->setStylingDisabled($this->isRenderPurposePrintPdf());
406 
407  $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
408 
409  $list = $this->object->getOrderingElementList();
410  foreach ($list->getElements() as $element) {
411  $element = $list->ensureValidIdentifiers($element);
412  }
413 
414  $orderingElementInput->setElementList($list);
415 
416  $form->addItem($orderingElementInput);
417  $form->addCommandButton(self::CMD_SAVE_NESTING, $this->lng->txt("save"));
418  return $form;
419  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeToPictures()

assOrderingQuestionGUI::changeToPictures ( )

Definition at line 73 of file class.assOrderingQuestionGUI.php.

References buildEditFormAfterTypeChange().

73  : void
74  {
75  $this->object->setContentType($this->object::OQ_CT_PICTURES);
76  $this->object->saveToDb();
77 
78  $values = $this->request->getParsedBody();
79  $values['thumb_geometry'] = $this->object->getThumbSize();
80  $this->buildEditFormAfterTypeChange($values);
81  }
+ Here is the call graph for this function:

◆ changeToText()

assOrderingQuestionGUI::changeToText ( )

Definition at line 83 of file class.assOrderingQuestionGUI.php.

References buildEditFormAfterTypeChange().

83  : void
84  {
85  $ordering_element_list = $this->object->getOrderingElementList();
86  foreach ($ordering_element_list as $element) {
87  $this->object->dropImageFile($element->getContent());
88  }
89 
90  $this->object->setContentType($this->object::OQ_CT_TERMS);
91  $this->object->saveToDb();
92 
93  $this->buildEditFormAfterTypeChange($this->request->getParsedBody());
94  }
+ Here is the call graph for this function:

◆ editNesting()

assOrderingQuestionGUI::editNesting ( )

Definition at line 365 of file class.assOrderingQuestionGUI.php.

References addEditSubtabs(), buildNestingForm(), ilObjStyleSheet\getContentStylePath(), ilObjStyleSheet\getSyntaxStylePath(), and assQuestionGUI\renderEditForm().

Referenced by saveNesting().

366  {
367  $this->renderEditForm($this->buildNestingForm());
368  $this->addEditSubtabs(self::TAB_EDIT_NESTING);
369  $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
370  $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
371  }
addEditSubtabs($active=self::TAB_EDIT_QUESTION)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
renderEditForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editQuestion()

assOrderingQuestionGUI::editQuestion (   $checkonly = false)

Definition at line 359 of file class.assOrderingQuestionGUI.php.

References addEditSubtabs(), buildEditForm(), and assQuestionGUI\renderEditForm().

Referenced by uploadElementImage().

359  : void
360  {
361  $this->renderEditForm($this->buildEditForm());
362  $this->addEditSubtabs(self::TAB_EDIT_QUESTION);
363  }
addEditSubtabs($active=self::TAB_EDIT_QUESTION)
renderEditForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchSolutionListFromSubmittedForm()

assOrderingQuestionGUI::fetchSolutionListFromSubmittedForm ( ilPropertyFormGUI  $form)
protected

Definition at line 201 of file class.assOrderingQuestionGUI.php.

References ilPropertyFormGUI\getItemByPostVar(), ILIAS\Repository\object(), and assOrderingQuestion\ORDERING_ELEMENT_FORM_FIELD_POSTVAR.

Referenced by saveCorrectionsFormProperties(), uploadElementImage(), and writeAnswerSpecificPostData().

202  {
204  ->getElementList($this->object->getId());
205 
206  $use_nested = $this->request->raw(self::F_USE_NESTED) === "1";
207 
208  if ($use_nested) {
209  $existing_list = $this->object->getOrderingElementList();
210 
211  $nu = [];
212  $parent_indent = -1;
213  foreach ($list->getElements() as $element) {
214  $element = $list->ensureValidIdentifiers($element);
215 
216  if ($existing = $existing_list->getElementByRandomIdentifier($element->getRandomIdentifier())) {
217  if ($existing->getIndentation() == $parent_indent + 1) {
218  $element = $element
219  ->withIndentation($existing->getIndentation());
220  }
221  }
222  $parent_indent = $element->getIndentation();
223  $nu[] = $element;
224  }
225  $list = $list->withElements($nu);
226  }
227 
228  return $list;
229  }
getItemByPostVar(string $a_post_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionAnswerPostVars()

assOrderingQuestionGUI::getAfterParticipationSuppressionAnswerPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiAnswerScoringAdjustable.

Definition at line 665 of file class.assOrderingQuestionGUI.php.

665  : array
666  {
667  return [];
668  }

◆ getAfterParticipationSuppressionQuestionPostVars()

assOrderingQuestionGUI::getAfterParticipationSuppressionQuestionPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiQuestionScoringAdjustable.

Definition at line 679 of file class.assOrderingQuestionGUI.php.

679  : array
680  {
681  return [];
682  }

◆ getAggregatedAnswersView()

assOrderingQuestionGUI::getAggregatedAnswersView ( array  $relevant_answers)

Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface.

Parameters
array$relevant_answers
Returns
string

Implements ilGuiQuestionScoringAdjustable.

Definition at line 690 of file class.assOrderingQuestionGUI.php.

References aggregateAnswers(), ILIAS\Repository\object(), and renderAggregateView().

690  : string
691  {
692  $aggView = $this->aggregateAnswers(
693  $relevant_answers,
694  $this->object->getOrderingElementList()
695  );
696 
697  return $this->renderAggregateView($aggView)->get();
698  }
aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)
+ Here is the call graph for this function:

◆ getAnswersFrequency()

assOrderingQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Definition at line 831 of file class.assOrderingQuestionGUI.php.

References ILIAS\LTI\ToolProvider\$key, and getAnswerStatisticOrderingVariantHtml().

831  : array
832  {
833  $answersByActiveAndPass = [];
834 
835  foreach ($relevantAnswers as $row) {
836  $key = $row['active_fi'] . ':' . $row['pass'];
837 
838  if (!isset($answersByActiveAndPass[$key])) {
839  $answersByActiveAndPass[$key] = [];
840  }
841 
842  $answersByActiveAndPass[$key][$row['value1']] = $row['value2'];
843  }
844 
845  $solutionLists = [];
846 
847  foreach ($answersByActiveAndPass as $indexedSolutions) {
848  $solutionLists[] = $this->object->getSolutionOrderingElementList($indexedSolutions);
849  }
850 
851  /* @var ilAssOrderingElementList[] $answers */
852  $answers = [];
853 
854  foreach ($solutionLists as $orderingElementList) {
855  $hash = $orderingElementList->getHash();
856 
857  if (!isset($answers[$hash])) {
858  $variantHtml = $this->getAnswerStatisticOrderingVariantHtml(
859  $orderingElementList
860  );
861 
862  $answers[$hash] = array(
863  'answer' => $variantHtml, 'frequency' => 0
864  );
865  }
866 
867  $answers[$hash]['frequency']++;
868  }
869 
870  return array_values($answers);
871  }
getAnswerStatisticOrderingVariantHtml(ilAssOrderingElementList $list)
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

◆ getAnswerStatisticOrderingElementHtml()

assOrderingQuestionGUI::getAnswerStatisticOrderingElementHtml ( ilAssOrderingElement  $element)
protected

Definition at line 779 of file class.assOrderingQuestionGUI.php.

References ilAssOrderingElement\getContent(), ilAssOrderingElement\getPresentationImageUrl(), ILIAS\Repository\object(), ilAssOrderingElement\setImagePathFs(), ilAssOrderingElement\setImagePathWeb(), and ilAssOrderingElement\setImageThumbnailPrefix().

Referenced by getAnswerStatisticOrderingVariantHtml().

779  : ?string
780  {
781  if ($this->object->isImageOrderingType()) {
782  $element->setImageThumbnailPrefix($this->object->getThumbPrefix());
783  $element->setImagePathWeb($this->object->getImagePathWeb());
784  $element->setImagePathFs($this->object->getImagePath());
785 
786  $src = $element->getPresentationImageUrl();
787  $alt = $element->getContent();
788  $content = "<img src='{$src}' alt='{$alt}' title='{$alt}'/>";
789  } else {
790  $content = $element->getContent();
791  }
792 
793  return $content;
794  }
setImageThumbnailPrefix($imageThumbnailPrefix)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAnswerStatisticOrderingVariantHtml()

assOrderingQuestionGUI::getAnswerStatisticOrderingVariantHtml ( ilAssOrderingElementList  $list)
protected

Definition at line 796 of file class.assOrderingQuestionGUI.php.

References getAnswerStatisticOrderingElementHtml().

Referenced by getAnswersFrequency().

796  : string
797  {
798  $html = '<ul>';
799 
800  $lastIndent = 0;
801  $firstElem = true;
802 
803  foreach ($list as $elem) {
804  if ($elem->getIndentation() > $lastIndent) {
805  $html .= '<ul><li>';
806  } elseif ($elem->getIndentation() < $lastIndent) {
807  $html .= '</li></ul><li>';
808  } elseif (!$firstElem) {
809  $html .= '</li><li>';
810  } else {
811  $html .= '<li>';
812  }
813 
814  $html .= $this->getAnswerStatisticOrderingElementHtml($elem);
815 
816  $firstElem = false;
817  $lastIndent = $elem->getIndentation();
818  }
819 
820  $html .= '</li>';
821 
822  for ($i = $lastIndent; $i > 0; $i--) {
823  $html .= '</ul></li>';
824  }
825 
826  $html .= '</ul>';
827 
828  return $html;
829  }
getAnswerStatisticOrderingElementHtml(ilAssOrderingElement $element)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPresentationJavascripts()

assOrderingQuestionGUI::getPresentationJavascripts ( )

Definition at line 585 of file class.assOrderingQuestionGUI.php.

References $DIC.

585  : array
586  {
587  global $DIC; /* @var ILIAS\DI\Container $DIC */
588 
589  $files = [];
590 
591  if ($DIC->http()->agent()->isMobile() || $DIC->http()->agent()->isIpad()) {
592  $files[] = './node_modules/@andxor/jquery-ui-touch-punch-fix/jquery.ui.touch-punch.js';
593  }
594 
595  return $files;
596  }
global $DIC
Definition: feed.php:28

◆ getPreview()

assOrderingQuestionGUI::getPreview (   $show_question_only = false,
  $showInlineFeedback = false 
)

Definition at line 554 of file class.assOrderingQuestionGUI.php.

References ilAssNestedOrderingElementsInputGUI\CONTEXT_QUESTION_PREVIEW, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), isInteractivePresentation(), and ILIAS\Repository\object().

554  : string
555  {
556  if ($this->getPreviewSession() && $this->getPreviewSession()->hasParticipantSolution()) {
557  $solutionOrderingElementList = unserialize(
558  $this->getPreviewSession()->getParticipantsSolution(),
559  ["allowed_classes" => true]
560  );
561  } else {
562  $solutionOrderingElementList = $this->object->getShuffledOrderingElementList();
563  }
564 
565  $answers = $this->object->buildNestedOrderingElementInputGui();
566  $answers->setNestingEnabled($this->object->isOrderingTypeNested());
568  $answers->setInteractionEnabled($this->isInteractivePresentation());
569  $answers->setElementList($solutionOrderingElementList);
570 
571  $template = new ilTemplate("tpl.il_as_qpl_ordering_output.html", true, true, "Modules/TestQuestionPool");
572 
573  $template->setCurrentBlock('nested_ordering_output');
574  $template->setVariable('NESTED_ORDERING', $answers->getHTML());
575  $template->parseCurrentBlock();
576  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
577 
578  if ($show_question_only) {
579  return $template->get();
580  }
581 
582  return $this->getILIASPage($template->get());
583  }
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
+ Here is the call graph for this function:

◆ getSolutionOutput()

assOrderingQuestionGUI::getSolutionOutput (   $active_id,
  $pass = null,
  $graphicalOutput = false,
  $result_output = false,
  $show_question_only = true,
  $show_feedback = false,
  $show_correct_solution = false,
  $show_manual_scoring = false,
  $show_question_text = true 
)

Get the question solution output.

Parameters
integer$active_idThe active user id
integer$passThe test pass
boolean$graphicalOutputShow visual feedback for right/wrong answers
boolean$result_outputShow the reached points for parts of the question
boolean$show_question_onlyShow the question without the ILIAS content around
boolean$show_feedbackShow the question feedback
boolean$show_correct_solutionShow the correct solution instead of the user solution
boolean$show_manual_scoringShow specific information for the manual scoring output
bool$show_question_text
Returns
string The solution output of the question as HTML code

Definition at line 445 of file class.assOrderingQuestionGUI.php.

References renderSolutionOutput().

455  : string {
456  $solutionOrderingList = $this->object->getOrderingElementListForSolutionOutput(
457  $show_correct_solution,
458  $active_id,
459  $pass
460  );
461 
462  $show_inline_feedback = false;
463  return $this->renderSolutionOutput(
464  $solutionOrderingList,
465  $active_id,
466  $pass,
467  $graphicalOutput,
468  $result_output,
469  $show_question_only,
470  $show_feedback,
471  $show_correct_solution,
472  $show_manual_scoring,
473  $show_question_text,
474  false,
475  $show_inline_feedback,
476  );
477  }
renderSolutionOutput(mixed $user_solutions, int $active_id, ?int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assOrderingQuestionGUI::getSpecificFeedbackOutput ( array  $userSolution)

Definition at line 651 of file class.assOrderingQuestionGUI.php.

651  : string
652  {
653  return '';
654  }

◆ getTabs()

assOrderingQuestionGUI::getTabs ( )
protected

Definition at line 645 of file class.assOrderingQuestionGUI.php.

References $DIC.

Referenced by addEditSubtabs().

645  : ilTabsGUI
646  {
647  global $DIC;
648  return $DIC['ilTabs'];
649  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getTestOutput()

assOrderingQuestionGUI::getTestOutput (   $activeId,
  $pass,
  $isPostponed = false,
  $userSolutionPost = false,
  $inlineFeedback = false 
)

Definition at line 599 of file class.assOrderingQuestionGUI.php.

References ilAssNestedOrderingElementsInputGUI\CONTEXT_USER_SOLUTION_SUBMISSION, ILIAS\Repository\object(), and assQuestionGUI\outQuestionPage().

599  : string
600  // hey.
601  {
602  // hey: prevPassSolutions - fixed variable type, makes phpstorm stop crying
603  $userSolutionPost = is_array($userSolutionPost) ? $userSolutionPost : [];
604  // hey.
605 
606  $orderingGUI = $this->object->buildNestedOrderingElementInputGui();
607  $orderingGUI->setNestingEnabled($this->object->isOrderingTypeNested());
608 
609  $solutionOrderingElementList = $this->object->getSolutionOrderingElementListForTestOutput(
610  $orderingGUI,
611  $userSolutionPost,
612  $activeId,
613  $pass
614  );
615 
616  $template = new ilTemplate('tpl.il_as_qpl_ordering_output.html', true, true, 'Modules/TestQuestionPool');
617 
619  $orderingGUI->setElementList($solutionOrderingElementList);
620 
621  $template->setCurrentBlock('nested_ordering_output');
622  $template->setVariable('NESTED_ORDERING', $orderingGUI->getHTML());
623  $template->parseCurrentBlock();
624 
625  $template->setVariable('QUESTIONTEXT', $this->object->getQuestionForHTMLOutput());
626 
627  $pageoutput = $this->outQuestionPage('', $isPostponed, $activeId, $template->get());
628 
629  return $pageoutput;
630  }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
+ Here is the call graph for this function:

◆ isInteractivePresentation()

assOrderingQuestionGUI::isInteractivePresentation ( )
protected

Definition at line 632 of file class.assOrderingQuestionGUI.php.

References assQuestionGUI\isRenderPurposeDemoplay(), and assQuestionGUI\isRenderPurposePlayback().

Referenced by getPreview().

632  : bool
633  {
634  if ($this->isRenderPurposePlayback()) {
635  return true;
636  }
637 
638  if ($this->isRenderPurposeDemoplay()) {
639  return true;
640  }
641 
642  return false;
643  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateAnswerSpecificFormPart()

assOrderingQuestionGUI::populateAnswerSpecificFormPart ( ilPropertyFormGUI  $form)

Adds the answer specific form parts to a question property form gui.

Implements ilGuiAnswerScoringAdjustable.

Definition at line 257 of file class.assOrderingQuestionGUI.php.

References ilPropertyFormGUI\addItem(), assQuestionGUI\isRenderPurposePrintPdf(), and ILIAS\Repository\lng().

Referenced by buildEditForm().

258  {
259  $header = new ilFormSectionHeaderGUI();
260  $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
261  $form->addItem($header);
262 
263  $orderingElementInput = $this->object->buildOrderingElementInputGui();
264  $orderingElementInput->setStylingDisabled($this->isRenderPurposePrintPdf());
265  $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
266 
267  $list = $this->object->getOrderingElementList();
268  $orderingElementInput->setElementList($list);
269  $form->addItem($orderingElementInput);
270 
271  return $form;
272  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

assOrderingQuestionGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Definition at line 885 of file class.assOrderingQuestionGUI.php.

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

885  : void
886  {
887  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
888  $points->allowDecimals(true);
889  $points->setValue($this->object->getPoints());
890  $points->setRequired(true);
891  $points->setSize(3);
892  $points->setMinValue(0);
893  $points->setMinvalueShouldBeGreater(true);
894  $form->addItem($points);
895 
896  $header = new ilFormSectionHeaderGUI();
897  $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
898  $form->addItem($header);
899 
900  $orderingElementInput = $this->object->buildNestedOrderingElementInputGui();
901 
902  $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
903 
904  $orderingElementInput->setElementList($this->object->getOrderingElementList());
905 
906  $form->addItem($orderingElementInput);
907  }
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 274 of file class.assOrderingQuestionGUI.php.

References ilPropertyFormGUI\addItem(), assQuestionGUI\isInLearningModuleContext(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilSelectInputGUI\setOptions().

Referenced by buildEditForm().

275  {
276  if ($this->object->isImageOrderingType()) {
277  $thumb_size = new ilNumberInputGUI($this->lng->txt('thumb_size'), 'thumb_geometry');
278  $thumb_size->setValue($this->object->getThumbSize());
279  $thumb_size->setRequired(true);
280  $thumb_size->setMaxLength(6);
281  $thumb_size->setMinValue($this->object->getMinimumThumbSize());
282  $thumb_size->setMaxValue($this->object->getMaximumThumbSize());
283  $thumb_size->setSize(6);
284  $thumb_size->setInfo($this->lng->txt('thumb_size_info'));
285  $form->addItem($thumb_size);
286  }
287 
288  // points
289  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
290  $points->allowDecimals(true);
291  $points->setValue($this->object->getPoints());
292  $points->setRequired(true);
293  $points->setSize(3);
294  $points->setMinValue(0);
295  $points->setMinvalueShouldBeGreater(true);
296  $form->addItem($points);
297 
298  if (!$this->isInLearningModuleContext()) {
299  $nested_answers = new ilSelectInputGUI(
300  $this->lng->txt('qst_use_nested_answers'),
301  self::F_USE_NESTED
302  );
303  $nested_answers_options = [
304  0 => $this->lng->txt('qst_nested_nested_answers_off'),
305  1 => $this->lng->txt('qst_nested_nested_answers_on')
306  ];
307  $nested_answers->setOptions($nested_answers_options);
308  $nested_answers->setValue($this->object->isOrderingTypeNested());
309  $form->addItem($nested_answers);
310  }
311 
312  return $form;
313  }
This class represents a selection list property in a property form.
setOptions(array $a_options)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareReprintableCorrectionsForm()

assOrderingQuestionGUI::prepareReprintableCorrectionsForm ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Definition at line 876 of file class.assOrderingQuestionGUI.php.

References ilPropertyFormGUI\getItemByPostVar(), and assOrderingQuestion\ORDERING_ELEMENT_FORM_FIELD_POSTVAR.

876  : void
877  {
879  $orderingInput->prepareReprintable($this->object);
880  }
getItemByPostVar(string $a_post_var)
+ Here is the call graph for this function:

◆ removeElementImage()

assOrderingQuestionGUI::removeElementImage ( )

Definition at line 139 of file class.assOrderingQuestionGUI.php.

References uploadElementImage().

140  {
141  $this->uploadElementImage();
142  }
+ Here is the call graph for this function:

◆ renderAggregateView()

assOrderingQuestionGUI::renderAggregateView (   $aggregate)
Parameters
$aggregate
Returns
ilTemplate

Definition at line 759 of file class.assOrderingQuestionGUI.php.

References ILIAS\LTI\ToolProvider\$key, assQuestionGUI\$tpl, ilGlobalPageTemplate\parseCurrentBlock(), ilGlobalPageTemplate\setCurrentBlock(), and ilGlobalPageTemplate\setVariable().

Referenced by getAggregatedAnswersView().

759  : ilTemplate
760  {
761  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
762 
763  foreach ($aggregate as $line_data) {
764  $tpl->setCurrentBlock('aggregaterow');
765  $count = array_shift($line_data);
766  $html = '<ul>';
767  foreach ($line_data as $key => $line) {
768  $html .= '<li>' . ++$line . '&nbsp;-&nbsp;' . $key . '</li>';
769  }
770  $html .= '</ul>';
771  $tpl->setVariable('COUNT', $count);
772  $tpl->setVariable('OPTION', $html);
773 
775  }
776  return $tpl;
777  }
setCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Sets the template to the given block.
parseCurrentBlock(string $blockname=self::DEFAULT_BLOCK)
Parses the given block.
ilGlobalPageTemplate $tpl
string $key
Consumer key/client ID value.
Definition: System.php:193
setVariable(string $variable, $value='')
Sets the given variable to the given value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSolutionOutput()

assOrderingQuestionGUI::renderSolutionOutput ( mixed  $user_solutions,
int  $active_id,
?int  $pass,
bool  $graphical_output = false,
bool  $result_output = false,
bool  $show_question_only = true,
bool  $show_feedback = false,
bool  $show_correct_solution = false,
bool  $show_manual_scoring = false,
bool  $show_question_text = true,
bool  $show_autosave_title = false,
bool  $show_inline_feedback = false 
)

Definition at line 479 of file class.assOrderingQuestionGUI.php.

References ilAssNestedOrderingElementsInputGUI\CONTEXT_CORRECT_SOLUTION_PRESENTATION, ilAssNestedOrderingElementsInputGUI\CONTEXT_USER_SOLUTION_PRESENTATION, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

Referenced by getSolutionOutput().

492  : ?string {
493  $solutionOrderingList = ($user_solutions instanceof ilAssOrderingElementList) ?
494  $user_solutions : $this->object->getSolutionOrderingElementList(
495  $this->object->fetchIndexedValuesFromValuePairs($user_solutions)
496  );
497  $answers_gui = $this->object->buildNestedOrderingElementInputGui();
498 
499  if ($show_correct_solution) {
501  } else {
503  }
504 
505  $answers_gui->setInteractionEnabled(false);
506  $answers_gui->setElementList($solutionOrderingList);
507  if ($graphical_output) {
508  $answers_gui->setShowCorrectnessIconsEnabled(true);
509  }
510  $answers_gui->setCorrectnessTrueElementList(
511  $solutionOrderingList->getParityTrueElementList($this->object->getOrderingElementList())
512  );
513  $solution_html = $answers_gui->getHTML();
514 
515  $template = new ilTemplate("tpl.il_as_qpl_nested_ordering_output_solution.html", true, true, "Modules/TestQuestionPool");
516  $template->setVariable('SOLUTION_OUTPUT', $solution_html);
517  if ($show_question_text == true) {
518  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
519  }
520  $questionoutput = $template->get();
521 
522  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
523  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
524 
525  if ($show_feedback) {
526  $feedback = '';
527 
528  if (!$this->isTestPresentationContext()) {
529  $fb = $this->getGenericFeedbackOutput((int) $active_id, $pass);
530  $feedback .= strlen($fb) ? $fb : '';
531  }
532 
533  if (strlen($feedback)) {
534  $cssClass = (
535  $this->hasCorrectSolution($active_id, $pass) ?
537  );
538 
539  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
540  $solutiontemplate->setVariable("FEEDBACK", ilLegacyFormElementsUtil::prepareTextareaOutput($feedback, true));
541  }
542  }
543 
544  if ($show_question_only) {
545  return $solutiontemplate->get();
546  }
547 
548  return $this->getILIASPage($solutiontemplate->get());
549 
550  // is this template still in use? it is not used at this point any longer!
551  // $template = new ilTemplate("tpl.il_as_qpl_ordering_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
552  }
hasCorrectSolution($activeId, $passIndex)
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
getGenericFeedbackOutput(int $active_id, ?int $pass)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

assOrderingQuestionGUI::saveCorrectionsFormProperties ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Definition at line 912 of file class.assOrderingQuestionGUI.php.

References fetchSolutionListFromSubmittedForm(), ilPropertyFormGUI\getInput(), and ILIAS\Repository\object().

912  : void
913  {
914  $this->object->setPoints((float) str_replace(',', '.', $form->getInput('points')));
915 
916  $submittedElementList = $this->fetchSolutionListFromSubmittedForm($form);
917 
918  $curElementList = $this->object->getOrderingElementList();
919 
920  $newElementList = new ilAssOrderingElementList();
921  $newElementList->setQuestionId($this->object->getId());
922 
923  foreach ($submittedElementList as $submittedElement) {
924  if (!$curElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier())) {
925  continue;
926  }
927 
928  $curElement = $curElementList->getElementByRandomIdentifier($submittedElement->getRandomIdentifier());
929 
930  $curElement->setPosition($submittedElement->getPosition());
931 
932  if ($this->object->isOrderingTypeNested()) {
933  $curElement->setIndentation($submittedElement->getIndentation());
934  }
935 
936  $newElementList->addElement($curElement);
937  }
938 
939  $this->object->setOrderingElementList($newElementList);
940  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
fetchSolutionListFromSubmittedForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ saveNesting()

assOrderingQuestionGUI::saveNesting ( )

Definition at line 110 of file class.assOrderingQuestionGUI.php.

References $post, buildNestingForm(), editNesting(), and ILIAS\Repository\lng().

111  {
112  $form = $this->buildNestingForm();
113  $form->setValuesByPost();
114  if ($form->checkInput()) {
115  $post = $this->request->raw(self::F_NESTED_ORDER);
116  $list = $this->object->getOrderingElementList();
117 
118  $ordered = [];
119  foreach (array_keys($post[self::F_NESTED_ORDER_ORDER]) as $idx => $identifier) {
120  $element_identifier = str_replace(self::F_NESTED_IDENTIFIER_PREFIX, '', $identifier);
121  $element = $list->getElementByRandomIdentifier($element_identifier);
122 
123  $ordered[] = $element
124  ->withPosition($idx)
125  ->withIndentation($post[self::F_NESTED_ORDER_INDENT][$identifier]);
126  }
127 
128  $list = $list->withElements($ordered);
129  $this->object->setOrderingElementList($list);
130  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
131  } else {
132  $this->tpl->setOnScreenMessage('error', $this->lng->txt('form_input_not_valid'), true);
133  }
134 
135  $this->editNesting();
136  }
$post
Definition: ltitoken.php:49
+ Here is the call graph for this function:

◆ supportsIntermediateSolutionOutput()

assOrderingQuestionGUI::supportsIntermediateSolutionOutput ( )

Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution()

Returns
bool

Definition at line 427 of file class.assOrderingQuestionGUI.php.

428  {
429  return true;
430  }

◆ updateImageFiles()

assOrderingQuestionGUI::updateImageFiles ( )
protected

Definition at line 231 of file class.assOrderingQuestionGUI.php.

References $filename.

Referenced by writeQuestionSpecificPostData().

231  : void
232  {
233  $element_list = $this->object->getOrderingElementList();
234  $elements = [];
235  foreach ($element_list->getElements() as $element) {
236  if ($element->getContent() === '') {
237  continue;
238  }
239  $filename = $this->object->updateImageFile(
240  $element->getContent()
241  );
242 
243  $elements[] = $element->withContent($filename);
244  }
245 
246  $list = $this->object->getOrderingElementList()->withElements($elements);
247  $this->object->setOrderingElementList($list);
248  }
$filename
Definition: buildRTE.php:78
+ Here is the caller graph for this function:

◆ uploadElementImage()

assOrderingQuestionGUI::uploadElementImage ( )

Definition at line 144 of file class.assOrderingQuestionGUI.php.

References $filename, buildEditForm(), editQuestion(), fetchSolutionListFromSubmittedForm(), ILIAS\Repository\lng(), assQuestionGUI\writeQuestionGenericPostData(), and writeQuestionSpecificPostData().

Referenced by removeElementImage().

144  : void
145  {
146  $form = $this->buildEditForm();
147  $form->setValuesByPost();
148 
149  $submitted_list = $this->fetchSolutionListFromSubmittedForm($form);
150 
151  $elements = [];
152  foreach ($submitted_list->getElements() as $submitted_element) {
153  if ($submitted_element->isImageUploadAvailable()) {
154  $filename = $this->object->storeImageFile(
155  $submitted_element->getUploadImageFile(),
156  $submitted_element->getUploadImageName()
157  );
158 
159  if (is_null($filename)) {
160  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('file_no_valid_file_type'));
161  } else {
162  $submitted_element = $submitted_element->withContent($filename);
163  }
164  }
165 
166  if ($submitted_element->isImageRemovalRequest()) {
167  $this->object->dropImageFile($submitted_element->getContent());
168  $submitted_element = $submitted_element->withContent('');
169  }
170 
171  $elements[] = $submitted_element;
172  }
173 
174  $list = $this->object->getOrderingElementList()->withElements($elements);
175  $this->object->setOrderingElementList($list);
176 
178  $this->writeQuestionSpecificPostData($form);
179 
180  $this->editQuestion();
181  }
fetchSolutionListFromSubmittedForm(ilPropertyFormGUI $form)
$filename
Definition: buildRTE.php:78
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeAnswerSpecificPostData()

assOrderingQuestionGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the answer specific values from $_POST and applies them to the data object.

Implements ilGuiAnswerScoringAdjustable.

Definition at line 250 of file class.assOrderingQuestionGUI.php.

References fetchSolutionListFromSubmittedForm().

Referenced by writePostData().

250  : void
251  {
252  $list = $this->fetchSolutionListFromSubmittedForm($form);
253  $this->object->setOrderingElementList($list);
254  return;
255  }
fetchSolutionListFromSubmittedForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writePostData()

assOrderingQuestionGUI::writePostData ( bool  $always = false)
protected

{}

parent::save calls this->writePostData. afterwards, object->saveToDb is called.

Definition at line 321 of file class.assOrderingQuestionGUI.php.

References addEditSubtabs(), buildEditForm(), assQuestionGUI\renderEditForm(), assQuestionGUI\saveTaxonomyAssignments(), writeAnswerSpecificPostData(), assQuestionGUI\writeQuestionGenericPostData(), and writeQuestionSpecificPostData().

321  : int
322  {
323  $form = $this->buildEditForm();
324  $form->setValuesByPost();
325 
326  if (!$form->checkInput()) {
327  $this->renderEditForm($form);
328  $this->addEditSubtabs(self::TAB_EDIT_QUESTION);
329  return 1; // return 1 = something went wrong, no saving happened
330  }
331 
332  $this->saveTaxonomyAssignments();
334  $this->writeAnswerSpecificPostData($form);
335  $this->writeQuestionSpecificPostData($form);
336 
337  return 0; // return 0 = all fine, was saved either forced or validated
338  }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
addEditSubtabs($active=self::TAB_EDIT_QUESTION)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
renderEditForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assOrderingQuestionGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the question specific values from $_POST and applies them to the data object.

Implements ilGuiQuestionScoringAdjustable.

Definition at line 183 of file class.assOrderingQuestionGUI.php.

References ILIAS\Repository\object(), and updateImageFiles().

Referenced by uploadElementImage(), and writePostData().

183  : void
184  {
185  $thumb_size = $this->request->int('thumb_geometry');
186  if ($thumb_size !== 0
187  && $thumb_size !== $this->object->getThumbSize()) {
188  $this->object->setThumbSize($thumb_size);
189  $this->updateImageFiles();
190  }
191 
192  $points = (float) str_replace(',', '.', $this->request->raw('points'));
193 
194  $this->object->setPoints($points);
195 
196  $use_nested = $this->request->raw(self::F_USE_NESTED) === '1';
197  $this->object->setNestingType($use_nested);
198  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $leveled_ordering

assOrderingQuestionGUI::$leveled_ordering = []

Definition at line 55 of file class.assOrderingQuestionGUI.php.

◆ $object

assQuestion assOrderingQuestionGUI::$object

Definition at line 52 of file class.assOrderingQuestionGUI.php.

◆ $old_ordering_depth

assOrderingQuestionGUI::$old_ordering_depth = []

Definition at line 54 of file class.assOrderingQuestionGUI.php.

◆ CMD_EDIT_NESTING

const assOrderingQuestionGUI::CMD_EDIT_NESTING = 'editNesting'

Definition at line 38 of file class.assOrderingQuestionGUI.php.

◆ CMD_SAVE_NESTING

const assOrderingQuestionGUI::CMD_SAVE_NESTING = 'saveNesting'

Definition at line 39 of file class.assOrderingQuestionGUI.php.

◆ CMD_SWITCH_TO_PICTURESS

◆ CMD_SWITCH_TO_TERMS

◆ F_NESTED_IDENTIFIER_PREFIX

◆ F_NESTED_ORDER

const assOrderingQuestionGUI::F_NESTED_ORDER = 'order_elems'

Definition at line 47 of file class.assOrderingQuestionGUI.php.

◆ F_NESTED_ORDER_INDENT

const assOrderingQuestionGUI::F_NESTED_ORDER_INDENT = 'indentation'

Definition at line 49 of file class.assOrderingQuestionGUI.php.

◆ F_NESTED_ORDER_ORDER

const assOrderingQuestionGUI::F_NESTED_ORDER_ORDER = 'content'

Definition at line 48 of file class.assOrderingQuestionGUI.php.

◆ F_USE_NESTED

const assOrderingQuestionGUI::F_USE_NESTED = 'nested_answers'

Definition at line 46 of file class.assOrderingQuestionGUI.php.

◆ TAB_EDIT_NESTING

const assOrderingQuestionGUI::TAB_EDIT_NESTING = 'edit_nesting'

Definition at line 44 of file class.assOrderingQuestionGUI.php.

◆ TAB_EDIT_QUESTION

const assOrderingQuestionGUI::TAB_EDIT_QUESTION = 'edit_question'

Definition at line 43 of file class.assOrderingQuestionGUI.php.


The documentation for this class was generated from the following file: