ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
assOrderingHorizontalGUI 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 assOrderingHorizontalGUI:
+ Collaboration diagram for assOrderingHorizontalGUI:

Public Member Functions

 __construct ($id=-1)
 assOrderingHorizontalGUI constructor More...
 
 getCommand ($cmd)
 
 editQuestion (bool $checkonly=false, ?bool $is_save_cmd=null)
 
 getSolutionOutput (int $active_id, ?int $pass=null, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_inline_feedback=true)
 
 renderSolutionOutput (mixed $user_solutions, int $active_id, ?int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
 
 getPreview (bool $show_question_only=false, bool $show_inline_feedback=false)
 
 getTestOutput (int $active_id, int $pass, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 getSpecificFeedbackOutput (array $userSolution)
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from the request and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 editQuestion (bool $checkonly=false, ?bool $is_save_cmd=null)
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 getSolutionOutput (int $active_id, ?int $pass=null, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_inline_feedback=true)
 
 getPreview (bool $show_question_only=false, bool $show_inline_feedback=false)
 
 getTestOutput (int $active_id, int $pass, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 renderSolutionOutput (mixed $user_solutions, int $active_id, ?int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
 
 getObject ()
 
 setObject (assQuestion $question)
 
 setCopyToExistingPoolOnSave (?int $pool_ref_id)
 
 getCopyToExistingPoolOnSave ()
 
 setCopyToNewPoolOnSave (?string $pool_title)
 
 getCopyToNewPoolOnSave ()
 
 setMoveAfterQuestionId (?int $question_id)
 
 getMoveAfterQuestionId ()
 
 hasInlineFeedback ()
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getCommentsPanelHTML ()
 
 executeCommand ()
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext (string $presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled (bool $previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose (string $renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext (string $editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI (?ilTestQuestionNavigationGUI $navigationGUI)
 
 setTaxonomyIds (array $taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass (string $targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder (\ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd (string $questionActionCmd)
 
 getQuestionActionCmd ()
 
 assessment ()
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 
 getILIASPage (string $html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 
 syncQuestion ()
 
 saveReturn ()
 
 saveQuestion ()
 
 setAdditionalContentEditingModeFromPost ()
 
 getContextPath ($cont_obj, int $a_endnode_id, int $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber (int $nr)
 
 getSequenceNumber ()
 
 setQuestionCount (int $a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage (string $errormessage)
 
 addErrorMessage (string $errormessage)
 
 getQuestionType ()
 
 getAsValueAttribute (string $a_value)
 
 addQuestionFormCommandButtons (ilPropertyFormGUI $form)
 
 addBasicQuestionFormProperties (ilPropertyFormGUI $form)
 
 getGenericFeedbackOutput (int $active_id, ?int $pass)
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 outQuestionType ()
 
 saveSuggestedSolution ()
 
 cancelSuggestedSolution ()
 
 suggestedsolution (bool $save=false)
 
 outSolutionExplorer ()
 
 saveSuggestedSolutionType ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, string $classname)
 
 getEditQuestionTabCommands ()
 
 isAutosaveable ()
 
 outQuestionForTest (string $formaction, int $active_id, ?int $pass, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getFormEncodingType ()
 
 setPreviewSession (ilAssQuestionPreviewSession $preview_session)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFrequencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 isInLearningModuleContext ()
 
 setInLearningModuleContext (bool $flag)
 
 cmdNeedsExistingQuestion (string $cmd)
 
 setContextAllowsSyncToPool (bool $sync_allowed)
 
 needsSyncQuery ()
 
 getQuestionSyncModal (string $cmd, string $cmd_class='')
 
 getAutoSavedSolutionOutput (int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 

Protected Member Functions

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

Private Member Functions

 initializePlayerJS ()
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI (string $question_type='', int $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui. More...
 
static getCommandsFromClassConstants (string $guiClassName, string $cmdConstantNameBegin='CMD_')
 
static prepareTextareaOutput (?string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output where latex code may be in it If the text is HTML-free, CHR(13) will be converted to a line break. More...
 
- Data Fields inherited from assQuestionGUI
const ALLOWED_PLAIN_TEXT_TAGS = "<em>, <strong>"
 sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI. More...
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const CORRECTNESS_NOT_OK = 0
 
const CORRECTNESS_MOSTLY_OK = 1
 
const CORRECTNESS_OK = 2
 
const RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const CMD_SYNC_QUESTION_AND_RETURN = 'syncQuestionReturn'
 
- Protected Attributes inherited from assQuestionGUI
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
const SUGGESTED_SOLUTION_COMMANDS_CANCEL = 'cancelSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_SAVE = 'saveSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_DEFAULT = 'suggestedsolution'
 
const QUESTION_SAVE_CMDS
 
const ADDITIONAL_CMDS_NEEDING_EXISTING_QST
 There are functions that need an existing question. More...
 
ilLogger $logger
 
GeneralQuestionPropertiesRepository $questionrepository
 
GUIService $notes_gui
 
ilCtrl $ctrl
 
assQuestion $object
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
Refinery $refinery
 
 $error
 
string $errormessage
 
int $sequence_no
 sequence number in test More...
 
int $question_count
 question count in test More...
 
ilPropertyFormGUI $editForm = null
 
readonly ilTestLegacyFormsHelper $forms_helper
 
readonly RequestDataCollector $request_data_collector
 
bool $parent_type_is_lm = false
 
SuggestedSolutionsDatabaseRepository $suggestedsolution_repo = null
 

Detailed Description

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

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

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning The assOrderingHorizontalGUI class encapsulates the GUI representation for horizontal 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
Version
$Id$

\

assOrderingHorizontalGUI: ilObjQuestionPoolGUI assOrderingHorizontalGUI: ilPropertyFormGUI, ilFormPropertyDispatchGUI

Definition at line 33 of file class.assOrderingHorizontalGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assOrderingHorizontalGUI::__construct (   $id = -1)

assOrderingHorizontalGUI constructor

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

Parameters
integer$idThe database id of a single choice question object public

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

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

44  {
46  $this->object = new assOrderingHorizontal();
47  $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
48  if ($id >= 0) {
49  $this->object->loadFromDb($id);
50  }
51  }
Class for horizontal ordering questions.
setErrorMessage(string $errormessage)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ editQuestion()

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

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

References assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), ILIAS\Repository\ctrl(), assQuestionGUI\isSaveCommand(), assQuestionGUI\outQuestionType(), populateQuestionSpecificFormPart(), assQuestionGUI\populateTaxonomyFormSection(), and assQuestionGUI\renderEditForm().

Referenced by writePostData().

76  : bool {
77  $save = $is_save_cmd ?? $this->isSaveCommand();
78 
79  $form = new ilPropertyFormGUI();
80  $this->editForm = $form;
81 
82  $form->setFormAction($this->ctrl->getFormAction($this));
83  $form->setTitle($this->outQuestionType());
84  $form->setMultipart(false);
85  $form->setTableWidth("100%");
86  $form->setId("orderinghorizontal");
87 
88  $this->addBasicQuestionFormProperties($form);
90 
91 
92  $this->populateTaxonomyFormSection($form);
93 
94  $this->addQuestionFormCommandButtons($form);
95 
96  $errors = false;
97 
98  if ($save) {
99  $form->setValuesByPost();
100  $errors = !$form->checkInput();
101  $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
102  if ($errors) {
103  $checkonly = false;
104  }
105  }
106 
107  if (!$checkonly) {
108  $this->renderEditForm($form);
109  }
110  return $errors;
111  }
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
renderEditForm(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionQuestionPostVars()

assOrderingHorizontalGUI::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 334 of file class.assOrderingHorizontalGUI.php.

334  : array
335  {
336  return [];
337  }

◆ getAnswersFrequency()

assOrderingHorizontalGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Definition at line 376 of file class.assOrderingHorizontalGUI.php.

References ILIAS\Repository\object().

376  : array
377  {
378  $answers = [];
379 
380  foreach ($relevantAnswers as $ans) {
381  $md5 = md5($ans['value1']);
382 
383  if (!isset($answers[$md5])) {
384  $answer = str_replace(
385  $this->object->getAnswerSeparator(),
386  '&nbsp;&nbsp;-&nbsp;&nbsp;',
387  $ans['value1']
388  );
389 
390  $answers[$md5] = [
391  'answer' => $answer, 'frequency' => 0
392  ];
393  }
394 
395  $answers[$md5]['frequency']++;
396  }
397 
398  return $answers;
399  }
+ Here is the call graph for this function:

◆ getCommand()

assOrderingHorizontalGUI::getCommand (   $cmd)

Definition at line 53 of file class.assOrderingHorizontalGUI.php.

54  {
55  return $cmd;
56  }

◆ getPreview()

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

Definition at line 241 of file class.assOrderingHorizontalGUI.php.

References $id, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), initializePlayerJS(), null, ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareFormOutput().

244  : string {
245  $template = new ilTemplate('tpl.il_as_qpl_orderinghorizontal_output.html', true, true, 'components/ILIAS/TestQuestionPool');
246  $this->initializePlayerJS();
247 
248  if ($this->getPreviewSession() !== null
249  && $this->getPreviewSession()->getParticipantsSolution() !== null) {
250  $elements = $this->object->splitAndTrimOrderElementText(
251  (string) $this->getPreviewSession()->getParticipantsSolution(),
252  $this->object->getAnswerSeparator()
253  );
254  } else {
255  $elements = $this->object->getRandomOrderingElements();
256  }
257 
258  foreach ($elements as $id => $element) {
259  $template->setCurrentBlock('element');
260  $template->setVariable('ELEMENT_ID', "e_{$this->object->getId()}_{$id}");
261  $template->setVariable('ELEMENT_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($element));
262  $template->parseCurrentBlock();
263  }
264  $template->setVariable('QUESTION_ID', $this->object->getId());
265  $template->setVariable('VALUE_ORDERRESULT', ' value="' . join('{::}', $elements) . '"');
266  if ($this->object->getTextSize() >= 10) {
267  $template->setVariable('STYLE', ' style="font-size: ' . $this->object->getTextSize() . '%;"');
268  }
269  $template->setVariable('QUESTIONTEXT', $this->object->getQuestionForHTMLOutput());
270  if ($show_question_only) {
271  return $template->get();
272  }
273  return $this->getILIASPage($template->get());
274  }
static prepareFormOutput($a_str, bool $a_strip=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getSolutionOutput()

assOrderingHorizontalGUI::getSolutionOutput ( int  $active_id,
?int  $pass = null,
bool  $graphical_output = false,
bool  $result_output = false,
bool  $show_question_only = true,
bool  $show_feedback = false,
bool  $show_correct_solution = false,
bool  $show_manual_scoring = false,
bool  $show_question_text = true,
bool  $show_inline_feedback = true 
)

Definition at line 113 of file class.assOrderingHorizontalGUI.php.

References renderSolutionOutput().

124  : string {
125  $user_solutions = [];
126  if (($active_id > 0) && (!$show_correct_solution)) {
127  $user_solutions = $this->object->getSolutionValues($active_id, $pass);
128  }
129 
130  return $this->renderSolutionOutput(
131  $user_solutions,
132  $active_id,
133  $pass,
134  $graphical_output,
135  $result_output,
136  $show_question_only,
137  $show_feedback,
138  $show_correct_solution,
139  $show_manual_scoring,
140  $show_question_text,
141  false,
142  $show_inline_feedback,
143  );
144  }
renderSolutionOutput(mixed $user_solutions, int $active_id, ?int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assOrderingHorizontalGUI::getSpecificFeedbackOutput ( array  $userSolution)

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

313  : string
314  {
315  return '';
316  }

◆ getTestOutput()

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

Definition at line 276 of file class.assOrderingHorizontalGUI.php.

References $id, ilSession\clear(), initializePlayerJS(), ILIAS\Repository\object(), assQuestionGUI\outQuestionPage(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilSession\set().

282  : string {
283  $template = new ilTemplate('tpl.il_as_qpl_orderinghorizontal_output.html', true, true, 'components/ILIAS/TestQuestionPool');
284  $this->initializePlayerJS();
285 
286  $elements = $this->object->getRandomOrderingElements();
287  if ($active_id) {
288  $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
289  if (count($solutions) == 1) {
290  $elements = explode('{::}', $solutions[0]['value1']);
291  }
292  }
293  if (!is_array($solutions) || count($solutions) == 0) {
294  ilSession::set('qst_ordering_horizontal_elements', $elements);
295  } else {
296  ilSession::clear('qst_ordering_horizontal_elements');
297  }
298  foreach ($elements as $id => $element) {
299  $template->setCurrentBlock('element');
300  $template->setVariable('ELEMENT_ID', "e_{$this->object->getId()}_{$id}");
301  $template->setVariable('ELEMENT_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($element));
302  $template->parseCurrentBlock();
303  }
304  $template->setVariable('QUESTION_ID', $this->object->getId());
305  if ($this->object->getTextSize() >= 10) {
306  $template->setVariable('STYLE', ' style="font-size: ' . $this->object->getTextSize() . '%;"');
307  }
308  $template->setVariable('VALUE_ORDERRESULT', ' value="' . join('{::}', $elements) . '"');
309  $template->setVariable('QUESTIONTEXT', $this->object->getQuestionForHTMLOutput());
310  return $this->outQuestionPage("", $is_question_postponed, $active_id, $template->get());
311  }
static prepareFormOutput($a_str, bool $a_strip=false)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:

◆ initializePlayerJS()

assOrderingHorizontalGUI::initializePlayerJS ( )
private

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

Referenced by getPreview(), and getTestOutput().

420  : void
421  {
422  $this->tpl->addJavascript('assets/js/orderinghorizontal.js');
423  $this->tpl->addOnLoadCode(
424  "il.test.orderinghorizontal.init(document.querySelector('#horizontal_{$this->object->getId()}'));"
425  );
426  }
+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

assOrderingHorizontalGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

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

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

401  : void
402  {
403  // points
404  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
405 
406  $points->allowDecimals(true);
407  $points->setValue($this->object->getPoints());
408  $points->setRequired(true);
409  $points->setSize(3);
410  $points->setMinValue(0.0);
411  $points->setMinvalueShouldBeGreater(true);
412  $form->addItem($points);
413  }
allowDecimals(bool $a_value)
This class represents a number property in a property form.
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingHorizontalGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 339 of file class.assOrderingHorizontalGUI.php.

References ilPropertyFormGUI\addItem(), ilNumberInputGUI\allowDecimals(), ILIAS\Repository\lng(), null, ILIAS\Repository\object(), ilNumberInputGUI\setValue(), and ilTextAreaInputGUI\setValue().

Referenced by editQuestion().

340  {
341  // ordertext
342  $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext");
343  $ordertext->setValue((string) self::prepareTextareaOutput($this->object->getOrderText(), false, true));
344  $ordertext->setRequired(true);
345  $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->getSeparator()));
346  $ordertext->setRows(10);
347  $ordertext->setCols(80);
348  $form->addItem($ordertext);
349  // textsize
350  $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
351  $textsize->setValue($this->object->getTextSize());
352  $textsize->setInfo($this->lng->txt("textsize_info"));
353  $textsize->setSize(6);
354  $textsize->setMinValue(10);
355  $textsize->setRequired(false);
356  $form->addItem($textsize);
357  // points
358  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
359 
360  $points->allowDecimals(true);
361  // mbecker: Fix for mantis bug 7866: Predefined values schould make sense.
362  // This implements a default value of "1" for this question type.
363  if ($this->object->getPoints() == null) {
364  $points->setValue("1");
365  } else {
366  $points->setValue($this->object->getPoints());
367  }
368  $points->setRequired(true);
369  $points->setSize(3);
370  $points->setMinValue(0.0);
371  $points->setMinvalueShouldBeGreater(true);
372  $form->addItem($points);
373  return $form;
374  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
allowDecimals(bool $a_value)
This class represents a number property in a property form.
setValue(?string $a_value)
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSolutionOutput()

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

Definition at line 146 of file class.assOrderingHorizontalGUI.php.

References $id, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\generateCorrectnessIconsForCorrectness(), assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), ILIAS\Repository\lng(), null, ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

Referenced by getSolutionOutput().

159  : ?string {
160  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output_solution.html", true, true, "components/ILIAS/TestQuestionPool");
161 
162  $elements = [];
163  if (count($user_solutions) && strlen($user_solutions[0]["value1"])) {
164  $elements = explode("{::}", $user_solutions[0]["value1"]);
165  }
166 
167  if (!count($elements)) {
168  $elements = $show_correct_solution ? $this->object->getOrderingElements() : $this->object->getRandomOrderingElements();
169  }
170 
171  foreach ($elements as $id => $element) {
172  $template->setCurrentBlock("element");
173  $template->setVariable("ELEMENT_ID", "sol_e_" . $this->object->getId() . "_$id");
174  $template->setVariable("ELEMENT_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($element));
175  $template->parseCurrentBlock();
176  }
177 
178  if (($active_id > 0) && (!$show_correct_solution)) {
179  if ($this->object->getStep() === null) {
180  $reached_points = $this->object->getReachedPoints($active_id, $pass);
181  } else {
182  $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
183  }
184  if ($graphical_output) {
185  $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_NOT_OK);
186  if ($reached_points == $this->object->getMaximumPoints()) {
187  $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_OK);
188  } elseif ($reached_points > 0) {
189  $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_MOSTLY_OK);
190  }
191  $template->setCurrentBlock("icon_ok");
192  $template->setVariable("ICON_OK", $correctness_icon);
193  $template->parseCurrentBlock();
194  }
195  } else {
196  $reached_points = $this->object->getPoints();
197  }
198 
199  if ($result_output) {
200  $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
201  $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
202  }
203  if ($show_question_text == true) {
204  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
205  }
206  // $template->setVariable("SOLUTION_TEXT", ilUtil::prepareFormOutput($solutionvalue));
207  if ($this->object->getTextSize() >= 10) {
208  $template->setVariable("STYLE", " style=\"font-size: " . $this->object->getTextSize() . "%;\"");
209  }
210 
211  $questionoutput = $template->get();
212  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "components/ILIAS/TestQuestionPool");
213  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
214 
215 
216  $feedback = '';
217  if ($show_feedback) {
218  if (!$this->isTestPresentationContext()) {
219  $fb = $this->getGenericFeedbackOutput((int) $active_id, $pass);
220  $feedback .= strlen($fb) ? $fb : '';
221  }
222  }
223  if (strlen($feedback)) {
224  $cssClass = (
225  $this->hasCorrectSolution($active_id, $pass) ?
227  );
228 
229  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
230  $solutiontemplate->setVariable("FEEDBACK", ilLegacyFormElementsUtil::prepareTextareaOutput($feedback, true));
231  }
232  $solutionoutput = $solutiontemplate->get();
233  if (!$show_question_only) {
234  // get page object output
235  $solutionoutput = $this->getILIASPage($solutionoutput);
236  }
237  return $solutionoutput;
238  }
hasCorrectSolution($activeId, $passIndex)
generateCorrectnessIconsForCorrectness(int $correctness)
static prepareFormOutput($a_str, bool $a_strip=false)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
getGenericFeedbackOutput(int $active_id, ?int $pass)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

assOrderingHorizontalGUI::saveCorrectionsFormProperties ( ilPropertyFormGUI  $form)

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

References ilPropertyFormGUI\getInput().

415  : void
416  {
417  $this->object->setPoints((float) str_replace(',', '.', $form->getInput('points')));
418  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
+ Here is the call graph for this function:

◆ writePostData()

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

{}

Definition at line 61 of file class.assOrderingHorizontalGUI.php.

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

61  : int
62  {
63  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
64  if (!$hasErrors) {
67  $this->saveTaxonomyAssignments();
68  return 0;
69  }
70  return 1;
71  }
editQuestion(bool $checkonly=false, ?bool $is_save_cmd=null)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from the request and applies them to the data object...
+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assOrderingHorizontalGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

Implements ilGuiQuestionScoringAdjustable.

Definition at line 318 of file class.assOrderingHorizontalGUI.php.

Referenced by writePostData().

318  : void
319  {
320  $this->object->setTextSize($this->request_data_collector->float('textsize'));
321  $this->object->setOrderText($this->request_data_collector->raw('ordertext'));
322  $this->object->setPoints($this->request_data_collector->float('points'));
323  }
+ Here is the caller graph for this function:

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