ILIAS  release_7 Revision v7.30-3-g800a261c036
assOrderingQuestionGUI Class Reference

Ordering question GUI representation. 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...
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getPresentationJavascripts ()
 
 getTestOutput ($activeId, $pass, $isPostponed=false, $userSolutionPost=false, $inlineFeedback=false)
 
 getSpecificFeedbackOutput ($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...
 
 getAggregatedAnswersView ($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
 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $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)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- 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 $_POST 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...
 
 getAggregatedAnswersView ($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...
 
 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 $_POST 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
 
 $object
 
 $old_ordering_depth = array()
 
 $leveled_ordering = array()
 
- 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 SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $request
 
 $sequence_no
 sequence number in test More...
 
 $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)
 
 writePostData ($forceSaving=false)
 {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
} 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 ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 addSaveOnEnterOnLoadCode ()
 

Private Member Functions

 buildEditFormAfterTypeChange (array $values)
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Protected Attributes inherited from assQuestionGUI
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
 $ctrl
 
 $editForm
 
 $use_intermediate_solution = false
 

Detailed Description

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 24 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
Returns
assOrderingQuestionGUI

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

58 {
60 include_once "./Modules/TestQuestionPool/classes/class.assOrderingQuestion.php";
61 $this->object = new assOrderingQuestion();
62 if ($id >= 0) {
63 $this->object->loadFromDb($id);
64 }
65 }
Class for ordering questions.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References 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 312 of file class.assOrderingQuestionGUI.php.

313 {
314 $tabs = $this->getTabs();
315 $tabs->addSubTab(
316 self::TAB_EDIT_QUESTION,
317 $this->lng->txt('edit_question'),
318 $this->ctrl->getLinkTarget($this, 'editQuestion')
319 );
320 if ($this->object->isOrderingTypeNested()) {
321 $tabs->addSubTab(
322 self::TAB_EDIT_NESTING,
323 $this->lng->txt('tab_nest_answers'),
324 $this->ctrl->getLinkTarget($this, self::CMD_EDIT_NESTING)
325 );
326 }
327 $tabs->setTabActive('edit_question');
328 $tabs->setSubTabActive($active);
329 }

References getTabs().

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

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

677 {
678 $passdata = array(); // Regroup answers into units of passes.
679 foreach ($relevant_answers_chosen as $answer_chosen) {
680 $passdata[$answer_chosen['active_fi'] . '-' . $answer_chosen['pass']][$answer_chosen['value2']] = $answer_chosen['value1'];
681 }
682
683 $variants = array(); // Determine unique variants.
684 foreach ($passdata as $key => $data) {
685 $hash = md5(implode('-', $data));
686 $value_set = false;
687 foreach ($variants as $vkey => $variant) {
688 if ($variant['hash'] == $hash) {
689 $variant['count']++;
690 $value_set = true;
691 }
692 }
693 if (!$value_set) {
694 $variants[$key]['hash'] = $hash;
695 $variants[$key]['count'] = 1;
696 }
697 }
698
699 $aggregate = array(); // Render aggregate from variant.
700 foreach ($variants as $key => $variant_entry) {
701 $variant = $passdata[$key];
702
703 foreach ($variant as $variant_key => $variant_line) {
704 $i = 0;
705 $aggregated_info_for_answer['count'] = $variant_entry['count'];
706 foreach ($answers_defined_on_question as $element) {
707 $i++;
708
709 if ($this->object->isImageOrderingType()) {
710 $element->setImageThumbnailPrefix($this->object->getThumbPrefix());
711 $element->setImagePathWeb($this->object->getImagePathWeb());
712 $element->setImagePathFs($this->object->getImagePath());
713
714 $src = $element->getPresentationImageUrl();
715 $alt = $element->getContent();
716 $content = "<img src='{$src}' alt='{$alt}' title='{$alt}'/>";
717 } else {
718 $content = $element->getContent();
719 }
720
721 $aggregated_info_for_answer[$i . ' - ' . $content]
722 = $passdata[$key][$i];
723 }
724 }
725 $aggregate[] = $aggregated_info_for_answer;
726 }
727 return $aggregate;
728 }
$i
Definition: metadata.php:24
$data
Definition: storeScorm.php:23

References $data, and $i.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ buildEditForm()

assOrderingQuestionGUI::buildEditForm ( )
protected

Reimplemented from assQuestionGUI.

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

347 {
348 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingQuestionAuthoringFormGUI.php';
350 $form->setFormAction($this->ctrl->getFormAction($this));
351 $form->setTitle($this->outQuestionType());
352 $form->setMultipart($this->object->isImageOrderingType());
353 $form->setTableWidth("100%");
354 $form->setId("ordering");
355 // title, author, description, question, working time (assessment mode)
356 $this->addBasicQuestionFormProperties($form);
358 $this->populateAnswerSpecificFormPart($form);
359 $this->populateTaxonomyFormSection($form);
360
361 $form->addSpecificOrderingQuestionCommandButtons($this->object);
362 $form->addGenericAssessmentQuestionCommandButtons($this->object);
363
364 return $form;
365 }
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
Adds the answer specific form parts to a question property form gui.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...

References assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\outQuestionType(), populateAnswerSpecificFormPart(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by buildEditFormAfterTypeChange(), editQuestion(), 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 93 of file class.assOrderingQuestionGUI.php.

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

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

368 {
370 $form->setFormAction($this->ctrl->getFormAction($this));
371 $form->setTitle($this->outQuestionType());
372 $form->setTableWidth("100%");
373
374 $header = new ilFormSectionHeaderGUI();
375 $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
376 $form->addItem($header);
377
378 $orderingElementInput = $this->object->buildNestedOrderingElementInputGui();
379 $orderingElementInput->setStylingDisabled($this->isRenderPurposePrintPdf());
380
381 $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
382
383 $list = $this->object->getOrderingElementList();
384 foreach ($list->getElements() as $element) {
385 $element = $list->ensureValidIdentifiers($element);
386 }
387
388 $orderingElementInput->setElementList($list);
389
390 $form->addItem($orderingElementInput);
391 $form->addCommandButton(self::CMD_SAVE_NESTING, $this->lng->txt("save"));
392 return $form;
393 }
This class represents a section header in a property form.

References assQuestionGUI\isRenderPurposePrintPdf(), and assQuestionGUI\outQuestionType().

Referenced by editNesting(), and saveNesting().

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

◆ changeToPictures()

assOrderingQuestionGUI::changeToPictures ( )

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

68 {
69 if (!$this->object->isImageOrderingType()) {
70 //perhaps clear something?
71 }
72
73 $this->object->setContentType($this->object::OQ_CT_PICTURES);
74 $this->object->saveToDb();
75
76 $values = $this->request->getParsedBody();
77 $this->buildEditFormAfterTypeChange($values);
78 }

References buildEditFormAfterTypeChange().

+ Here is the call graph for this function:

◆ changeToText()

assOrderingQuestionGUI::changeToText ( )

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

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

References buildEditFormAfterTypeChange().

+ Here is the call graph for this function:

◆ editNesting()

assOrderingQuestionGUI::editNesting ( )

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

338 {
339 $this->renderEditForm($this->buildNestingForm());
340 $this->addEditSubtabs(self::TAB_EDIT_NESTING);
341 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
342 $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
343 }
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path

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

Referenced by saveNesting().

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

◆ editQuestion()

assOrderingQuestionGUI::editQuestion (   $checkonly = false)

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

332 {
333 $this->renderEditForm($this->buildEditForm());
334 $this->addEditSubtabs(self::TAB_EDIT_QUESTION);
335 }

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

Referenced by uploadElementImage().

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

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

References $_POST, F_USE_NESTED, ilPropertyFormGUI\getItemByPostVar(), and assOrderingQuestion\ORDERING_ELEMENT_FORM_FIELD_POSTVAR.

Referenced by saveCorrectionsFormProperties(), 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 639 of file class.assOrderingQuestionGUI.php.

640 {
641 return array();
642 }

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

654 {
655 return array();
656 }

◆ getAggregatedAnswersView()

assOrderingQuestionGUI::getAggregatedAnswersView (   $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 666 of file class.assOrderingQuestionGUI.php.

667 {
668 $aggView = $this->aggregateAnswers(
669 $relevant_answers,
670 $this->object->getOrderingElementList()
671 );
672
673 return $this->renderAggregateView($aggView)->get();
674 }
aggregateAnswers($relevant_answers_chosen, $answers_defined_on_question)

References aggregateAnswers(), and renderAggregateView().

+ Here is the call graph for this function:

◆ getAnswersFrequency()

assOrderingQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

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

808 {
809 $answersByActiveAndPass = array();
810
811 foreach ($relevantAnswers as $row) {
812 $key = $row['active_fi'] . ':' . $row['pass'];
813
814 if (!isset($answersByActiveAndPass[$key])) {
815 $answersByActiveAndPass[$key] = array();
816 }
817
818 $answersByActiveAndPass[$key][$row['value1']] = $row['value2'];
819 }
820
821 $solutionLists = array();
822
823 foreach ($answersByActiveAndPass as $indexedSolutions) {
824 $solutionLists[] = $this->object->getSolutionOrderingElementList($indexedSolutions);
825 }
826
827 /* @var ilAssOrderingElementList[] $answers */
828 $answers = array();
829
830 foreach ($solutionLists as $orderingElementList) {
831 $hash = $orderingElementList->getHash();
832
833 if (!isset($answers[$hash])) {
834 $variantHtml = $this->getAnswerStatisticOrderingVariantHtml(
835 $orderingElementList
836 );
837
838 $answers[$hash] = array(
839 'answer' => $variantHtml, 'frequency' => 0
840 );
841 }
842
843 $answers[$hash]['frequency']++;
844 }
845
846 return array_values($answers);
847 }
getAnswerStatisticOrderingVariantHtml(ilAssOrderingElementList $list)

References getAnswerStatisticOrderingVariantHtml().

+ Here is the call graph for this function:

◆ getAnswerStatisticOrderingElementHtml()

assOrderingQuestionGUI::getAnswerStatisticOrderingElementHtml ( ilAssOrderingElement  $element)
protected

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

756 {
757 if ($this->object->isImageOrderingType()) {
758 $element->setImageThumbnailPrefix($this->object->getThumbPrefix());
759 $element->setImagePathWeb($this->object->getImagePathWeb());
760 $element->setImagePathFs($this->object->getImagePath());
761
762 $src = $element->getPresentationImageUrl();
763 $alt = $element->getContent();
764 $content = "<img src='{$src}' alt='{$alt}' title='{$alt}'/>";
765 } else {
766 $content = $element->getContent();
767 }
768
769 return $content;
770 }
setImageThumbnailPrefix($imageThumbnailPrefix)

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

Referenced by getAnswerStatisticOrderingVariantHtml().

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

773 {
774 $html = '<ul>';
775
776 $lastIndent = 0;
777 $firstElem = true;
778
779 foreach ($list as $elem) {
780 if ($elem->getIndentation() > $lastIndent) {
781 $html .= '<ul><li>';
782 } elseif ($elem->getIndentation() < $lastIndent) {
783 $html .= '</li></ul><li>';
784 } elseif (!$firstElem) {
785 $html .= '</li><li>';
786 } else {
787 $html .= '<li>';
788 }
789
790 $html .= $this->getAnswerStatisticOrderingElementHtml($elem);
791
792 $firstElem = false;
793 $lastIndent = $elem->getIndentation();
794 }
795
796 $html .= '</li>';
797
798 for ($i = $lastIndent; $i > 0; $i--) {
799 $html .= '</ul></li>';
800 }
801
802 $html .= '</ul>';
803
804 return $html;
805 }
getAnswerStatisticOrderingElementHtml(ilAssOrderingElement $element)

References $i, and getAnswerStatisticOrderingElementHtml().

Referenced by getAnswersFrequency().

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

◆ getPresentationJavascripts()

assOrderingQuestionGUI::getPresentationJavascripts ( )

Reimplemented from assQuestionGUI.

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

532 {
533 global $DIC; /* @var ILIAS\DI\Container $DIC */
534
535 $files = [];
536
537 if ($DIC['ilBrowser']->isMobile() || $DIC['ilBrowser']->isIpad()) {
538 $files[] = './node_modules/@andxor/jquery-ui-touch-punch-fix/jquery.ui.touch-punch.js';
539 }
540
541 return $files;
542 }
global $DIC
Definition: goto.php:24

References $DIC.

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

501 {
502 if ($this->getPreviewSession() && $this->getPreviewSession()->hasParticipantSolution()) {
503 $solutionOrderingElementList = unserialize(
504 $this->getPreviewSession()->getParticipantsSolution()
505 );
506 } else {
507 $solutionOrderingElementList = $this->object->getShuffledOrderingElementList();
508 }
509
510 $answers = $this->object->buildNestedOrderingElementInputGui();
511 $answers->setNestingEnabled($this->object->isOrderingTypeNested());
513 $answers->setInteractionEnabled($this->isInteractivePresentation());
514 $answers->setElementList($solutionOrderingElementList);
515
516 $template = new ilTemplate("tpl.il_as_qpl_ordering_output.html", true, true, "Modules/TestQuestionPool");
517
518 $template->setCurrentBlock('nested_ordering_output');
519 $template->setVariable('NESTED_ORDERING', $answers->getHTML());
520 $template->parseCurrentBlock();
521
522 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
523
524 if ($show_question_only) {
525 return $template->get();
526 }
527
528 return $this->getILIASPage($template->get());
529 }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR

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

+ 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

Reimplemented from assQuestionGUI.

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

431 {
432 $solutionOrderingList = $this->object->getOrderingElementListForSolutionOutput(
433 $show_correct_solution,
434 $active_id,
435 $pass,
437 );
438
439 $answers_gui = $this->object->buildNestedOrderingElementInputGui();
440
441 if ($show_correct_solution) {
443 } else {
445 }
446
447 $answers_gui->setInteractionEnabled(false);
448 $answers_gui->setElementList($solutionOrderingList);
449
450 if ($graphicalOutput) {
451 $answers_gui->setShowCorrectnessIconsEnabled(true);
452 }
453 $answers_gui->setCorrectnessTrueElementList(
454 $solutionOrderingList->getParityTrueElementList($this->object->getOrderingElementList())
455 );
456 $solution_html = $answers_gui->getHTML();
457
458 $template = new ilTemplate("tpl.il_as_qpl_nested_ordering_output_solution.html", true, true, "Modules/TestQuestionPool");
459 $template->setVariable('SOLUTION_OUTPUT', $solution_html);
460 if ($show_question_text == true) {
461 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
462 }
463 $questionoutput = $template->get();
464
465 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
466 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
467
468 if ($show_feedback) {
469 $feedback = '';
470
471 if (!$this->isTestPresentationContext()) {
472 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
473 $feedback .= strlen($fb) ? $fb : '';
474 }
475
476 $fb = $this->getSpecificFeedbackOutput(array());
477 $feedback .= strlen($fb) ? $fb : '';
478
479 if (strlen($feedback)) {
480 $cssClass = (
481 $this->hasCorrectSolution($active_id, $pass) ?
483 );
484
485 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
486 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
487 }
488 }
489
490 if ($show_question_only) {
491 return $solutiontemplate->get();
492 }
493
494 return $this->getILIASPage($solutiontemplate->get());
495
496 // is this template still in use? it is not used at this point any longer!
497 // $template = new ilTemplate("tpl.il_as_qpl_ordering_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
498 }
getSpecificFeedbackOutput($userSolution)
Returns the answer specific feedback for the question.
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
hasCorrectSolution($activeId, $passIndex)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.

References $pass, ilAssNestedOrderingElementsInputGUI\CONTEXT_CORRECT_SOLUTION_PRESENTATION, ilAssNestedOrderingElementsInputGUI\CONTEXT_USER_SOLUTION_PRESENTATION, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), getSpecificFeedbackOutput(), assQuestionGUI\getUseIntermediateSolution(), assQuestionGUI\hasCorrectSolution(), and assQuestionGUI\isTestPresentationContext().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assOrderingQuestionGUI::getSpecificFeedbackOutput (   $userSolution)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
array$userSolution($userSolution[<value1>] = <value2>)
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

598 {
599 if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
600 return '';
601 }
602
603 $tpl = new ilTemplate('tpl.il_as_qpl_ordering_elem_fb.html', true, true, 'Modules/TestQuestionPool');
604
605 foreach ($this->object->getOrderingElementList() as $element) {
606 $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
607 $this->object->getId(),
608 0,
609 $element->getPosition()
610 );
611
612 if ($this->object->isImageOrderingType()) {
613 $imgSrc = $this->object->getImagePathWeb() . $element->getContent();
614 $tpl->setCurrentBlock('image');
615 $tpl->setVariable('IMG_SRC', $imgSrc);
616 } else {
617 $tpl->setCurrentBlock('text');
618 }
619 $tpl->setVariable('CONTENT', $element->getContent());
620 $tpl->parseCurrentBlock();
621
622 $tpl->setCurrentBlock('element');
623 $tpl->setVariable('FEEDBACK', $feedback);
624 $tpl->parseCurrentBlock();
625 }
626
627 return $this->object->prepareTextareaOutput($tpl->get(), true);
628 }

References assQuestionGUI\$tpl.

Referenced by getSolutionOutput().

+ Here is the caller graph for this function:

◆ getTabs()

assOrderingQuestionGUI::getTabs ( )
protected

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

591 : ilTabsGUI
592 {
593 global $DIC;
594 return $DIC['ilTabs'];
595 }
Tabs GUI.

References $DIC.

Referenced by addEditSubtabs().

+ Here is the caller graph for this function:

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

547 {
548 // hey: prevPassSolutions - fixed variable type, makes phpstorm stop crying
549 $userSolutionPost = is_array($userSolutionPost) ? $userSolutionPost : array();
550 // hey.
551
552 $orderingGUI = $this->object->buildNestedOrderingElementInputGui();
553 $orderingGUI->setNestingEnabled($this->object->isOrderingTypeNested());
554
555 $solutionOrderingElementList = $this->object->getSolutionOrderingElementListForTestOutput(
556 $orderingGUI,
557 $userSolutionPost,
558 $activeId,
559 $pass
560 );
561
562 $template = new ilTemplate('tpl.il_as_qpl_ordering_output.html', true, true, 'Modules/TestQuestionPool');
563
565 $orderingGUI->setElementList($solutionOrderingElementList);
566
567 $template->setCurrentBlock('nested_ordering_output');
568 $template->setVariable('NESTED_ORDERING', $orderingGUI->getHTML());
569 $template->parseCurrentBlock();
570
571 $template->setVariable('QUESTIONTEXT', $this->object->getQuestionForHTMLOutput());
572
573 $pageoutput = $this->outQuestionPage('', $isPostponed, $activeId, $template->get());
574
575 return $pageoutput;
576 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page

References $pass, ilAssNestedOrderingElementsInputGUI\CONTEXT_USER_SOLUTION_SUBMISSION, and assQuestionGUI\outQuestionPage().

+ Here is the call graph for this function:

◆ isInteractivePresentation()

assOrderingQuestionGUI::isInteractivePresentation ( )
protected

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

579 {
580 if ($this->isRenderPurposePlayback()) {
581 return true;
582 }
583
584 if ($this->isRenderPurposeDemoplay()) {
585 return true;
586 }
587
588 return false;
589 }

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

Referenced by getPreview().

+ 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.

Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Implements ilGuiAnswerScoringAdjustable.

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

233 {
234 $header = new ilFormSectionHeaderGUI();
235 $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
236 $form->addItem($header);
237
238 $orderingElementInput = $this->object->buildOrderingElementInputGui();
239 $orderingElementInput->setStylingDisabled($this->isRenderPurposePrintPdf());
240 $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
241
242 $list = $this->object->getOrderingElementList();
243 $orderingElementInput->setElementList($list);
244 $form->addItem($orderingElementInput);
245
246 return $form;
247 }
addItem($a_item)
Add Item (Property, SectionHeader).

References ilPropertyFormGUI\addItem(), and assQuestionGUI\isRenderPurposePrintPdf().

Referenced by buildEditForm().

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

◆ populateCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

862 {
863 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
864 $points->allowDecimals(true);
865 $points->setValue($this->object->getPoints());
866 $points->setRequired(true);
867 $points->setSize(3);
868 $points->setMinValue(0);
869 $points->setMinvalueShouldBeGreater(true);
870 $form->addItem($points);
871
872 $header = new ilFormSectionHeaderGUI();
873 $header->setTitle($this->lng->txt('oq_header_ordering_elements'));
874 $form->addItem($header);
875
876 $orderingElementInput = $this->object->buildNestedOrderingElementInputGui();
877
878 $this->object->initOrderingElementAuthoringProperties($orderingElementInput);
879
880 $orderingElementInput->setElementList($this->object->getOrderingElementList());
881
882 $form->addItem($orderingElementInput);
883 }
This class represents a number property in a property form.

References ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

250 {
251 if ($this->object->isImageOrderingType()) {
252 $geometry = new ilNumberInputGUI($this->lng->txt("thumb_geometry"), "thumb_geometry");
253 $geometry->setValue($this->object->getThumbGeometry());
254 $geometry->setRequired(true);
255 $geometry->setMaxLength(6);
256 $geometry->setMinValue(20);
257 $geometry->setSize(6);
258 $geometry->setInfo($this->lng->txt("thumb_geometry_info"));
259 $form->addItem($geometry);
260 }
261
262 // points
263 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
264 $points->allowDecimals(true);
265 $points->setValue($this->object->getPoints());
266 $points->setRequired(true);
267 $points->setSize(3);
268 $points->setMinValue(0);
269 $points->setMinvalueShouldBeGreater(true);
270 $form->addItem($points);
271
272 $nested_answers = new ilSelectInputGUI(
273 $this->lng->txt('qst_use_nested_answers'),
274 self::F_USE_NESTED
275 );
276 $nested_answers_options = [
277 0 => $this->lng->txt('qst_nested_nested_answers_off'),
278 1 => $this->lng->txt('qst_nested_nested_answers_on')
279 ];
280 $nested_answers->setOptions($nested_answers_options);
281 $nested_answers->setValue($this->object->isOrderingTypeNested());
282 $form->addItem($nested_answers);
283
284 return $form;
285 }
This class represents a selection list property in a property form.

References ilPropertyFormGUI\addItem().

Referenced by buildEditForm().

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

◆ prepareReprintableCorrectionsForm()

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

Reimplemented from assQuestionGUI.

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

853 {
855 $orderingInput->prepareReprintable($this->object);
856 }

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

+ Here is the call graph for this function:

◆ removeElementImage()

assOrderingQuestionGUI::removeElementImage ( )

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

References uploadElementImage().

+ Here is the call graph for this function:

◆ renderAggregateView()

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

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

736 {
737 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
738
739 foreach ($aggregate as $line_data) {
740 $tpl->setCurrentBlock('aggregaterow');
741 $count = array_shift($line_data);
742 $html = '<ul>';
743 foreach ($line_data as $key => $line) {
744 $html .= '<li>' . ++$line . '&nbsp;-&nbsp;' . $key . '</li>';
745 }
746 $html .= '</ul>';
747 $tpl->setVariable('COUNT', $count);
748 $tpl->setVariable('OPTION', $html);
749
750 $tpl->parseCurrentBlock();
751 }
752 return $tpl;
753 }

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

889 {
890 $this->object->setPoints((float) $form->getInput('points'));
891
892 $submittedElementList = $this->fetchSolutionListFromSubmittedForm($form);
893
894 $curElementList = $this->object->getOrderingElementList();
895
896 $newElementList = new ilAssOrderingElementList();
897 $newElementList->setQuestionId($this->object->getId());
898
899 foreach ($submittedElementList as $submittedElement) {
900 if (!$curElementList->elementExistByRandomIdentifier($submittedElement->getRandomIdentifier())) {
901 continue;
902 }
903
904 $curElement = $curElementList->getElementByRandomIdentifier($submittedElement->getRandomIdentifier());
905
906 $curElement->setPosition($submittedElement->getPosition());
907
908 if ($this->object->isOrderingTypeNested()) {
909 $curElement->setIndentation($submittedElement->getIndentation());
910 }
911
912 $newElementList->addElement($curElement);
913 }
914
915 $this->object->setOrderingElementList($newElementList);
916 }
fetchSolutionListFromSubmittedForm(ilPropertyFormGUI $form)
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References fetchSolutionListFromSubmittedForm(), and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ saveNesting()

assOrderingQuestionGUI::saveNesting ( )

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

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

References $_POST, buildNestingForm(), editNesting(), and F_NESTED_ORDER.

+ 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

Reimplemented from assQuestionGUI.

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

402 {
403 return true;
404 }

◆ uploadElementImage()

assOrderingQuestionGUI::uploadElementImage ( )

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

142 {
143 $form = $this->buildEditForm();
144 $form->setValuesByPost();
145 $submitted_list = $this->fetchSolutionListFromSubmittedForm($form);
146
147 $elements = [];
148 foreach ($submitted_list->getElements() as $submitted_element) {
149 if ($submitted_element->isImageUploadAvailable()) {
150 $filename = $this->object->storeImageFile(
151 $submitted_element->getUploadImageFile(),
152 $submitted_element->getUploadImageName()
153 );
154
155 if (is_null($filename)) {
156 ilUtil::sendFailure($this->lng->txt('form_upload_error'));
157 } else {
158 $submitted_element = $submitted_element->withContent($filename);
159 }
160 }
161
162 if ($submitted_element->isImageRemovalRequest()) {
163 $this->object->dropImageFile($submitted_element->getContent());
164 $submitted_element = $submitted_element->withContent('');
165 }
166
167 $elements[] = $submitted_element;
168 }
169
170 $list = $this->object->getOrderingElementList()->withElements($elements);
171 $this->object->setOrderingElementList($list);
172
174 $this->writeQuestionSpecificPostData($form);
175
176 $this->editQuestion();
177 }
$filename
Definition: buildRTE.php:89
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $filename, buildEditForm(), editQuestion(), fetchSolutionListFromSubmittedForm(), ilUtil\sendFailure(), 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 $_POST and applies them to the data object.

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiAnswerScoringAdjustable.

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

226 {
227 $list = $this->fetchSolutionListFromSubmittedForm($form);
228 $this->object->setOrderingElementList($list);
229 return;
230 }

References fetchSolutionListFromSubmittedForm().

Referenced by writePostData().

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

◆ writePostData()

assOrderingQuestionGUI::writePostData (   $forceSaving = 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
}

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

Reimplemented from assQuestionGUI.

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

294 {
295 $form = $this->buildEditForm();
296 $form->setValuesByPost();
297
298 if (!$form->checkInput()) {
299 $this->renderEditForm($form);
300 $this->addEditSubtabs(self::TAB_EDIT_QUESTION);
301 return 1; // return 1 = something went wrong, no saving happened
302 }
303
306 $this->writeAnswerSpecificPostData($form);
307 $this->writeQuestionSpecificPostData($form);
308
309 return 0; // return 0 = all fine, was saved either forced or validated
310 }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.

References addEditSubtabs(), buildEditForm(), assQuestionGUI\renderEditForm(), 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 $_POST and applies them to the data object.

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiQuestionScoringAdjustable.

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

180 {
181 $post = $_POST;
182 $thumb_geometry = (int) ($post["thumb_geometry"] ?? $this->object->getThumbGeometry());
183 $this->object->setThumbGeometry($thumb_geometry);
184
185 $points = (float) str_replace(',', '.', $post['points']);
186
187 $this->object->setPoints($points);
188
189 $use_nested = $post[self::F_USE_NESTED] === "1";
190
191 $this->object->setNestingType($use_nested);
192 }

References $_POST, and F_USE_NESTED.

Referenced by uploadElementImage(), and writePostData().

+ Here is the caller graph for this function:

Field Documentation

◆ $leveled_ordering

assOrderingQuestionGUI::$leveled_ordering = array()

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

◆ $object

assOrderingQuestionGUI::$object

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

◆ $old_ordering_depth

assOrderingQuestionGUI::$old_ordering_depth = array()

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

◆ CMD_EDIT_NESTING

const assOrderingQuestionGUI::CMD_EDIT_NESTING = 'editNesting'

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

◆ CMD_SAVE_NESTING

const assOrderingQuestionGUI::CMD_SAVE_NESTING = 'saveNesting'

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

◆ CMD_SWITCH_TO_PICTURESS

◆ CMD_SWITCH_TO_TERMS

◆ F_NESTED_IDENTIFIER_PREFIX

const assOrderingQuestionGUI::F_NESTED_IDENTIFIER_PREFIX = ilIdentifiedMultiValuesJsPositionIndexRemover::IDENTIFIER_INDICATOR_PREFIX

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

◆ F_NESTED_ORDER

const assOrderingQuestionGUI::F_NESTED_ORDER = 'order_elems'

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

Referenced by saveNesting().

◆ F_NESTED_ORDER_INDENT

const assOrderingQuestionGUI::F_NESTED_ORDER_INDENT = 'indentation'

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

◆ F_NESTED_ORDER_ORDER

const assOrderingQuestionGUI::F_NESTED_ORDER_ORDER = 'content'

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

◆ F_USE_NESTED

const assOrderingQuestionGUI::F_USE_NESTED = 'nested_answers'

◆ TAB_EDIT_NESTING

const assOrderingQuestionGUI::TAB_EDIT_NESTING = 'edit_nesting'

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

◆ TAB_EDIT_QUESTION

const assOrderingQuestionGUI::TAB_EDIT_QUESTION = 'edit_question'

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


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