ILIAS  release_8 Revision v8.23
assMatchingQuestionGUI 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 assMatchingQuestionGUI:
+ Collaboration diagram for assMatchingQuestionGUI:

Public Member Functions

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

Protected Member Functions

 writePostData (bool $always=false)
 {} More...
 
 getAnswerStatisticImageHtml ($picture)
 
 getAnswerStatisticMatchingElemHtml ($elem)
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 writePostData (bool $always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm (ilPropertyFormGUI $form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 addNumberOfTriesToFormIfNecessary (ilPropertyFormGUI $form)
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 genericFeedbackOutputBuilder (string $feedback_correct, string $feedback_incorrect, int $active_id, ?int $pass)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 
 addTab_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 generateCorrectnessIconsForCorrectness (int $correctness)
 
 cleanupAnswerText (array $answer_text, bool $is_rte)
 sk - 12.05.2023: This is one more of those that we need, but don't want. More...
 
 addSaveOnEnterOnLoadCode ()
 

Private Member Functions

 isDefImgUploadCommand ()
 
 isTermImgUploadCommand ()
 
 isValidTermAndDefinitionAmount (ilPropertyFormGUI $form)
 for mode 1:1 terms count must not be less than definitions count for mode n:n this limitation is cancelled More...
 
 isCorrectMatching ($pair, $definition, $term)
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI (string $question_type='', int $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants (string $guiClassName, string $cmdConstantNameBegin='CMD_')
 
static prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $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...
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const CORRECTNESS_NOT_OK = 0
 
const CORRECTNESS_MOSTLY_OK = 1
 
const CORRECTNESS_OK = 2
 
const ALLOWED_PLAIN_TEXT_TAGS = "<em>, <strong>"
 sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI. More...
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
assQuestion $object
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
 $error
 
string $errormessage
 
int $sequence_no
 sequence number in test More...
 
int $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 
- Protected Attributes inherited from assQuestionGUI
const SUGGESTED_SOLUTION_COMMANDS
 
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
ILIAS Notes GUIService $notes_gui
 
ilCtrl $ctrl
 
ilPropertyFormGUI $editForm
 
ILIAS TestQuestionPool InternalRequestService $request
 

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 Matching question GUI representation

The assMatchingQuestionGUI class encapsulates the GUI representation for matching 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
Version
$Id$

assMatchingQuestionGUI: ilFormPropertyDispatchGUI

Definition at line 34 of file class.assMatchingQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assMatchingQuestionGUI::__construct (   $id = -1)

assMatchingQuestionGUI constructor

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

Parameters
integer$idThe database id of a image map question object
integer$idThe database id of a image map question object

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

References $id, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and assQuestionGUI\setErrorMessage().

45  {
47  include_once "./Modules/TestQuestionPool/classes/class.assMatchingQuestion.php";
48  $this->object = new assMatchingQuestion();
49  $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
50  if ($id >= 0) {
51  $this->object->loadFromDb($id);
52  }
53  }
Class for matching questions.
setErrorMessage(string $errormessage)
__construct(Container $dic, ilPlugin $plugin)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Member Function Documentation

◆ adddefinitions()

assMatchingQuestionGUI::adddefinitions ( )

Definition at line 221 of file class.assMatchingQuestionGUI.php.

References editQuestion(), and writePostData().

221  : void
222  {
223  $this->writePostData(true);
224  $position = key($_POST["cmd"]["adddefinitions"]);
225  $this->object->insertDefinition($position + 1);
226  $this->editQuestion();
227  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ addpairs()

assMatchingQuestionGUI::addpairs ( )

Definition at line 237 of file class.assMatchingQuestionGUI.php.

References editQuestion(), and writePostData().

237  : void
238  {
239  $this->writePostData(true);
240  $position = key($_POST["cmd"]["addpairs"]);
241  $this->object->insertMatchingPair($position + 1);
242  $this->editQuestion();
243  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ addterms()

assMatchingQuestionGUI::addterms ( )

Definition at line 205 of file class.assMatchingQuestionGUI.php.

References editQuestion(), and writePostData().

205  : void
206  {
207  $this->writePostData(true);
208  $position = key($_POST["cmd"]["addterms"]);
209  $this->object->insertTerm($position + 1);
210  $this->editQuestion();
211  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ checkInput()

assMatchingQuestionGUI::checkInput ( )

check input fields

Definition at line 966 of file class.assMatchingQuestionGUI.php.

966  : bool
967  {
968  if ((!$_POST["title"]) or (!$_POST["author"]) or (!$_POST["question"])) {
969  return false;
970  }
971  return true;
972  }

◆ editQuestion()

assMatchingQuestionGUI::editQuestion (   $checkonly = false)

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

References $errors, assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), ILIAS\Repository\ctrl(), assQuestionGUI\getQuestionTemplate(), assQuestionGUI\isSaveCommand(), isValidTermAndDefinitionAmount(), ILIAS\Repository\lng(), ILIAS\Repository\object(), assQuestionGUI\outQuestionType(), populateAnswerSpecificFormPart(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by adddefinitions(), addpairs(), addterms(), removedefinitions(), removeimagedefinitions(), removeimageterms(), removepairs(), removeterms(), uploaddefinitions(), uploadterms(), and writePostData().

253  : bool
254  {
255  $save = $this->isSaveCommand();
256  $this->getQuestionTemplate();
257 
258  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
259  $form = new ilPropertyFormGUI();
260  $this->editForm = $form;
261 
262  $form->setFormAction($this->ctrl->getFormAction($this));
263  $form->setTitle($this->outQuestionType());
264  $form->setMultipart(true);
265  $form->setTableWidth("100%");
266  $form->setId("matching");
267 
268  $this->addBasicQuestionFormProperties($form);
269  $this->populateQuestionSpecificFormPart($form);
270  $this->populateAnswerSpecificFormPart($form);
271  $this->populateTaxonomyFormSection($form);
272  $this->addQuestionFormCommandButtons($form);
273 
274  $errors = false;
275  if ($save) {
276  $form->setValuesByPost();
277  $errors = !$form->checkInput();
278  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
279  if (!$errors && !$this->isValidTermAndDefinitionAmount($form) && !$this->object->getSelfAssessmentEditingMode()) {
280  $errors = true;
281  $terms = $form->getItemByPostVar('terms');
282  $terms->setAlert($this->lng->txt("msg_number_of_terms_too_low"));
283  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
284  }
285  if ($errors) {
286  $checkonly = false;
287  }
288  }
289 
290  if (!$checkonly) {
291  $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
292  }
293  return $errors;
294  }
$errors
Definition: imgupload.php:65
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
isValidTermAndDefinitionAmount(ilPropertyFormGUI $form)
for mode 1:1 terms count must not be less than definitions count for mode n:n this limitation is canc...
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionAnswerPostVars()

assMatchingQuestionGUI::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 1020 of file class.assMatchingQuestionGUI.php.

1020  : array
1021  {
1022  return array();
1023  }

◆ getAfterParticipationSuppressionQuestionPostVars()

assMatchingQuestionGUI::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 1034 of file class.assMatchingQuestionGUI.php.

1034  : array
1035  {
1036  return array();
1037  }

◆ getAggregatedAnswersView()

assMatchingQuestionGUI::getAggregatedAnswersView ( array  $relevant_answers)

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

Parameters
array$relevant_answers
Returns
string

Implements ilGuiQuestionScoringAdjustable.

Definition at line 1045 of file class.assMatchingQuestionGUI.php.

1045  : string
1046  {
1047  return ''; //print_r($relevant_answers,true);
1048  }

◆ getAnswerFrequencyTableGUI()

assMatchingQuestionGUI::getAnswerFrequencyTableGUI (   $parentGui,
  $parentCmd,
  $relevantAnswers,
  $questionIndex 
)
Parameters
$parentGui
$parentCmd
$relevantAnswers
$questionIndex
Returns
ilMatchingQuestionAnswerFreqStatTableGUI

Definition at line 1143 of file class.assMatchingQuestionGUI.php.

References getAnswersFrequency().

1144  {
1145  require_once 'Modules/TestQuestionPool/classes/tables/class.ilMatchingQuestionAnswerFreqStatTableGUI.php';
1146 
1147  $table = new ilMatchingQuestionAnswerFreqStatTableGUI($parentGui, $parentCmd, $this->object);
1148  $table->setQuestionIndex($questionIndex);
1149  $table->setData($this->getAnswersFrequency($relevantAnswers, $questionIndex));
1150  $table->initColumns();
1151 
1152  return $table;
1153  }
getAnswersFrequency($relevantAnswers, $questionIndex)
+ Here is the call graph for this function:

◆ getAnswersFrequency()

assMatchingQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Definition at line 1092 of file class.assMatchingQuestionGUI.php.

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

Referenced by getAnswerFrequencyTableGUI().

1092  : array
1093  {
1094  $answersByActiveAndPass = array();
1095 
1096  foreach ($relevantAnswers as $row) {
1097  $key = $row['active_fi'] . ':' . $row['pass'];
1098 
1099  if (!isset($answersByActiveAndPass[$key])) {
1100  $answersByActiveAndPass[$key] = array();
1101  }
1102 
1103  $answersByActiveAndPass[$key][$row['value1']] = $row['value2'];
1104  }
1105 
1106  $answers = array();
1107 
1108  foreach ($answersByActiveAndPass as $key => $matchingPairs) {
1109  foreach ($matchingPairs as $termId => $defId) {
1110  $hash = md5($termId . ':' . $defId);
1111 
1112  if (!isset($answers[$hash])) {
1113  $termHtml = $this->getAnswerStatisticMatchingElemHtml(
1114  $this->object->getTermWithIdentifier($termId)
1115  );
1116 
1117  $defHtml = $this->getAnswerStatisticMatchingElemHtml(
1118  $this->object->getDefinitionWithIdentifier($defId)
1119  );
1120 
1121  $answers[$hash] = array(
1122  'answer' => $termHtml . $defHtml,
1123  'term' => $termHtml,
1124  'definition' => $defHtml,
1125  'frequency' => 0
1126  );
1127  }
1128 
1129  $answers[$hash]['frequency']++;
1130  }
1131  }
1132 
1133  return $answers;
1134  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAnswerStatisticImageHtml()

assMatchingQuestionGUI::getAnswerStatisticImageHtml (   $picture)
protected

Definition at line 1071 of file class.assMatchingQuestionGUI.php.

Referenced by getAnswerStatisticMatchingElemHtml().

1071  : string
1072  {
1073  $thumbweb = $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $picture;
1074  return '<img src="' . $thumbweb . '" alt="' . $picture . '" title="' . $picture . '"/>';
1075  }
+ Here is the caller graph for this function:

◆ getAnswerStatisticMatchingElemHtml()

assMatchingQuestionGUI::getAnswerStatisticMatchingElemHtml (   $elem)
protected

Definition at line 1077 of file class.assMatchingQuestionGUI.php.

References getAnswerStatisticImageHtml().

Referenced by getAnswersFrequency().

1077  : string
1078  {
1079  $html = '';
1080 
1081  if (strlen($elem->getText())) {
1082  $html .= $elem->getText();
1083  }
1084 
1085  if (strlen($elem->getPicture())) {
1086  $html .= $this->getAnswerStatisticImageHtml($elem->getPicture());
1087  }
1088 
1089  return $html;
1090  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPresentationJavascripts()

assMatchingQuestionGUI::getPresentationJavascripts ( )

Definition at line 804 of file class.assMatchingQuestionGUI.php.

References $DIC.

804  : array
805  {
806  global $DIC; /* @var ILIAS\DI\Container $DIC */
807 
808  $files = array();
809 
810  if ($DIC->http()->agent()->isMobile() || $DIC->http()->agent()->isIpad()) {
811  $files[] = './node_modules/@andxor/jquery-ui-touch-punch-fix/jquery.ui.touch-punch.js';
812  }
813 
814  $files[] = 'Modules/TestQuestionPool/js/ilMatchingQuestion.js';
815 
816  return $files;
817  }
global $DIC
Definition: feed.php:28

◆ getPreview()

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

Definition at line 647 of file class.assMatchingQuestionGUI.php.

References $DIC, $id, assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\getPreviewSession(), ilUtil\getStyleSheetLocation(), iljQueryUtil\initjQuery(), iljQueryUtil\initjQueryUI(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

647  : string
648  {
649  $solutions = is_object($this->getPreviewSession()) ? (array) $this->getPreviewSession()->getParticipantsSolution() : array();
650 
651  global $DIC; /* @var ILIAS\DI\Container $DIC */
652  if ($DIC->http()->agent()->isMobile() || $DIC->http()->agent()->isIpad()) {
653  require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
656  $this->tpl->addJavaScript('./node_modules/@andxor/jquery-ui-touch-punch-fix/jquery.ui.touch-punch.js');
657  }
658  $this->tpl->addJavaScript('Modules/TestQuestionPool/js/ilMatchingQuestion.js');
659  $this->tpl->addOnLoadCode('ilMatchingQuestionInit();');
660  $this->tpl->addCss(ilUtil::getStyleSheetLocation('output', 'test_javascript.css', 'Modules/TestQuestionPool'));
661 
662  $template = new ilTemplate("tpl.il_as_qpl_matching_output.html", true, true, "Modules/TestQuestionPool");
663 
664  foreach ($solutions as $defId => $terms) {
665  foreach ($terms as $termId) {
666  $template->setCurrentBlock("matching_data");
667  $template->setVariable("DEFINITION_ID", $defId);
668  $template->setVariable("TERM_ID", $termId);
669  $template->parseCurrentBlock();
670  }
671  }
672 
673  // shuffle output
674  $terms = $this->object->getTerms();
675  $definitions = $this->object->getDefinitions();
676  switch ($this->object->getShuffleMode()) {
677  case 1:
678  $terms = $this->object->getShuffler()->transform($terms);
679  $definitions = $this->object->getShuffler()->transform(
680  $this->object->getShuffler()->transform($definitions)
681  );
682  break;
683  case 2:
684  $terms = $this->object->getShuffler()->transform($terms);
685  break;
686  case 3:
687  $definitions = $this->object->getShuffler()->transform($definitions);
688  break;
689  }
690 
691  // create definitions
692  $counter = 0;
693  foreach ($definitions as $definition) {
694  if (strlen($definition->getPicture())) {
695  $template->setCurrentBlock("definition_picture");
696  $template->setVariable("DEFINITION_ID", $definition->getIdentifier());
697  $template->setVariable("IMAGE_HREF", $this->object->getImagePathWeb() . $definition->getPicture());
698  $thumbweb = $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $definition->getPicture();
699  $thumb = $this->object->getImagePath() . $this->object->getThumbPrefix() . $definition->getPicture();
700  if (!@file_exists($thumb)) {
701  $this->object->rebuildThumbnails();
702  }
703  $template->setVariable("THUMBNAIL_HREF", $thumbweb);
704  $template->setVariable("THUMB_ALT", $this->lng->txt("image"));
705  $template->setVariable("THUMB_TITLE", $this->lng->txt("image"));
706  $template->setVariable("TEXT_DEFINITION", (strlen($definition->getText())) ? $this->object->prepareTextareaOutput($definition->getText(), true, true) : '');
707  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
708  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
709  $template->parseCurrentBlock();
710  } else {
711  $template->setCurrentBlock("definition_text");
712  $template->setVariable("DEFINITION", $this->object->prepareTextareaOutput($definition->getText(), true, true));
713  $template->parseCurrentBlock();
714  }
715 
716  $template->setCurrentBlock("droparea");
717  $template->setVariable("ID_DROPAREA", $definition->getIdentifier());
718  $template->setVariable("QUESTION_ID", $this->object->getId());
719  $template->parseCurrentBlock();
720 
721  $template->setCurrentBlock("definition_data");
722  $template->setVariable("DEFINITION_ID", $definition->getIdentifier());
723  $template->parseCurrentBlock();
724  }
725 
726  // create terms
727  $counter = 0;
728  foreach ($terms as $term) {
729  if (strlen($term->getPicture())) {
730  $template->setCurrentBlock("term_picture");
731  $template->setVariable("TERM_ID", $term->getIdentifier());
732  $template->setVariable("IMAGE_HREF", $this->object->getImagePathWeb() . $term->getPicture());
733  $thumbweb = $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $term->getPicture();
734  $thumb = $this->object->getImagePath() . $this->object->getThumbPrefix() . $term->getPicture();
735  if (!@file_exists($thumb)) {
736  $this->object->rebuildThumbnails();
737  }
738  $template->setVariable("THUMBNAIL_HREF", $thumbweb);
739  $template->setVariable("THUMB_ALT", $this->lng->txt("image"));
740  $template->setVariable("THUMB_TITLE", $this->lng->txt("image"));
741  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
742  $template->setVariable("TEXT_TERM", (strlen($term->getText())) ? $this->object->prepareTextareaOutput($term->getText(), true, true) : '');
743  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
744  $template->parseCurrentBlock();
745  } else {
746  $template->setCurrentBlock("term_text");
747  $template->setVariable("TERM_TEXT", $this->object->prepareTextareaOutput($term->getText(), true, true));
748  $template->parseCurrentBlock();
749  }
750  $template->setCurrentBlock("draggable");
751  $template->setVariable("ID_DRAGGABLE", $term->getIdentifier());
752  $template->parseCurrentBlock();
753 
754  $template->setCurrentBlock("term_data");
755  $template->setVariable("TERM_ID", $term->getIdentifier());
756  $template->parseCurrentBlock();
757  }
758 
759  $template->setVariable('MATCHING_MODE', $this->object->getMatchingMode());
760 
761  $template->setVariable("RESET_BUTTON", $this->lng->txt("reset_terms"));
762 
763  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
764 
765  $questionoutput = $template->get();
766 
767  if (!$show_question_only) {
768  // get page object output
769  $questionoutput = $this->getILIASPage($questionoutput);
770  }
771 
772  return $questionoutput;
773  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
global $DIC
Definition: feed.php:28
static initjQueryUI(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
+ Here is the call graph for this function:

◆ getSolutionOutput()

assMatchingQuestionGUI::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
Returns
string The solution output of the question as HTML code

Definition at line 466 of file class.assMatchingQuestionGUI.php.

References $i, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\generateCorrectnessIconsForCorrectness(), assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getSpecificFeedbackOutput(), assQuestionGUI\hasCorrectSolution(), isCorrectMatching(), assQuestionGUI\isTestPresentationContext(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilWACSignedPath\signFile().

476  : string {
477  // generate the question output
478  include_once "./Services/UICore/classes/class.ilTemplate.php";
479  $template = new ilTemplate("tpl.il_as_qpl_matching_output_solution.html", true, true, "Modules/TestQuestionPool");
480  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
481 
482  $solutions = array();
483  if (($active_id > 0) && (!$show_correct_solution)) {
484  include_once "./Modules/Test/classes/class.ilObjTest.php";
485  $solutions = $this->object->getSolutionValues($active_id, $pass);
486  } else {
487  foreach ($this->object->getMaximumScoringMatchingPairs() as $pair) {
488  $solutions[] = array(
489  "value1" => $pair->getTerm()->getIdentifier(),
490  "value2" => $pair->getDefinition()->getIdentifier(),
491  'points' => $pair->getPoints()
492  );
493  }
494  }
495 
496  $i = 0;
497 
498  foreach ($solutions as $solution) {
499  $definition = $this->object->getDefinitionWithIdentifier($solution['value2']);
500  $term = $this->object->getTermWithIdentifier($solution['value1']);
501  $points = $solution['points'];
502 
503  if (is_object($definition)) {
504  if (strlen($definition->getPicture())) {
505  if (strlen($definition->getText())) {
506  $template->setCurrentBlock('definition_image_text');
507  $template->setVariable(
508  "TEXT_DEFINITION",
509  ilLegacyFormElementsUtil::prepareFormOutput($definition->getText())
510  );
511  $template->parseCurrentBlock();
512  }
513 
514  $answerImageSrc = ilWACSignedPath::signFile(
515  $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $definition->getPicture()
516  );
517 
518  $template->setCurrentBlock('definition_image');
519  $template->setVariable('ANSWER_IMAGE_URL', $answerImageSrc);
520  $template->setVariable(
521  'ANSWER_IMAGE_ALT',
522  (strlen($definition->getText())) ? ilLegacyFormElementsUtil::prepareFormOutput(
523  $definition->getText()
524  ) : ilLegacyFormElementsUtil::prepareFormOutput($definition->getPicture())
525  );
526  $template->setVariable(
527  'ANSWER_IMAGE_TITLE',
528  (strlen($definition->getText())) ? ilLegacyFormElementsUtil::prepareFormOutput(
529  $definition->getText()
530  ) : ilLegacyFormElementsUtil::prepareFormOutput($definition->getPicture())
531  );
532  $template->setVariable('URL_PREVIEW', $this->object->getImagePathWeb() . $definition->getPicture());
533  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
534  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
535  $template->parseCurrentBlock();
536  } else {
537  $template->setCurrentBlock('definition_text');
538  $template->setVariable("DEFINITION", $this->object->prepareTextareaOutput($definition->getText(), true));
539  $template->parseCurrentBlock();
540  }
541  }
542  if (is_object($term)) {
543  if (strlen($term->getPicture())) {
544  if (strlen($term->getText())) {
545  $template->setCurrentBlock('term_image_text');
546  $template->setVariable("TEXT_TERM", ilLegacyFormElementsUtil::prepareFormOutput($term->getText()));
547  $template->parseCurrentBlock();
548  }
549 
550  $answerImageSrc = ilWACSignedPath::signFile(
551  $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $term->getPicture()
552  );
553 
554  $template->setCurrentBlock('term_image');
555  $template->setVariable('ANSWER_IMAGE_URL', $answerImageSrc);
556  $template->setVariable(
557  'ANSWER_IMAGE_ALT',
558  (strlen($term->getText())) ? ilLegacyFormElementsUtil::prepareFormOutput(
559  $term->getText()
560  ) : ilLegacyFormElementsUtil::prepareFormOutput($term->getPicture())
561  );
562  $template->setVariable(
563  'ANSWER_IMAGE_TITLE',
564  (strlen($term->getText())) ? ilLegacyFormElementsUtil::prepareFormOutput(
565  $term->getText()
566  ) : ilLegacyFormElementsUtil::prepareFormOutput($term->getPicture())
567  );
568  $template->setVariable('URL_PREVIEW', $this->object->getImagePathWeb() . $term->getPicture());
569  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
570  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
571  $template->parseCurrentBlock();
572  } else {
573  $template->setCurrentBlock('term_text');
574  $template->setVariable("TERM", $this->object->prepareTextareaOutput($term->getText(), true));
575  $template->parseCurrentBlock();
576  }
577  $i++;
578  }
579  if (($active_id > 0) && (!$show_correct_solution)) {
580  if ($graphicalOutput) {
581  // output of ok/not ok icons for user entered solutions
582  $ok = false;
583  foreach ($this->object->getMatchingPairs() as $pair) {
584  if ($this->isCorrectMatching($pair, $definition, $term)) {
585  $ok = true;
586  }
587  }
588 
589  $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_NOT_OK);
590  if ($ok) {
591  $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_OK);
592  }
593  $template->setCurrentBlock("icon_ok");
594  $template->setVariable("ICON_OK", $correctness_icon);
595  $template->parseCurrentBlock();
596  }
597  }
598 
599  if ($result_output) {
600  $resulttext = ($points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
601  $template->setCurrentBlock("result_output");
602  $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $points));
603  $template->parseCurrentBlock();
604  }
605 
606  $template->setCurrentBlock("row");
607  $template->setVariable("TEXT_MATCHES", $this->lng->txt("matches"));
608  $template->parseCurrentBlock();
609  }
610 
611  if ($show_question_text == true) {
612  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
613  }
614 
615  $questionoutput = $template->get();
616 
617  $feedback = '';
618  if ($show_feedback) {
619  if (!$this->isTestPresentationContext()) {
620  $fb = $this->getGenericFeedbackOutput((int) $active_id, $pass);
621  $feedback .= strlen($fb) ? $fb : '';
622  }
623 
624  $fb = $this->getSpecificFeedbackOutput(array());
625  $feedback .= strlen($fb) ? $fb : '';
626  }
627  if (strlen($feedback)) {
628  $cssClass = (
629  $this->hasCorrectSolution($active_id, $pass) ?
631  );
632 
633  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
634  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
635  }
636 
637  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
638 
639  $solutionoutput = $solutiontemplate->get();
640  if (!$show_question_only) {
641  // get page object output
642  $solutionoutput = $this->getILIASPage($solutionoutput);
643  }
644  return $solutionoutput;
645  }
hasCorrectSolution($activeId, $passIndex)
generateCorrectnessIconsForCorrectness(int $correctness)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, bool $a_strip=false)
isCorrectMatching($pair, $definition, $term)
getSpecificFeedbackOutput(array $userSolution)
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
static signFile(string $path_to_file)
$i
Definition: metadata.php:41
getGenericFeedbackOutput(int $active_id, ?int $pass)
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assMatchingQuestionGUI::getSpecificFeedbackOutput ( array  $userSolution)

Definition at line 974 of file class.assMatchingQuestionGUI.php.

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

Referenced by getSolutionOutput().

974  : string
975  {
976  $matches = array_values($this->object->matchingpairs);
977 
978  if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
979  return '';
980  }
981 
982  $feedback = '<table class="test_specific_feedback"><tbody>';
983 
984  foreach ($matches as $idx => $ans) {
985  if (!isset($userSolution[$ans->getDefinition()->getIdentifier()])) {
986  continue;
987  }
988 
989  if (!is_array($userSolution[$ans->getDefinition()->getIdentifier()])) {
990  continue;
991  }
992 
993  if (!in_array($ans->getTerm()->getIdentifier(), $userSolution[$ans->getDefinition()->getIdentifier()])) {
994  continue;
995  }
996 
997  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
998  $this->object->getId(),
999  0,
1000  $idx
1001  );
1002  $feedback .= '<tr><td>"' . $ans->getDefinition()->getText() . '"&nbsp;' . $this->lng->txt("matches") . '&nbsp;"';
1003  $feedback .= $ans->getTerm()->getText() . '"</td><td>';
1004  $feedback .= $fb . '</td> </tr>';
1005  }
1006 
1007  $feedback .= '</tbody></table>';
1008  return $this->object->prepareTextareaOutput($feedback, true);
1009  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestOutput()

assMatchingQuestionGUI::getTestOutput (   $active_id,
  $pass,
  $is_postponed = false,
  $user_post_solution = false,
  $inlineFeedback = false 
)

Definition at line 820 of file class.assMatchingQuestionGUI.php.

References $DIC, ilUtil\getImagePath(), ilUtil\getStyleSheetLocation(), iljQueryUtil\initjQuery(), iljQueryUtil\initjQueryUI(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and assQuestionGUI\outQuestionPage().

820  : string
821  // hey.
822  {
823  global $DIC; /* @var ILIAS\DI\Container $DIC */
824  if ($DIC->http()->agent()->isMobile() || $DIC->http()->agent()->isIpad()) {
825  require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
828  $this->tpl->addJavaScript('./node_modules/@andxor/jquery-ui-touch-punch-fix/jquery.ui.touch-punch.js');
829  }
830  $this->tpl->addJavaScript('Modules/TestQuestionPool/js/ilMatchingQuestion.js');
831  $this->tpl->addOnLoadCode('ilMatchingQuestionInit();');
832  $this->tpl->addCss(ilUtil::getStyleSheetLocation('output', 'test_javascript.css', 'Modules/TestQuestionPool'));
833 
834  $template = new ilTemplate("tpl.il_as_qpl_matching_output.html", true, true, "Modules/TestQuestionPool");
835 
836  $solutions = array();
837  if ($active_id) {
838  if (is_array($user_post_solution)) {
839  foreach ($user_post_solution['matching'][$this->object->getId()] as $definition => $term) {
840  array_push($solutions, array("value1" => $term, "value2" => $definition));
841  }
842  } else {
843  // hey: prevPassSolutions - obsolete due to central check
844  $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
845  // hey.
846  }
847 
848  $counter = 0;
849  foreach ($solutions as $idx => $solution_value) {
850  if (($solution_value["value2"] > -1) && ($solution_value["value1"] > -1)) {
851  $template->setCurrentBlock("matching_data");
852  $template->setVariable("TERM_ID", $solution_value["value1"]);
853  $template->setVariable("DEFINITION_ID", $solution_value["value2"]);
854  $template->parseCurrentBlock();
855  }
856 
857  $counter++;
858  }
859  }
860 
861  $terms = $this->object->getTerms();
862  $definitions = $this->object->getDefinitions();
863  switch ($this->object->getShuffleMode()) {
864  case 1:
865  $terms = $this->object->getShuffler()->transform($terms);
866  if (count($solutions)) {
867  $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
868  } else {
869  $definitions = $this->object->getShuffler()->transform(
870  $this->object->getShuffler()->transform($definitions)
871  );
872  }
873  break;
874  case 2:
875  $terms = $this->object->getShuffler()->transform($terms);
876  break;
877  case 3:
878  if (count($solutions)) {
879  $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
880  } else {
881  $definitions = $this->object->getShuffler()->transform($definitions);
882  }
883  break;
884  }
885 
886  // create definitions
887  $counter = 0;
888  foreach ($definitions as $definition) {
889  if (strlen($definition->getPicture())) {
890  $template->setCurrentBlock("definition_picture");
891  $template->setVariable("DEFINITION_ID", $definition->getIdentifier());
892  $template->setVariable("IMAGE_HREF", $this->object->getImagePathWeb() . $definition->getPicture());
893  $thumbweb = $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $definition->getPicture();
894  $thumb = $this->object->getImagePath() . $this->object->getThumbPrefix() . $definition->getPicture();
895  if (!@file_exists($thumb)) {
896  $this->object->rebuildThumbnails();
897  }
898  $template->setVariable("THUMBNAIL_HREF", $thumbweb);
899  $template->setVariable("THUMB_ALT", $this->lng->txt("image"));
900  $template->setVariable("THUMB_TITLE", $this->lng->txt("image"));
901  $template->setVariable("TEXT_DEFINITION", (strlen($definition->getText())) ? $this->object->prepareTextareaOutput($definition->getText(), true, true) : '');
902  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
903  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
904  $template->parseCurrentBlock();
905  } else {
906  $template->setCurrentBlock("definition_text");
907  $template->setVariable("DEFINITION", $this->object->prepareTextareaOutput($definition->getText(), true, true));
908  $template->parseCurrentBlock();
909  }
910 
911  $template->setCurrentBlock("droparea");
912  $template->setVariable("ID_DROPAREA", $definition->getIdentifier());
913  $template->setVariable("QUESTION_ID", $this->object->getId());
914  $template->parseCurrentBlock();
915 
916  $template->setCurrentBlock("definition_data");
917  $template->setVariable("DEFINITION_ID", $definition->getIdentifier());
918  $template->parseCurrentBlock();
919  }
920 
921  // create terms
922  $counter = 0;
923  foreach ($terms as $term) {
924  if (strlen($term->getPicture())) {
925  $template->setCurrentBlock("term_picture");
926  $template->setVariable("TERM_ID", $term->getIdentifier());
927  $template->setVariable("IMAGE_HREF", $this->object->getImagePathWeb() . $term->getPicture());
928  $thumbweb = $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $term->getPicture();
929  $thumb = $this->object->getImagePath() . $this->object->getThumbPrefix() . $term->getPicture();
930  if (!@file_exists($thumb)) {
931  $this->object->rebuildThumbnails();
932  }
933  $template->setVariable("THUMBNAIL_HREF", $thumbweb);
934  $template->setVariable("THUMB_ALT", $this->lng->txt("image"));
935  $template->setVariable("THUMB_TITLE", $this->lng->txt("image"));
936  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
937  $template->setVariable("TEXT_TERM", (strlen($term->getText())) ? $this->object->prepareTextareaOutput($term->getText(), true, true) : '');
938  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
939  $template->parseCurrentBlock();
940  } else {
941  $template->setCurrentBlock("term_text");
942  $template->setVariable("TERM_TEXT", $this->object->prepareTextareaOutput($term->getText(), true, true));
943  $template->parseCurrentBlock();
944  }
945  $template->setCurrentBlock("draggable");
946  $template->setVariable("ID_DRAGGABLE", $term->getIdentifier());
947  $template->parseCurrentBlock();
948 
949  $template->setCurrentBlock('term_data');
950  $template->setVariable('TERM_ID', $term->getIdentifier());
951  $template->parseCurrentBlock();
952  }
953 
954  $template->setVariable('MATCHING_MODE', $this->object->getMatchingMode());
955 
956  $template->setVariable("RESET_BUTTON", $this->lng->txt("reset_terms"));
957 
958  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
959 
960  return $this->outQuestionPage("", $is_postponed, $active_id, $template->get());
961  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
global $DIC
Definition: feed.php:28
static initjQueryUI(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
+ Here is the call graph for this function:

◆ isCorrectMatching()

assMatchingQuestionGUI::isCorrectMatching (   $pair,
  $definition,
  $term 
)
private

Definition at line 1050 of file class.assMatchingQuestionGUI.php.

Referenced by getSolutionOutput().

1050  : bool
1051  {
1052  if (!($pair->getPoints() > 0)) {
1053  return false;
1054  }
1055 
1056  if (!is_object($term)) {
1057  return false;
1058  }
1059 
1060  if ($pair->getDefinition()->getIdentifier() != $definition->getIdentifier()) {
1061  return false;
1062  }
1063 
1064  if ($pair->getTerm()->getIdentifier() != $term->getIdentifier()) {
1065  return false;
1066  }
1067 
1068  return true;
1069  }
+ Here is the caller graph for this function:

◆ isDefImgUploadCommand()

assMatchingQuestionGUI::isDefImgUploadCommand ( )
private

Definition at line 296 of file class.assMatchingQuestionGUI.php.

References ILIAS\Repository\ctrl().

Referenced by populateAnswerSpecificFormPart().

296  : bool
297  {
298  return $this->ctrl->getCmd() == 'uploaddefinitions';
299  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTermImgUploadCommand()

assMatchingQuestionGUI::isTermImgUploadCommand ( )
private

Definition at line 301 of file class.assMatchingQuestionGUI.php.

References ILIAS\Repository\ctrl().

Referenced by populateAnswerSpecificFormPart().

301  : bool
302  {
303  return $this->ctrl->getCmd() == 'uploadterms';
304  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidTermAndDefinitionAmount()

assMatchingQuestionGUI::isValidTermAndDefinitionAmount ( ilPropertyFormGUI  $form)
private

for mode 1:1 terms count must not be less than definitions count for mode n:n this limitation is cancelled

Parameters
ilPropertyFormGUI$form
Returns
bool

Definition at line 313 of file class.assMatchingQuestionGUI.php.

References ilPropertyFormGUI\getItemByPostVar(), and assMatchingQuestion\MATCHING_MODE_N_ON_N.

Referenced by editQuestion().

313  : bool
314  {
315  $matchingMode = $form->getItemByPostVar('matching_mode')->getValue();
316 
317  if ($matchingMode == assMatchingQuestion::MATCHING_MODE_N_ON_N) {
318  return true;
319  }
320 
321  $numTerms = count($form->getItemByPostVar('terms')->getValues());
322  $numDefinitions = count($form->getItemByPostVar('definitions')->getValues());
323 
324  if ($numTerms >= $numDefinitions) {
325  return true;
326  }
327 
328  return false;
329  }
getItemByPostVar(string $a_post_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateAnswerSpecificFormPart()

assMatchingQuestionGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

References ilPropertyFormGUI\addItem(), isDefImgUploadCommand(), isTermImgUploadCommand(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilMatchingWizardInputGUI\setHideImages(), and ilFormPropertyGUI\setRequired().

Referenced by editQuestion().

332  {
333  // Definitions
334  include_once "./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
335  $definitions = new ilMatchingWizardInputGUI($this->lng->txt("definitions"), "definitions");
336  if ($this->object->getSelfAssessmentEditingMode()) {
337  $definitions->setHideImages(true);
338  }
339 
340  $stripHtmlEntitesFromValues = function (assAnswerMatchingTerm $value) {
341  return $value->withText(html_entity_decode($value->getText()));
342  };
343 
344  $definitions->setRequired(true);
345  $definitions->setQuestionObject($this->object);
346  $definitions->setTextName($this->lng->txt('definition_text'));
347  $definitions->setImageName($this->lng->txt('definition_image'));
348  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
349  if (!count($this->object->getDefinitions())) {
350  $this->object->addDefinition(new assAnswerMatchingDefinition());
351  }
352  $definitionvalues = array_map($stripHtmlEntitesFromValues, $this->object->getDefinitions());
353  $definitions->setValues($definitionvalues);
354  if ($this->isDefImgUploadCommand()) {
355  $definitions->checkInput();
356  }
357  $form->addItem($definitions);
358 
359  // Terms
360  include_once "./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
361  $terms = new ilMatchingWizardInputGUI($this->lng->txt("terms"), "terms");
362  if ($this->object->getSelfAssessmentEditingMode()) {
363  $terms->setHideImages(true);
364  }
365  $terms->setRequired(true);
366  $terms->setQuestionObject($this->object);
367  $terms->setTextName($this->lng->txt('term_text'));
368  $terms->setImageName($this->lng->txt('term_image'));
369  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
370  if (0 === count($this->object->getTerms())) {
371  // @PHP8-CR: If you look above, how $this->object->addDefinition does in fact take an object, I take this
372  // issue as an indicator for a bigger issue and won't suppress / "quickfix" this but postpone further
373  // analysis, eventually involving T&A TechSquad
374  $this->object->addTerm(new assAnswerMatchingTerm());
375  }
376  $termvalues = array_map($stripHtmlEntitesFromValues, $this->object->getTerms());
377  $terms->setValues($termvalues);
378  if ($this->isTermImgUploadCommand()) {
379  $terms->checkInput();
380  }
381  $form->addItem($terms);
382 
383  // Matching Pairs
384  include_once "./Modules/TestQuestionPool/classes/class.ilMatchingPairWizardInputGUI.php";
385  $pairs = new ilMatchingPairWizardInputGUI($this->lng->txt('matching_pairs'), 'pairs');
386  $pairs->setRequired(true);
387  $pairs->setTerms($this->object->getTerms());
388  $pairs->setDefinitions($this->object->getDefinitions());
389  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
390  if (count($this->object->getMatchingPairs()) == 0) {
391  $this->object->addMatchingPair($termvalues[0], $definitionvalues[0], 0);
392  //$this->object->addMatchingPair(new assAnswerMatchingPair($termvalues[0], $definitionvalues[0], 0));
393  }
394  $pairs->setPairs($this->object->getMatchingPairs());
395  $form->addItem($pairs);
396 
397  return $form;
398  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHideImages($a_hide)
Set hide images.
setRequired(bool $a_required)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

assMatchingQuestionGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Definition at line 1155 of file class.assMatchingQuestionGUI.php.

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

1155  : void
1156  {
1157  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssMatchingPairCorrectionsInputGUI.php';
1158  $pairs = new ilAssMatchingPairCorrectionsInputGUI($this->lng->txt('matching_pairs'), 'pairs');
1159  $pairs->setRequired(true);
1160  $pairs->setTerms($this->object->getTerms());
1161  $pairs->setDefinitions($this->object->getDefinitions());
1162  $pairs->setPairs($this->object->getMatchingPairs());
1163  $pairs->setThumbsWebPathWithPrefix($this->object->getImagePathWeb() . $this->object->getThumbPrefix());
1164  $form->addItem($pairs);
1165  }
setRequired(bool $a_required)
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assMatchingQuestionGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 400 of file class.assMatchingQuestionGUI.php.

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), assMatchingQuestion\MATCHING_MODE_1_ON_1, assMatchingQuestion\MATCHING_MODE_N_ON_N, ILIAS\Repository\object(), ilFormPropertyGUI\setRequired(), ilNumberInputGUI\setValue(), and ilRadioOption\setValue().

Referenced by editQuestion().

401  {
402  // Edit mode
403  $hidden = new ilHiddenInputGUI("matching_type");
404  $hidden->setValue('');
405  $form->addItem($hidden);
406 
407  if (!$this->object->getSelfAssessmentEditingMode()) {
408  // shuffle
409  $shuffle = new ilSelectInputGUI($this->lng->txt("shuffle_answers"), "shuffle");
410  $shuffle_options = array(
411  0 => $this->lng->txt("no"),
412  1 => $this->lng->txt("matching_shuffle_terms_definitions"),
413  2 => $this->lng->txt("matching_shuffle_terms"),
414  3 => $this->lng->txt("matching_shuffle_definitions")
415  );
416  $shuffle->setOptions($shuffle_options);
417  $shuffle->setValue($this->object->getShuffleMode());
418  $shuffle->setRequired(false);
419  $form->addItem($shuffle);
420 
421  $geometry = new ilNumberInputGUI($this->lng->txt('thumb_size'), 'thumb_geometry');
422  $geometry->setValue($this->object->getThumbGeometry());
423  $geometry->setRequired(true);
424  $geometry->setMaxLength(6);
425  $geometry->setMinValue($this->object->getMinimumThumbSize());
426  $geometry->setMaxValue($this->object->getMaximumThumbSize());
427  $geometry->setSize(6);
428  $geometry->setInfo($this->lng->txt('thumb_size_info'));
429  $form->addItem($geometry);
430  }
431 
432  // Matching Mode
433  $mode = new ilRadioGroupInputGUI($this->lng->txt('qpl_qst_inp_matching_mode'), 'matching_mode');
434  $mode->setRequired(true);
435 
436  $modeONEonONE = new ilRadioOption(
437  $this->lng->txt('qpl_qst_inp_matching_mode_one_on_one'),
439  );
440  $mode->addOption($modeONEonONE);
441 
442  $modeALLonALL = new ilRadioOption(
443  $this->lng->txt('qpl_qst_inp_matching_mode_all_on_all'),
445  );
446  $mode->addOption($modeALLonALL);
447 
448  $mode->setValue($this->object->getMatchingMode());
449 
450  $form->addItem($mode);
451  return $form;
452  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
This class represents a number property in a property form.
setValue(?string $a_value)
setValue(string $a_value)
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removedefinitions()

assMatchingQuestionGUI::removedefinitions ( )

Definition at line 229 of file class.assMatchingQuestionGUI.php.

References editQuestion(), and writePostData().

229  : void
230  {
231  $this->writePostData(true);
232  $position = key($_POST["cmd"]["removedefinitions"]);
233  $this->object->deleteDefinition($position);
234  $this->editQuestion();
235  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ removeimagedefinitions()

assMatchingQuestionGUI::removeimagedefinitions ( )

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

References editQuestion(), and writePostData().

197  : void
198  {
199  $this->writePostData(true);
200  $position = key($_POST['cmd']['removeimagedefinitions']);
201  $this->object->removeDefinitionImage($position);
202  $this->editQuestion();
203  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ removeimageterms()

assMatchingQuestionGUI::removeimageterms ( )

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

References editQuestion(), and writePostData().

183  : void
184  {
185  $this->writePostData(true);
186  $position = key($_POST['cmd']['removeimageterms']);
187  $this->object->removeTermImage($position);
188  $this->editQuestion();
189  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ removepairs()

assMatchingQuestionGUI::removepairs ( )

Definition at line 245 of file class.assMatchingQuestionGUI.php.

References editQuestion(), and writePostData().

245  : void
246  {
247  $this->writePostData(true);
248  $position = key($_POST["cmd"]["removepairs"]);
249  $this->object->deleteMatchingPair($position);
250  $this->editQuestion();
251  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ removeterms()

assMatchingQuestionGUI::removeterms ( )

Definition at line 213 of file class.assMatchingQuestionGUI.php.

References editQuestion(), and writePostData().

213  : void
214  {
215  $this->writePostData(true);
216  $position = key($_POST["cmd"]["removeterms"]);
217  $this->object->deleteTerm($position);
218  $this->editQuestion();
219  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ saveCorrectionsFormProperties()

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

Definition at line 1170 of file class.assMatchingQuestionGUI.php.

References $id.

1170  : void
1171  {
1172  $pairs = $this->object->getMatchingPairs();
1173  $nu_pairs = [];
1174 
1175  if ($this->request->isset('pairs')) {
1176  $points_of_pairs = $this->request->raw('pairs')['points'];
1177  $pair_terms = explode(',', $this->request->raw('pairs')['term_id']);
1178  $pair_definitions = explode(',', $this->request->raw('pairs')['definition_id']);
1179  $values = [];
1180  foreach ($points_of_pairs as $idx => $points) {
1181  $k = implode('.', [$pair_terms[$idx],$pair_definitions[$idx]]);
1182  $values[$k] = (float) str_replace(',', '.', $points);
1183  }
1184 
1185  foreach ($pairs as $idx => $pair) {
1186  $id = implode('.', [
1187  $pair->getTerm()->getIdentifier(),
1188  $pair->getDefinition()->getIdentifier()
1189  ]);
1190  $nu_pairs[$id] = $pair->withPoints($values[$id]);
1191  }
1192 
1193  $this->object = $this->object->withMatchingPairs($nu_pairs);
1194  }
1195  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ uploaddefinitions()

assMatchingQuestionGUI::uploaddefinitions ( )

Definition at line 191 of file class.assMatchingQuestionGUI.php.

References editQuestion(), and writePostData().

191  : void
192  {
193  $this->writePostData(true);
194  $this->editQuestion();
195  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ uploadterms()

assMatchingQuestionGUI::uploadterms ( )

Definition at line 177 of file class.assMatchingQuestionGUI.php.

References editQuestion(), and writePostData().

177  : void
178  {
179  $this->writePostData(true);
180  $this->editQuestion();
181  }
writePostData(bool $always=false)
{}
+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

assMatchingQuestionGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

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

Implements ilGuiAnswerScoringAdjustable.

Definition at line 72 of file class.assMatchingQuestionGUI.php.

References $filename, $index, $name, ILIAS\Repository\object(), and ilUtil\stripSlashes().

Referenced by writePostData().

72  : void
73  {
74  // Delete all existing answers and create new answers from the form data
75  $this->object->flushMatchingPairs();
76  $this->object->flushTerms();
77  $this->object->flushDefinitions();
78 
79  $uploads = $this->request->getProcessedUploads();
80  $allowed_mime_types = ['image/jpeg', 'image/png', 'image/gif'];
81 
82  if ($this->request->isset('terms')) {
83  $answers = $this->request->raw('terms')['answer'] ?? [];
84  $terms_image_names = $this->request->raw('terms')['imagename'] ?? [];
85  $terms_identifiers = $this->request->raw('terms')['identifier'] ?? [];
86 
87  foreach ($answers as $index => $answer) {
88  $filename = $terms_image_names[$index] ?? '';
89 
90  $upload_tmp_name = $this->request->getUploadFilename(['terms', 'image'], $index);
91 
92  if (isset($uploads[$upload_tmp_name]) && $uploads[$upload_tmp_name]->isOk() &&
93  in_array($uploads[$upload_tmp_name]->getMimeType(), $allowed_mime_types)) {
94  $filename = '';
95  $name = $uploads[$upload_tmp_name]->getName();
96  if ($this->object->setImageFile(
97  $uploads[$upload_tmp_name]->getPath(),
98  $this->object->getEncryptedFilename($name)
99  )) {
100  $filename = $this->object->getEncryptedFilename($name);
101  }
102  }
103  // @PHP8-CR: There seems to be a bigger issue lingering here and won't suppress / "quickfix" this but
104  // postpone further analysis, eventually involving T&A TechSquad (see also remark in assMatchingQuestionGUI
105  $this->object->addTerm(
107  ilUtil::stripSlashes(htmlentities($answer)),
108  $filename,
109  $terms_identifiers[$index] ?? ''
110  )
111  );
112  }
113  }
114 
115  if ($this->request->isset('definitions')) {
116  $answers = $this->request->raw('definitions')['answer'] ?? [];
117  $definitions_image_names = $this->request->raw('definitions')['imagename'] ?? [];
118  $definitions_identifiers = $this->request->raw('definitions')['identifier'] ?? [];
119 
120  foreach ($answers as $index => $answer) {
121  $filename = $definitions_image_names[$index] ?? '';
122 
123  $upload_tmp_name = $this->request->getUploadFilename(['definitions', 'image'], $index);
124 
125  if (isset($uploads[$upload_tmp_name]) && $uploads[$upload_tmp_name]->isOk() &&
126  in_array($uploads[$upload_tmp_name]->getMimeType(), $allowed_mime_types)) {
127  $filename = '';
128  $name = $uploads[$upload_tmp_name]->getName();
129  if ($this->object->setImageFile(
130  $uploads[$upload_tmp_name]->getPath(),
131  $this->object->getEncryptedFilename($name)
132  )) {
133  $filename = $this->object->getEncryptedFilename($name);
134  }
135  }
136 
137  $this->object->addDefinition(
139  ilUtil::stripSlashes(htmlentities($answer)),
140  $filename,
141  $definitions_identifiers[$index] ?? ''
142  )
143  );
144  }
145  }
146 
147  if ($this->request->isset('pairs')) {
148  $points_of_pairs = $this->request->raw('pairs')['points'] ?? [];
149  $pair_terms = $this->request->raw('pairs')['term'] ?? [];
150  $pair_definitions = $this->request->raw('pairs')['definition'] ?? [];
151 
152  foreach ($points_of_pairs as $index => $points) {
153  $term_id = $pair_terms[$index] ?? 0;
154  $definition_id = $pair_definitions[$index] ?? 0;
155  $this->object->addMatchingPair(
156  $this->object->getTermWithIdentifier($term_id),
157  $this->object->getDefinitionWithIdentifier($definition_id),
158  (float) str_replace(',', '.', $points)
159  );
160  }
161  }
162  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
$index
Definition: metadata.php:145
if($format !==null) $name
Definition: metadata.php:247
$filename
Definition: buildRTE.php:78
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writePostData()

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

{}

Definition at line 58 of file class.assMatchingQuestionGUI.php.

References editQuestion(), assQuestionGUI\saveTaxonomyAssignments(), writeAnswerSpecificPostData(), assQuestionGUI\writeQuestionGenericPostData(), and writeQuestionSpecificPostData().

Referenced by adddefinitions(), addpairs(), addterms(), removedefinitions(), removeimagedefinitions(), removeimageterms(), removepairs(), removeterms(), uploaddefinitions(), and uploadterms().

58  : int
59  {
60  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
61  if (!$hasErrors) {
62  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
66  $this->saveTaxonomyAssignments();
67  return 0;
68  }
69  return 1;
70  }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeQuestionSpecificPostData()

assMatchingQuestionGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

Implements ilGuiQuestionScoringAdjustable.

Definition at line 164 of file class.assMatchingQuestionGUI.php.

References ILIAS\Repository\object().

Referenced by writePostData().

164  : void
165  {
166  if (!$this->object->getSelfAssessmentEditingMode()) {
167  $this->object->setShuffle($_POST["shuffle"] ?? '0');
168  $this->object->setShuffleMode($_POST["shuffle"] ?? '0');
169  } else {
170  $this->object->setShuffle(1);
171  $this->object->setShuffleMode(1);
172  }
173  $this->object->setThumbGeometry($_POST["thumb_geometry"] ?? 0);
174  $this->object->setMatchingMode($_POST['matching_mode']);
175  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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