ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 the request and applies them to the data object. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from the request 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 (bool $checkonly=false, ?bool $is_save_cmd=null)
 
 editNesting ()
 
 supportsIntermediateSolutionOutput ()
 
 getSolutionOutput (int $active_id, ?int $pass=null, 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_inline_feedback=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,)
 
 getPreview (bool $show_question_only=false, bool $show_inline_feedback=false)
 
 getTestOutput (int $active_id, int $pass, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 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...
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 editQuestion (bool $checkonly=false, ?bool $is_save_cmd=null)
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 getSolutionOutput (int $active_id, ?int $pass=null, 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_inline_feedback=true)
 
 getPreview (bool $show_question_only=false, bool $show_inline_feedback=false)
 
 getTestOutput (int $active_id, int $pass, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 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,)
 
 getObject ()
 
 setObject (assQuestion $question)
 
 setCopyToExistingPoolOnSave (?int $pool_ref_id)
 
 getCopyToExistingPoolOnSave ()
 
 setCopyToNewPoolOnSave (?string $pool_title)
 
 getCopyToNewPoolOnSave ()
 
 setMoveAfterQuestionId (?int $question_id)
 
 getMoveAfterQuestionId ()
 
 hasInlineFeedback ()
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getCommentsPanelHTML ()
 
 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 (string $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)
 
 syncQuestion ()
 
 saveReturn ()
 
 saveQuestion ()
 
 setAdditionalContentEditingModeFromPost ()
 
 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)
 
 getQuestionType ()
 
 getAsValueAttribute (string $a_value)
 
 addQuestionFormCommandButtons (ilPropertyFormGUI $form)
 
 addBasicQuestionFormProperties (ilPropertyFormGUI $form)
 
 getGenericFeedbackOutput (int $active_id, ?int $pass)
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 outQuestionType ()
 
 saveSuggestedSolution ()
 
 cancelSuggestedSolution ()
 
 suggestedsolution (bool $save=false)
 
 outSolutionExplorer ()
 
 saveSuggestedSolutionType ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, string $classname)
 
 getEditQuestionTabCommands ()
 
 isAutosaveable ()
 
 outQuestionForTest (string $formaction, int $active_id, ?int $pass, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getFormEncodingType ()
 
 setPreviewSession (ilAssQuestionPreviewSession $preview_session)
 
 getPreviewSession ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFrequencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 isInLearningModuleContext ()
 
 setInLearningModuleContext (bool $flag)
 
 cmdNeedsExistingQuestion (string $cmd)
 
 setContextAllowsSyncToPool (bool $sync_allowed)
 
 needsSyncQuery ()
 
 getQuestionSyncModal (string $cmd, string $cmd_class='')
 
 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)
 
 buildFileDownloadLink ()
 
 supportsAdjustment ()
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from the request and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from the request and applies them to the data object. More...
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. 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 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'
 
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 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'
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const CMD_SYNC_QUESTION_AND_RETURN = 'syncQuestionReturn'
 

Protected Member Functions

 fetchSolutionListFromSubmittedForm (ilPropertyFormGUI $form)
 
 updateImageFiles ()
 
 writePostData (bool $always=false)
 Evaluates a posted edit form and writes the form data in the question object. 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 ()
 
 setTestSpecificProperties ()
 
 addNumberOfTriesToFormIfNecessary (ilPropertyFormGUI $form)
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 genericFeedbackOutputBuilder (int $active_id, ?int $pass)
 
 getTypeOptions ()
 
 createSuggestedSolutionLinkingTo (string $type, string $target)
 
 setDefaultTabs (ilTabsGUI $tabs_gui)
 
 setQuestionSpecificTabs (ilTabsGUI $tabs_gui)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 
 addTab_Question (ilTabsGUI $tabs_gui)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction (string $form_action, int $active_id, int $pass)
 
 addBackTab (ilTabsGUI $tabs_gui)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 generateCorrectnessIconsForCorrectness (int $correctness)
 
 renderLatex ($content)
 Wrap content with latex in a LatexContent UI component and render it to be processed by MathJax in the browser. More...
 
 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 ()
 
 resetSavedPreviewSession ()
 

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 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 HAS_SPECIAL_QUESTION_COMMANDS = false
 
const SUGGESTED_SOLUTION_COMMANDS_CANCEL = 'cancelSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_SAVE = 'saveSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_DEFAULT = 'suggestedsolution'
 
const QUESTION_SAVE_CMDS
 
const ADDITIONAL_CMDS_NEEDING_EXISTING_QST
 There are functions that need an existing question. More...
 
UIServices $ui
 
ilLogger $logger
 
GeneralQuestionPropertiesRepository $questionrepository
 
GUIService $notes_gui
 
ilCtrl $ctrl
 
assQuestion $object
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
Refinery $refinery
 
 $error
 
string $errormessage
 
int $sequence_no
 sequence number in test More...
 
int $question_count
 question count in test More...
 
ilPropertyFormGUI $editForm = null
 
readonly ilTestLegacyFormsHelper $forms_helper
 
readonly RequestDataCollector $request_data_collector
 
bool $parent_type_is_lm = false
 
SuggestedSolutionsDatabaseRepository $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$

\ @ilCtrl_Calls assOrderingQuestionGUI: ilFormPropertyDispatchGUI

Definition at line 34 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 62 of file class.assOrderingQuestionGUI.php.

63 {
65 $this->object = new assOrderingQuestion();
66 if ($id >= 0) {
67 $this->object->loadFromDb($id);
68 }
69 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class for ordering questions.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $id, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ addEditSubtabs()

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

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

333 {
334 $tabs = $this->getTabs();
335 $tabs->addSubTab(
336 self::TAB_EDIT_QUESTION,
337 $this->lng->txt('edit_question'),
338 $this->ctrl->getLinkTarget($this, 'editQuestion')
339 );
340 if ($this->object->isOrderingTypeNested() && !$this->isInLearningModuleContext()) {
341 $tabs->addSubTab(
342 self::TAB_EDIT_NESTING,
343 $this->lng->txt('tab_nest_answers'),
344 $this->ctrl->getLinkTarget($this, self::CMD_EDIT_NESTING)
345 );
346 }
347 $tabs->setTabActive(self::TAB_EDIT_QUESTION);
348 $tabs->setSubTabActive($active);
349 }

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

Referenced by buildEditFormAfterTypeChange(), and writePostData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildEditForm()

assOrderingQuestionGUI::buildEditForm ( )
protected

Reimplemented from assQuestionGUI.

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

369 {
371 $form->setFormAction($this->ctrl->getFormAction($this));
372 $form->setTitle($this->outQuestionType());
373 $form->setMultipart($this->object->isImageOrderingType());
374 $form->setTableWidth("100%");
375 $form->setId("ordering");
376
377 $this->addBasicQuestionFormProperties($form);
379 $this->populateAnswerSpecificFormPart($form);
380 $this->populateTaxonomyFormSection($form);
381
382 $form->addSpecificOrderingQuestionCommandButtons($this->object);
383 $form->addGenericAssessmentQuestionCommandButtons($this->object);
384
385 return $form;
386 }
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
Adds the answer specific form parts to a question property form gui.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addBasicQuestionFormProperties(ilPropertyFormGUI $form)

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

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

+ 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 94 of file class.assOrderingQuestionGUI.php.

94 : void
95 {
96 $form = $this->buildEditForm();
97
98 $ordering_element_list = $this->object->getOrderingElementList();
99 $ordering_element_list->resetElements();
100
102 $form->setValuesByArray($values);
103 $form->getItemByPostVar(assOrderingQuestion::ORDERING_ELEMENT_FORM_FIELD_POSTVAR)->setElementList($ordering_element_list);
104 $this->renderEditForm($form);
105 $this->addEditSubtabs();
106 }
addEditSubtabs($active=self::TAB_EDIT_QUESTION)
renderEditForm(ilPropertyFormGUI $form)

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

Referenced by changeToPictures(), and changeToText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildNestingForm()

assOrderingQuestionGUI::buildNestingForm ( )
protected

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

389 {
391 $form->setFormAction($this->ctrl->getFormAction($this));
392 $form->setTitle($this->outQuestionType());
393 $form->setTableWidth("100%");
394
395 $header = new ilFormSectionHeaderGUI();
396 $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
397 $form->addItem($header);
398
399 $orderingElementInput = $this->object->buildNestedOrderingElementInputGui();
400
401 $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
402
403 $list = $this->object->getOrderingElementList();
404 foreach ($list->getElements() as $element) {
405 $element = $list->ensureValidIdentifiers($element);
406 }
407
408 $orderingElementInput->setElementList($list);
409
410 $form->addItem($orderingElementInput);
411 $form->addCommandButton(self::CMD_SAVE_NESTING, $this->lng->txt("save"));
412 return $form;
413 }
This class represents a section header in a property form.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by saveNesting().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeToPictures()

assOrderingQuestionGUI::changeToPictures ( )

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

71 : void
72 {
73 $this->object->setContentType($this->object::OQ_CT_PICTURES);
74 $this->object->saveToDb();
75
76 $values = $this->request_data_collector->getParsedBody();
77 $values['thumb_geometry'] = $this->object->getThumbSize();
78 $this->buildEditFormAfterTypeChange($values);
79 }

References buildEditFormAfterTypeChange().

+ Here is the call graph for this function:

◆ changeToText()

assOrderingQuestionGUI::changeToText ( )

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

81 : void
82 {
83 $ordering_element_list = $this->object->getOrderingElementList();
84 foreach ($ordering_element_list as $element) {
85 $this->object->dropImageFile($element->getContent());
86 }
87
88 $this->object->setContentType($this->object::OQ_CT_TERMS);
89 $this->object->saveToDb();
90
91 $this->buildEditFormAfterTypeChange($this->request_data_collector->getParsedBody());
92 }

References buildEditFormAfterTypeChange().

+ Here is the call graph for this function:

◆ editNesting()

assOrderingQuestionGUI::editNesting ( )

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

361 {
362 $this->renderEditForm($this->buildNestingForm());
363 $this->addEditSubtabs(self::TAB_EDIT_NESTING);
364 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
365 $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
366 }
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)

References ilObjStyleSheet\getContentStylePath(), and ilObjStyleSheet\getSyntaxStylePath().

Referenced by saveNesting().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editQuestion()

assOrderingQuestionGUI::editQuestion ( bool  $checkonly = false,
?bool  $is_save_cmd = null 
)

Reimplemented from assQuestionGUI.

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

354 : bool {
355 $this->renderEditForm($this->buildEditForm());
356 $this->addEditSubtabs(self::TAB_EDIT_QUESTION);
357 return false;
358 }

Referenced by uploadElementImage().

+ Here is the caller graph for this function:

◆ fetchSolutionListFromSubmittedForm()

assOrderingQuestionGUI::fetchSolutionListFromSubmittedForm ( ilPropertyFormGUI  $form)
protected

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

198 {
200 ->getElementList($this->object->getId());
201
202 $use_nested = $this->request_data_collector->int(self::F_USE_NESTED) === 1;
203
204 if ($use_nested) {
205 $existing_list = $this->object->getOrderingElementList();
206
207 $nu = [];
208 $parent_indent = -1;
209 foreach ($list->getElements() as $element) {
210 $element = $list->ensureValidIdentifiers($element);
211
212 if ($existing = $existing_list->getElementByRandomIdentifier($element->getRandomIdentifier())) {
213 if ($existing->getIndentation() == $parent_indent + 1) {
214 $element = $element
215 ->withIndentation($existing->getIndentation());
216 }
217 }
218 $parent_indent = $element->getIndentation();
219 $nu[] = $element;
220 }
221 $list = $list->withElements($nu);
222 }
223
224 return $list;
225 }
getItemByPostVar(string $a_post_var)

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

Referenced by uploadElementImage(), and writeAnswerSpecificPostData().

+ 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 632 of file class.assOrderingQuestionGUI.php.

632 : array
633 {
634 return [];
635 }

◆ 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 646 of file class.assOrderingQuestionGUI.php.

646 : array
647 {
648 return [];
649 }

◆ getAnswersFrequency()

assOrderingQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

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

681 : array
682 {
683 $answersByActiveAndPass = [];
684
685 foreach ($relevantAnswers as $row) {
686 $key = $row['active_fi'] . ':' . $row['pass'];
687
688 if (!isset($answersByActiveAndPass[$key])) {
689 $answersByActiveAndPass[$key] = [];
690 }
691
692 $answersByActiveAndPass[$key][$row['value1']] = $row['value2'];
693 }
694
695 $solutionLists = [];
696
697 foreach ($answersByActiveAndPass as $indexedSolutions) {
698 $solutionLists[] = $this->object->getSolutionOrderingElementList($indexedSolutions);
699 }
700
701 /* @var ilAssOrderingElementList[] $answers */
702 $answers = [];
703
704 foreach ($solutionLists as $orderingElementList) {
705 $hash = $orderingElementList->getHash();
706
707 if (!isset($answers[$hash])) {
708 $variantHtml = $this->getAnswerStatisticOrderingVariantHtml(
709 $orderingElementList
710 );
711
712 $answers[$hash] = [
713 'answer' => $variantHtml,
714 'frequency' => 0
715 ];
716 }
717
718 $answers[$hash]['frequency']++;
719 }
720
721 return array_values($answers);
722 }
getAnswerStatisticOrderingVariantHtml(ilAssOrderingElementList $list)

◆ getAnswerStatisticOrderingElementHtml()

assOrderingQuestionGUI::getAnswerStatisticOrderingElementHtml ( ilAssOrderingElement  $element)
protected

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

651 : ?string
652 {
653 if ($this->object->isImageOrderingType()) {
654 $element->setImageThumbnailPrefix($this->object->getThumbPrefix());
655 $element->setImagePathWeb($this->object->getImagePathWeb());
656 $element->setImagePathFs($this->object->getImagePath());
657
658 $src = $element->getPresentationImageUrl();
659 $alt = $element->getContent();
660 $content = "<img src='{$src}' alt='{$alt}' title='{$alt}'/>";
661 } else {
662 $content = $element->getContent();
663 }
664
665 return $content;
666 }
setImagePathFs(string $image_path_fs)
setImageThumbnailPrefix($imageThumbnailPrefix)

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

+ Here is the call graph for this function:

◆ getAnswerStatisticOrderingVariantHtml()

assOrderingQuestionGUI::getAnswerStatisticOrderingVariantHtml ( ilAssOrderingElementList  $list)
protected

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

668 : string
669 {
670 return $this->ui->renderer()->render(
671 $this->ui->factory()->listing()->unordered(
672 array_map(
673 fn(ilAssOrderingElement $elem): string
674 => $this->getAnswerStatisticOrderingElementHtml($elem) ?? '',
675 $list->getElements()
676 )
677 )
678 );
679 }
getAnswerStatisticOrderingElementHtml(ilAssOrderingElement $element)

References ilAssOrderingElementList\getElements(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ getPreview()

assOrderingQuestionGUI::getPreview ( bool  $show_question_only = false,
bool  $show_inline_feedback = false 
)

Reimplemented from assQuestionGUI.

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

534 : string {
535 if ($this->getPreviewSession() && $this->getPreviewSession()->hasParticipantSolution()) {
536 $solutionOrderingElementList = unserialize(
537 $this->getPreviewSession()->getParticipantsSolution(),
538 ['allowed_classes' => true]
539 );
540 } else {
541 $solutionOrderingElementList = $this->object->getShuffledOrderingElementList();
542 }
543
544 $answers = $this->object->buildNestedOrderingElementInputGui();
545 $answers->setNestingEnabled($this->object->isOrderingTypeNested());
547 $answers->setInteractionEnabled($this->isInteractivePresentation());
548 $answers->setElementList($solutionOrderingElementList);
549
550 $template = new ilTemplate('tpl.il_as_qpl_ordering_output.html', true, true, 'components/ILIAS/TestQuestionPool');
551
552 $template->setCurrentBlock('nested_ordering_output');
553 $template->setVariable('NESTED_ORDERING', $this->renderLatex($answers->getHTML()));
554 $template->parseCurrentBlock();
555 $template->setVariable('QUESTIONTEXT', $this->renderLatex($this->object->getQuestionForHTMLOutput()));
556
557 if ($show_question_only) {
558 return $template->get();
559 }
560
561 return $this->getILIASPage($template->get());
562 }
renderLatex($content)
Wrap content with latex in a LatexContent UI component and render it to be processed by MathJax in th...
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR

◆ getSolutionOutput()

assOrderingQuestionGUI::getSolutionOutput ( int  $active_id,
?int  $pass = null,
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_inline_feedback = true 
)

Reimplemented from assQuestionGUI.

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

431 : string {
432 $solution_ordering_list = $this->object->getOrderingElementListForSolutionOutput(
433 $show_correct_solution,
434 $active_id,
435 $pass
436 );
437
438 $show_inline_feedback = false;
439 return $this->renderSolutionOutput(
440 $solution_ordering_list,
441 $active_id,
442 $pass,
443 $graphical_output,
444 $result_output,
445 $show_question_only,
446 $show_feedback,
447 $show_correct_solution,
448 $show_manual_scoring,
449 $show_question_text,
450 false,
451 $show_inline_feedback,
452 );
453 }
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,)

◆ getSpecificFeedbackOutput()

assOrderingQuestionGUI::getSpecificFeedbackOutput ( array  $userSolution)

Returns the answer specific feedback for the question.

Parameters
array$userSolution($userSolution[<value1>] = <value2>)

Reimplemented from assQuestionGUI.

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

618 : string
619 {
620 return '';
621 }

◆ getTabs()

assOrderingQuestionGUI::getTabs ( )
protected

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

612 : ilTabsGUI
613 {
614 global $DIC;
615 return $DIC['ilTabs'];
616 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26

References $DIC.

Referenced by addEditSubtabs().

+ Here is the caller graph for this function:

◆ getTestOutput()

assOrderingQuestionGUI::getTestOutput ( int  $active_id,
int  $pass,
bool  $is_question_postponed = false,
array|bool  $user_post_solutions = false,
bool  $show_specific_inline_feedback = false 
)

Reimplemented from assQuestionGUI.

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

570 : string {
571 $user_post_solutions = is_array($user_post_solutions) ? $user_post_solutions : [];
572
573 $ordering_gui = $this->object->buildNestedOrderingElementInputGui();
574 $ordering_gui->setNestingEnabled($this->object->isOrderingTypeNested());
575
576 $solutionOrderingElementList = $this->object->getSolutionOrderingElementListForTestOutput(
577 $ordering_gui,
578 $user_post_solutions,
579 $active_id,
580 $pass
581 );
582
583 $template = new ilTemplate('tpl.il_as_qpl_ordering_output.html', true, true, 'components/ILIAS/TestQuestionPool');
584
586 $ordering_gui->setElementList($solutionOrderingElementList);
587
588 $template->setCurrentBlock('nested_ordering_output');
589 $template->setVariable('NESTED_ORDERING', $this->renderLatex($ordering_gui->getHTML()));
590 $template->parseCurrentBlock();
591
592 $template->setVariable('QUESTIONTEXT', $this->renderLatex($this->object->getQuestionForHTMLOutput()));
593
594 $pageoutput = $this->outQuestionPage('', $is_question_postponed, $active_id, $template->get());
595
596 return $pageoutput;
597 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)

◆ isInteractivePresentation()

assOrderingQuestionGUI::isInteractivePresentation ( )
protected

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

599 : bool
600 {
601 if ($this->isRenderPurposePlayback()) {
602 return true;
603 }
604
605 if ($this->isRenderPurposeDemoplay()) {
606 return true;
607 }
608
609 return false;
610 }

◆ populateAnswerSpecificFormPart()

assOrderingQuestionGUI::populateAnswerSpecificFormPart ( ilPropertyFormGUI  $form)

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

Implements ilGuiAnswerScoringAdjustable.

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

254 {
255 $header = new ilFormSectionHeaderGUI();
256 $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
257 $form->addItem($header);
258
259 $orderingElementInput = $this->object->buildOrderingElementInputGui();
260 $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
261
262 $list = $this->object->getOrderingElementList();
263 $orderingElementInput->setElementList($list);
264 $form->addItem($orderingElementInput);
265
266 return $form;
267 }
This class represents a property form user interface.

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

+ Here is the call graph for this function:

◆ populateCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

736 : void
737 {
738 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
739 $points->allowDecimals(true);
740 $points->setValue($this->object->getPoints());
741 $points->setRequired(true);
742 $points->setSize(3);
743 $points->setMinValue(0);
744 $points->setMinvalueShouldBeGreater(true);
745 $form->addItem($points);
746
747 $header = new ilFormSectionHeaderGUI();
748 $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
749 $form->addItem($header);
750
751 $orderingElementInput = $this->object->buildNestedOrderingElementInputGui();
752
753 $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
754
755 $orderingElementInput->setElementList($this->object->getOrderingElementList());
756
757 $form->addItem($orderingElementInput);
758 }
This class represents a number property in a property form.

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

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

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

+ Here is the call graph for this function:

◆ prepareReprintableCorrectionsForm()

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

Reimplemented from assQuestionGUI.

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

727 : void
728 {
730 $orderingInput->prepareReprintable($this->object);
731 }

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

+ Here is the call graph for this function:

◆ removeElementImage()

assOrderingQuestionGUI::removeElementImage ( )

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

References uploadElementImage().

+ Here is the call 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 
)

Reimplemented from assQuestionGUI.

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

468 : ?string {
469 $solution_ordering_list = ($user_solutions instanceof ilAssOrderingElementList) ?
470 $user_solutions : $this->object->getSolutionOrderingElementList(
471 $this->object->fetchIndexedValuesFromValuePairs($user_solutions)
472 );
473 $answers_gui = $this->object->buildNestedOrderingElementInputGui();
474
475 if ($show_correct_solution) {
477 } else {
479 }
480
481 $answers_gui->setInteractionEnabled(false);
482 $answers_gui->setElementList($solution_ordering_list);
483
484 if ($graphical_output) {
485 $answers_gui->setShowCorrectnessIconsEnabled(true);
486 }
487 $answers_gui->setCorrectnessTrueElementList(
488 $solution_ordering_list->getParityTrueElementList($this->object->getOrderingElementList())
489 );
490 $solution_html = $answers_gui->getHTML();
491
492 $template = new ilTemplate('tpl.il_as_qpl_nested_ordering_output_solution.html', true, true, 'components/ILIAS/TestQuestionPool');
493 $template->setVariable('SOLUTION_OUTPUT', $this->renderLatex($solution_html));
494 if ($show_question_text == true) {
495 $template->setVariable('QUESTIONTEXT', $this->renderLatex($this->object->getQuestionForHTMLOutput()));
496 }
497 $questionoutput = $template->get();
498
499 $solutiontemplate = new ilTemplate('tpl.il_as_tst_solution_output.html', true, true, 'components/ILIAS/TestQuestionPool');
500 $solutiontemplate->setVariable('SOLUTION_OUTPUT', $questionoutput);
501
502 if ($show_feedback) {
503 $feedback = '';
504
505 if (!$this->isTestPresentationContext()) {
506 $fb = $this->getGenericFeedbackOutput((int) $active_id, $pass);
507 $feedback .= strlen($fb) ? $fb : '';
508 }
509
510 if ($feedback !== '') {
511 $cssClass = (
512 $this->hasCorrectSolution($active_id, $pass) ?
514 );
515
516 $solutiontemplate->setVariable('ILC_FB_CSS_CLASS', $cssClass);
517 $solutiontemplate->setVariable('FEEDBACK', ilLegacyFormElementsUtil::prepareTextareaOutput($feedback, true));
518 }
519 }
520
521 if ($show_question_only) {
522 return $solutiontemplate->get();
523 }
524
525 return $this->getILIASPage($solutiontemplate->get());
526
527 // is this template still in use? it is not used at this point any longer!
528 // $template = new ilTemplate("tpl.il_as_qpl_ordering_output_solution.html", TRUE, TRUE, "components/ILIAS/TestQuestionPool");
529 }
getGenericFeedbackOutput(int $active_id, ?int $pass)
hasCorrectSolution($activeId, $passIndex)
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,...

References ilAssNestedOrderingElementsInputGUI\CONTEXT_CORRECT_SOLUTION_PRESENTATION.

◆ saveCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

763 : void
764 {
765 $this->object->setPoints((float) str_replace(',', '.', $form->getInput('points')));
766
767 $submittedElementList = $this->fetchSolutionListFromSubmittedForm($form);
768
769 $curElementList = $this->object->getOrderingElementList();
770
771 $newElementList = new ilAssOrderingElementList();
772 $newElementList->setQuestionId($this->object->getId());
773
774 foreach ($submittedElementList as $submittedElement) {
775 if (!$curElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier())) {
776 continue;
777 }
778
779 $curElement = $curElementList->getElementByRandomIdentifier($submittedElement->getRandomIdentifier());
780
781 $curElement->setPosition($submittedElement->getPosition());
782
783 if ($this->object->isOrderingTypeNested()) {
784 $curElement->setIndentation($submittedElement->getIndentation());
785 }
786
787 $newElementList->addElement($curElement);
788 }
789
790 $this->object->setOrderingElementList($newElementList);
791 }
fetchSolutionListFromSubmittedForm(ilPropertyFormGUI $form)
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-...

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

+ Here is the call graph for this function:

◆ saveNesting()

assOrderingQuestionGUI::saveNesting ( )

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

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

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

+ Here is the call graph for this function:

◆ supportsIntermediateSolutionOutput()

assOrderingQuestionGUI::supportsIntermediateSolutionOutput ( )

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

416 {
417 return true;
418 }

◆ updateImageFiles()

assOrderingQuestionGUI::updateImageFiles ( )
protected

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

227 : void
228 {
229 $element_list = $this->object->getOrderingElementList();
230 $elements = [];
231 foreach ($element_list->getElements() as $element) {
232 if ($element->getContent() === '') {
233 continue;
234 }
235 $filename = $this->object->updateImageFile(
236 $element->getContent()
237 );
238
239 $elements[] = $element->withContent($filename);
240 }
241
242 $list = $this->object->getOrderingElementList()->withElements($elements);
243 $this->object->setOrderingElementList($list);
244 }
$filename
Definition: buildRTE.php:78

References $filename.

Referenced by writeQuestionSpecificPostData().

+ Here is the caller graph for this function:

◆ uploadElementImage()

assOrderingQuestionGUI::uploadElementImage ( )

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

142 : void
143 {
144 $form = $this->buildEditForm();
145 $form->setValuesByPost();
146
147 $submitted_list = $this->fetchSolutionListFromSubmittedForm($form);
148
149 $elements = [];
150 foreach ($submitted_list->getElements() as $submitted_element) {
151 if ($submitted_element->isImageUploadAvailable()) {
152 $filename = $this->object->storeImageFile(
153 $submitted_element->getUploadImageFile(),
154 $submitted_element->getUploadImageName()
155 );
156
157 if (is_null($filename)) {
158 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('file_no_valid_file_type'));
159 } else {
160 $submitted_element = $submitted_element->withContent($filename);
161 }
162 }
163
164 if ($submitted_element->isImageRemovalRequest()) {
165 $this->object->dropImageFile($submitted_element->getContent());
166 $submitted_element = $submitted_element->withContent('');
167 }
168
169 $elements[] = $submitted_element;
170 }
171
172 $list = $this->object->getOrderingElementList()->withElements($elements);
173 $this->object->setOrderingElementList($list);
174
176 $this->writeQuestionSpecificPostData($form);
177
178 $this->editQuestion();
179 }
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from the request and applies them to the data object.
editQuestion(bool $checkonly=false, ?bool $is_save_cmd=null)

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

Referenced by removeElementImage().

+ 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 the request and applies them to the data object.

Implements ilGuiAnswerScoringAdjustable.

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

246 : void
247 {
248 $this->object->setOrderingElementList(
250 );
251 }

References fetchSolutionListFromSubmittedForm().

Referenced by writePostData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writePostData()

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

Evaluates a posted edit form and writes the form data in the question object.

Returns
integer A positive value, if one of the required fields wasn't set, else 0

Reimplemented from assQuestionGUI.

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

311 : int
312 {
313 $form = $this->buildEditForm();
314 $form->setValuesByPost();
315
316 if (!$form->checkInput()) {
317 $this->renderEditForm($form);
318 $this->addEditSubtabs(self::TAB_EDIT_QUESTION);
319 return 1; // return 1 = something went wrong, no saving happened
320 }
321
324 $this->writeAnswerSpecificPostData($form);
325 $this->writeQuestionSpecificPostData($form);
326
328
329 return 0; // return 0 = all fine, was saved either forced or validated
330 }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from the request and applies them to the data object.

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

+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assOrderingQuestionGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

Implements ilGuiQuestionScoringAdjustable.

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

181 : void
182 {
183 $thumb_size = $this->request_data_collector->int('thumb_geometry');
184 if ($thumb_size !== 0
185 && $thumb_size !== $this->object->getThumbSize()) {
186 $this->object->setThumbSize($thumb_size);
187 $this->updateImageFiles();
188 }
189
190 $this->object->setPoints($this->request_data_collector->float('points'));
191
192 $use_nested = $this->request_data_collector->int(self::F_USE_NESTED) === 1;
193 $this->object->setNestingType($use_nested);
194 }

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

Referenced by uploadElementImage(), and writePostData().

+ 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 53 of file class.assOrderingQuestionGUI.php.

◆ $object

assQuestion assOrderingQuestionGUI::$object

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

◆ $old_ordering_depth

assOrderingQuestionGUI::$old_ordering_depth = []

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

◆ CMD_EDIT_NESTING

const assOrderingQuestionGUI::CMD_EDIT_NESTING = 'editNesting'

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

◆ CMD_SAVE_NESTING

const assOrderingQuestionGUI::CMD_SAVE_NESTING = 'saveNesting'

Definition at line 37 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 45 of file class.assOrderingQuestionGUI.php.

◆ F_NESTED_ORDER_INDENT

const assOrderingQuestionGUI::F_NESTED_ORDER_INDENT = 'indentation'

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

◆ F_NESTED_ORDER_ORDER

const assOrderingQuestionGUI::F_NESTED_ORDER_ORDER = 'content'

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

◆ F_USE_NESTED

const assOrderingQuestionGUI::F_USE_NESTED = 'nested_answers'

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

◆ TAB_EDIT_NESTING

const assOrderingQuestionGUI::TAB_EDIT_NESTING = 'edit_nesting'

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

◆ TAB_EDIT_QUESTION

const assOrderingQuestionGUI::TAB_EDIT_QUESTION = 'edit_question'

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


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