ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 Returns the answer specific feedback for the question. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from the request and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 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 ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFrequencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 isInLearningModuleContext ()
 
 setInLearningModuleContext (bool $flag)
 
 cmdNeedsExistingQuestion (string $cmd)
 
 setContextAllowsSyncToPool (bool $sync_allowed)
 
 needsSyncQuery ()
 
 getQuestionSyncModal (string $cmd, string $cmd_class='')
 
 getAutoSavedSolutionOutput (int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false)
 
 buildFileDownloadLink ()
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from the request and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 

Protected Member Functions

 writePostData (bool $always=false)
 {Evaluates a posted edit form and writes the form data in the question object.
Returns
integer A positive value, if one of the required fields wasn't set, else 0
} More...
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 writePostData (bool $always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm (ilPropertyFormGUI $form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 setTestSpecificProperties ()
 
 addNumberOfTriesToFormIfNecessary (ilPropertyFormGUI $form)
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 genericFeedbackOutputBuilder (int $active_id, ?int $pass)
 
 getTypeOptions ()
 
 createSuggestedSolutionLinkingTo (string $type, string $target)
 
 setDefaultTabs (ilTabsGUI $tabs_gui)
 
 setQuestionSpecificTabs (ilTabsGUI $tabs_gui)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 
 addTab_Question (ilTabsGUI $tabs_gui)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction (string $form_action, int $active_id, int $pass)
 
 addBackTab (ilTabsGUI $tabs_gui)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 generateCorrectnessIconsForCorrectness (int $correctness)
 
 renderLatex ($content)
 Wrap content with latex in a LatexContent UI component and render it to be processed by MathJax in the browser. More...
 
 getSuggestedSolutionsRepo ()
 
 cleanupAnswerText (array $answer_text, bool $is_rte)
 sk - 12.05.2023: This is one more of those that we need, but don't want. More...
 
 addSaveOnEnterOnLoadCode ()
 
 resetSavedPreviewSession ()
 

Private Member Functions

 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$

\

@ilctrl_iscalledby assOrderingHorizontalGUI: ilObjQuestionPoolGUI @ilCtrl_Calls 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 @access public

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

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 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class for horizontal ordering questions.
setErrorMessage(string $errormessage)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ editQuestion()

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

Reimplemented from assQuestionGUI.

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

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
90
91
92 $this->populateTaxonomyFormSection($form);
93
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 }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
renderEditForm(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
This class represents a property form user interface.

Referenced by writePostData().

+ 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 336 of file class.assOrderingHorizontalGUI.php.

336 : array
337 {
338 return [];
339 }

◆ getAnswersFrequency()

assOrderingHorizontalGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

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

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

References ILIAS\Repository\object().

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

Reimplemented from assQuestionGUI.

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

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->renderLatex(
270 $this->object->getQuestionForHTMLOutput()
271 ));
272 if ($show_question_only) {
273 return $template->get();
274 }
275 return $this->getILIASPage($template->get());
276 }
renderLatex($content)
Wrap content with latex in a LatexContent UI component and render it to be processed by MathJax in th...
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR

◆ 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 
)

Reimplemented from assQuestionGUI.

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

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,)

◆ getSpecificFeedbackOutput()

assOrderingHorizontalGUI::getSpecificFeedbackOutput ( array  $userSolution)

Returns the answer specific feedback for the question.

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

Reimplemented from assQuestionGUI.

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

315 : string
316 {
317 return '';
318 }

◆ 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 
)

Reimplemented from assQuestionGUI.

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

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

◆ initializePlayerJS()

assOrderingHorizontalGUI::initializePlayerJS ( )
private

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

422 : void
423 {
424 $this->tpl->addJavascript('assets/js/orderinghorizontal.js');
425 $this->tpl->addOnLoadCode(
426 "il.test.orderinghorizontal.init(document.querySelector('#horizontal_{$this->object->getId()}'));"
427 );
428 }

◆ populateCorrectionsFormProperties()

assOrderingHorizontalGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Reimplemented from assQuestionGUI.

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

403 : void
404 {
405 // points
406 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
407
408 $points->allowDecimals(true);
409 $points->setValue($this->object->getPoints());
410 $points->setRequired(true);
411 $points->setSize(3);
412 $points->setMinValue(0.0);
413 $points->setMinvalueShouldBeGreater(true);
414 $form->addItem($points);
415 }
This class represents a number property in a property form.

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

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingHorizontalGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

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

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

Reimplemented from assQuestionGUI.

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

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->renderLatex($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 }
getGenericFeedbackOutput(int $active_id, ?int $pass)
hasCorrectSolution($activeId, $passIndex)
generateCorrectnessIconsForCorrectness(int $correctness)
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,...

◆ saveCorrectionsFormProperties()

assOrderingHorizontalGUI::saveCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Reimplemented from assQuestionGUI.

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

417 : void
418 {
419 $this->object->setPoints((float) str_replace(',', '.', $form->getInput('points')));
420 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ writePostData()

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

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

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

Reimplemented from assQuestionGUI.

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

61 : int
62 {
63 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
64 if (!$hasErrors) {
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.

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

+ 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 320 of file class.assOrderingHorizontalGUI.php.

320 : void
321 {
322 $this->object->setTextSize($this->request_data_collector->float('textsize'));
323 $this->object->setOrderText($this->request_data_collector->raw('ordertext'));
324 $this->object->setPoints($this->request_data_collector->float('points'));
325 }

Referenced by writePostData().

+ Here is the caller graph for this function:

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