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

Public Member Functions

 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)
 

Static Public Member Functions

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

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 Member Functions

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

Protected Attributes

const SUGGESTED_SOLUTION_COMMANDS
 
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
ILIAS Notes GUIService $notes_gui
 
ilCtrl $ctrl
 
ilPropertyFormGUI $editForm
 
ILIAS TestQuestionPool InternalRequestService $request
 

Private Attributes

 $ui
 
ilObjectDataCache $ilObjDataCache
 
ilHelpGUI $ilHelp
 
ilAccessHandler $access
 
ilObjUser $ilUser
 
ilTabsGUI $ilTabs
 
 $tree
 
ilDBInterface $ilDB
 
ilComponentRepository $component_repository
 
array $new_id_listeners = array()
 
int $new_id_listener_cnt = 0
 
 $previewSession
 
 $taxonomyIds = array()
 
 $targetGuiClass = null
 
string $questionActionCmd = 'handleQuestionAction'
 
ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder
 
ilTestQuestionNavigationGUI $navigationGUI = null
 
string $presentationContext = null
 
string $renderPurpose = self::RENDER_PURPOSE_PLAYBACK
 
string $editContext = self::EDIT_CONTEXT_AUTHORING
 
bool $previousSolutionPrefilled = false
 

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 Basic GUI class for assessment questions

The assQuestionGUI class encapsulates basic GUI functions for assessment 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
Version
$Id$

Definition at line 29 of file class.assQuestionGUI.php.

Member Function Documentation

◆ _getClassNameForQType()

static assQuestionGUI::_getClassNameForQType (   $q_type)
static
Deprecated:

Definition at line 476 of file class.assQuestionGUI.php.

476 : string
477 {
478 return $q_type . "GUI";
479 }

Referenced by _getGUIClassNameForId().

+ Here is the caller graph for this function:

◆ _getGUIClassNameForId()

static assQuestionGUI::_getGUIClassNameForId (   $a_q_id)
static
Deprecated:

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

466 : string
467 {
468 $q_type = assQuestion::getQuestionTypeFromDb($a_q_id);
469 $class_name = assQuestionGUI::_getClassNameForQType($q_type);
470 return $class_name;
471 }
static _getClassNameForQType($q_type)
static getQuestionTypeFromDb(int $question_id)

References _getClassNameForQType(), and assQuestion\getQuestionTypeFromDb().

Referenced by ilQuestionBrowserTableGUI\fillRow().

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

◆ _getQuestionGUI()

static assQuestionGUI::_getQuestionGUI ( string  $question_type = '',
int  $question_id = -1 
)
static

Creates a question gui representation and returns the alias to the question gui.

Definition at line 433 of file class.assQuestionGUI.php.

434 {
435 global $DIC;
436 $ilCtrl = $DIC['ilCtrl'];
437 $ilDB = $DIC['ilDB'];
438 $lng = $DIC['lng'];
439
440 if (($question_type === '') && ($question_id > 0)) {
441 $question_type = assQuestion::getQuestionTypeFromDb($question_id);
442 }
443
444 if ($question_type === '') {
445 return null;
446 }
447
448 assQuestion::_includeClass($question_type, 1);
449
450 $question_type_gui = $question_type . 'GUI';
451 $question = new $question_type_gui();
452
453 $feedbackObjectClassname = assQuestion::getFeedbackClassNameByQuestionType($question_type);
454 $question->object->feedbackOBJ = new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
455
456 if ($question_id > 0) {
457 $question->object->loadFromDb($question_id);
458 }
459
460 return $question;
461 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _includeClass(string $question_type, int $gui=0)
static getFeedbackClassNameByQuestionType(string $questionType)
global $DIC
Definition: feed.php:28

References $DIC, $ilDB, $lng, assQuestion\_includeClass(), assQuestion\getFeedbackClassNameByQuestionType(), and assQuestion\getQuestionTypeFromDb().

Referenced by ilObjQuestionPoolGUI\addLocatorItems(), ilTestExpressPageObjectGUI\addPageOfQuestions(), ilObjQuestionPoolGUI\createQuestionForTestObject(), ilObjQuestionPoolGUI\createQuestionObject(), ilPCQuestionGUI\edit(), ilObjTestGUI\executeCommand(), ilTestExpressPageObjectGUI\executeCommand(), ilQuestionEditGUI\executeCommand(), ilPageObjectGUI\executeCommand(), ilQuestionExporter\exportQuestion(), ilObjAssessmentFolder\fetchScoringAdjustableTypes(), ilAssQuestionPageCommandForwarder\forward(), ilPCQuestion\getJavascriptFiles(), ilTestExpressPageObjectGUI\handleToolbarCommand(), ilPCQuestion\modifyPageContentPostXsl(), ilAssQuestionSkillAssignmentsGUI\saveSkillQuestionAssignmentPropertiesFormCmd(), and ilObjQuestionPoolGUI\setTitleAndDescription().

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

◆ addBackTab()

assQuestionGUI::addBackTab ( ilTabsGUI  $ilTabs)
protected

Definition at line 1931 of file class.assQuestionGUI.php.

1931 : void
1932 {
1933 $this->ctrl->saveParameterByClass(ilAssQuestionPreviewGUI::class, 'prev_qid');
1935 $this->lng->txt('backtocallingpage'),
1936 $this->ctrl->getLinkTargetByClass(ilAssQuestionPreviewGUI::class, ilAssQuestionPreviewGUI::CMD_SHOW)
1937 );
1938 }
setBackTarget(string $a_title, string $a_target, string $a_frame="")

References ilAssQuestionPreviewGUI\CMD_SHOW, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilTabsGUI\setBackTarget().

+ Here is the call graph for this function:

◆ addBasicQuestionFormProperties()

assQuestionGUI::addBasicQuestionFormProperties ( ilPropertyFormGUI  $form)

Reimplemented in assClozeTestGUI, and assMultipleChoiceGUI.

Definition at line 1006 of file class.assQuestionGUI.php.

1006 : void
1007 {
1008 // title
1009 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
1010 $title->setMaxLength(100);
1011 $title->setValue($this->object->getTitle());
1012 $title->setRequired(true);
1013 $form->addItem($title);
1014
1015 if (!$this->object->getSelfAssessmentEditingMode()) {
1016 // author
1017 $author = new ilTextInputGUI($this->lng->txt("author"), "author");
1018 $author->setValue($this->object->getAuthor());
1019 $author->setMaxLength(512);
1020 $author->setRequired(true);
1021 $form->addItem($author);
1022
1023 // description
1024 $description = new ilTextInputGUI($this->lng->txt("description"), "comment");
1025 $description->setValue($this->object->getComment());
1026 $description->setRequired(false);
1027 $form->addItem($description);
1028 } else {
1029 // author as hidden field
1030 $hi = new ilHiddenInputGUI("author");
1031 $author = ilLegacyFormElementsUtil::prepareFormOutput($this->object->getAuthor());
1032 if (trim($author) == "") {
1033 $author = "-";
1034 }
1035 $hi->setValue($author);
1036 $form->addItem($hi);
1037 }
1038
1039 // lifecycle
1040 $lifecycle = new ilSelectInputGUI($this->lng->txt('qst_lifecycle'), 'lifecycle');
1041 $lifecycle->setOptions($this->object->getLifecycle()->getSelectOptions($this->lng));
1042 $lifecycle->setValue($this->object->getLifecycle()->getIdentifier());
1043 $form->addItem($lifecycle);
1044
1045 // questiontext
1046 $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
1047 $question->setValue($this->object->getQuestion());
1048 $question->setRequired(true);
1049 $question->setRows(10);
1050 $question->setCols(80);
1051
1052 if (!$this->object->getSelfAssessmentEditingMode()) {
1053 if ($this->object->getAdditionalContentEditingMode() != assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_IPE) {
1054 $question->setUseRte(true);
1055 $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
1056 $question->addPlugin("latex");
1057 $question->addButton("latex");
1058 $question->addButton("pastelatex");
1059 $question->setRTESupport($this->object->getId(), "qpl", "assessment");
1060 }
1061 } else {
1063 $question->setUseTagsForRteOnly(false);
1064 }
1065 $form->addItem($question);
1067 }
addNumberOfTriesToFormIfNecessary(ilPropertyFormGUI $form)
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static prepareFormOutput($a_str, bool $a_strip=false)
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References ilObjAdvancedEditing\_getUsedHTMLTags(), ilPropertyFormGUI\addItem(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_IPE, addNumberOfTriesToFormIfNecessary(), ilAssSelfAssessmentQuestionFormatter\getSelfAssessmentTags(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareFormOutput().

Referenced by assImagemapQuestionGUI\buildEditForm(), assKprimChoiceGUI\buildEditForm(), assLongMenuGUI\buildEditForm(), assOrderingQuestionGUI\buildEditForm(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assNumericGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assTextQuestionGUI\editQuestion(), and assTextSubsetGUI\editQuestion().

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

◆ addErrorMessage()

assQuestionGUI::addErrorMessage ( string  $errormessage)

Definition at line 949 of file class.assQuestionGUI.php.

949 : void
950 {
951 $this->errormessage .= ((strlen($this->errormessage)) ? "<br />" : "") . $errormessage;
952 }

References $errormessage.

Referenced by assFormulaQuestionGUI\checkInput(), and assFormulaQuestionGUI\writePostData().

+ Here is the caller graph for this function:

◆ addGIT()

assQuestionGUI::addGIT ( )

Definition at line 1680 of file class.assQuestionGUI.php.

1680 : void
1681 {
1682 $subquestion_index = 0;
1683 if (strlen($this->request->raw("subquestion_index")) && $this->request->raw("subquestion_index") >= 0) {
1684 $subquestion_index = $this->request->raw("subquestion_index");
1685 }
1686 $this->object->saveSuggestedSolution("git", "il__git_" . $this->request->raw("git"), $subquestion_index);
1687 $this->tpl->setOnScreenMessage('success', $this->lng->txt("suggested_solution_added_successfully"), true);
1688 $this->ctrl->redirect($this, "suggestedsolution");
1689 }

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

+ Here is the call graph for this function:

◆ addHeaderAction()

assQuestionGUI::addHeaderAction ( )

Definition at line 162 of file class.assQuestionGUI.php.

162 : void
163 {
164 }

◆ addNewIdListener()

assQuestionGUI::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.

Definition at line 978 of file class.assQuestionGUI.php.

978 : void
979 {
981 $this->new_id_listeners[$cnt]["object"] = &$a_object;
982 $this->new_id_listeners[$cnt]["method"] = $a_method;
983 $this->new_id_listeners[$cnt]["parameters"] = $a_parameters;
984 $this->new_id_listener_cnt++;
985 }

References $new_id_listener_cnt.

◆ addNumberOfTriesToFormIfNecessary()

assQuestionGUI::addNumberOfTriesToFormIfNecessary ( ilPropertyFormGUI  $form)
protected

Definition at line 1069 of file class.assQuestionGUI.php.

1070 {
1071 if (!$this->object->getSelfAssessmentEditingMode()) {
1072 return;
1073 }
1074
1075 $nr_tries = $this->object->getNrOfTries() ?? $this->object->getDefaultNrOfTries();
1076
1077 if ($nr_tries < 1) {
1078 $nr_tries = "";
1079 }
1080
1081 $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
1082 $ni->setValue($nr_tries);
1083 $ni->setMinValue(0);
1084 $ni->setSize(5);
1085 $ni->setMaxLength(5);
1086 $form->addItem($ni);
1087 }
This class represents a number property in a property form.

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

Referenced by assClozeTestGUI\addBasicQuestionFormProperties(), and addBasicQuestionFormProperties().

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

◆ addPG()

assQuestionGUI::addPG ( )

Definition at line 1658 of file class.assQuestionGUI.php.

1658 : void
1659 {
1660 $subquestion_index = 0;
1661 if (strlen($this->request->raw("subquestion_index")) && $this->request->raw("subquestion_index") >= 0) {
1662 $subquestion_index = $this->request->raw("subquestion_index");
1663 }
1664 $this->object->saveSuggestedSolution("pg", "il__pg_" . $this->request->raw("pg"), $subquestion_index);
1665 $this->tpl->setOnScreenMessage('success', $this->lng->txt("suggested_solution_added_successfully"), true);
1666 $this->ctrl->redirect($this, "suggestedsolution");
1667 }

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

+ Here is the call graph for this function:

◆ addQuestionFormCommandButtons()

assQuestionGUI::addQuestionFormCommandButtons ( ilPropertyFormGUI  $form)

Definition at line 998 of file class.assQuestionGUI.php.

998 : void
999 {
1000 if (!$this->object->getSelfAssessmentEditingMode()) {
1001 $form->addCommandButton("saveReturn", $this->lng->txt("save_return"));
1002 }
1003 $form->addCommandButton("save", $this->lng->txt("save"));
1004 }
addCommandButton(string $a_cmd, string $a_text, string $a_id="")

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

Referenced by assImagemapQuestionGUI\buildEditForm(), assKprimChoiceGUI\buildEditForm(), assLongMenuGUI\buildEditForm(), assClozeTestGUI\editQuestion(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assNumericGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assTextQuestionGUI\editQuestion(), and assTextSubsetGUI\editQuestion().

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

◆ addSaveOnEnterOnLoadCode()

assQuestionGUI::addSaveOnEnterOnLoadCode ( )
protected

Definition at line 2127 of file class.assQuestionGUI.php.

2127 : void
2128 {
2129 $this->tpl->addOnloadCode("
2130 let form = document.querySelector('#ilContentContainer form');
2131 let button = form.querySelector('input[name=\"cmd[save]\"]');
2132 if (button === null) {
2133 button = form.querySelector('input[name=\"cmd[saveFQ]\"]');
2134 };
2135 if (form && button) {
2136 form.addEventListener('keydown', function (e) {
2137 if (e.key === 'Enter'
2138 && e.target.type !== 'textarea'
2139 && e.target.type !== 'submit'
2140 && e.target.type !== 'file'
2141 ) {
2142 e.preventDefault();
2143 form.requestSubmit(button);
2144 }
2145 })
2146 }
2147 ");
2148 }

Referenced by assFormulaQuestionGUI\callSpecialQuestionCommands(), executeCommand(), and assFormulaQuestionGUI\parseQuestion().

+ Here is the caller graph for this function:

◆ addST()

assQuestionGUI::addST ( )

Definition at line 1669 of file class.assQuestionGUI.php.

1669 : void
1670 {
1671 $subquestion_index = 0;
1672 if (strlen($this->request->raw("subquestion_index")) && $this->request->raw("subquestion_index") >= 0) {
1673 $subquestion_index = $this->request->raw("subquestion_index");
1674 }
1675 $this->object->saveSuggestedSolution("st", "il__st_" . $this->request->raw("st"), $subquestion_index);
1676 $this->tpl->setOnScreenMessage('success', $this->lng->txt("suggested_solution_added_successfully"), true);
1677 $this->ctrl->redirect($this, "suggestedsolution");
1678 }

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

+ Here is the call graph for this function:

◆ addTab_Question()

assQuestionGUI::addTab_Question ( ilTabsGUI  $tabsGUI)
protected

Definition at line 1817 of file class.assQuestionGUI.php.

1817 : void
1818 {
1819 $tabsGUI->addTarget(
1820 'edit_question',
1821 $this->ctrl->getLinkTargetByClass(
1822 array('ilrepositorygui','ilobjquestionpoolgui', get_class($this)),
1823 'editQuestion'
1824 ),
1825 'editQuestion',
1826 '',
1827 '',
1828 false
1829 );
1830 }
addTarget(string $a_text, string $a_link, $a_cmd="", $a_cmdClass="", string $a_frame="", bool $a_activate=false, bool $a_dir_text=false)

References ilTabsGUI\addTarget(), and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ addTab_QuestionFeedback()

assQuestionGUI::addTab_QuestionFeedback ( ilTabsGUI  $tabs)
protected

Definition at line 1787 of file class.assQuestionGUI.php.

1787 : void
1788 {
1789 $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionFeedbackEditingGUI');
1790
1791 $tabLink = $this->ctrl->getLinkTargetByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
1792
1793 $tabs->addTarget('tst_feedback', $tabLink, $tabCommands, $this->ctrl->getCmdClass(), '');
1794 }
static getCommandsFromClassConstants(string $guiClassName, string $cmdConstantNameBegin='CMD_')

References ilTabsGUI\addTarget(), ilAssQuestionFeedbackEditingGUI\CMD_SHOW, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ addTab_QuestionHints()

assQuestionGUI::addTab_QuestionHints ( ilTabsGUI  $tabs)
protected

Definition at line 1796 of file class.assQuestionGUI.php.

1796 : void
1797 {
1798 switch ($this->ctrl->getCmdClass()) {
1799 case 'ilassquestionhintsgui':
1800 $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionHintsGUI');
1801 break;
1802
1803 case 'ilassquestionhintgui':
1804 $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionHintGUI');
1805 break;
1806
1807 default:
1808
1809 $tabCommands = array();
1810 }
1811
1812 $tabLink = $this->ctrl->getLinkTargetByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
1813
1814 $tabs->addTarget('tst_question_hints_tab', $tabLink, $tabCommands, $this->ctrl->getCmdClass(), '');
1815 }
const CMD_SHOW_LIST
command constants

References ilTabsGUI\addTarget(), ilAssQuestionHintsGUI\CMD_SHOW_LIST, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ addTab_SuggestedSolution()

assQuestionGUI::addTab_SuggestedSolution ( ilTabsGUI  $tabs,
string  $classname 
)

Definition at line 1757 of file class.assQuestionGUI.php.

1757 : void
1758 {
1759 if ($this->request->getQuestionId()) {
1760 $tabs->addTarget(
1761 "suggested_solution",
1762 $this->ctrl->getLinkTargetByClass($classname, "suggestedsolution"),
1763 array("suggestedsolution", "saveSuggestedSolution", "outSolutionExplorer", "cancel",
1764 "addSuggestedSolution","cancelExplorer", "linkChilds", "removeSuggestedSolution"
1765 ),
1766 $classname,
1767 ""
1768 );
1769 }
1770 }

References ilTabsGUI\addTarget(), and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ apply()

assQuestionGUI::apply ( )

Definition at line 890 of file class.assQuestionGUI.php.

890 : void
891 {
892 $this->writePostData();
893 $this->object->saveToDb();
894 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
895 $this->editQuestion();
896 }
writePostData(bool $always=false)
Evaluates a posted edit form and writes the form data in the question object.

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

+ Here is the call graph for this function:

◆ assessment()

assQuestionGUI::assessment ( )

Definition at line 419 of file class.assQuestionGUI.php.

419 : void
420 {
421 $stats_table = new ilQuestionCumulatedStatisticsTableGUI($this, 'assessment', '', $this->object);
422 $usage_table = new ilQuestionUsagesTableGUI($this, 'assessment', '', $this->object);
423
424 $this->tpl->setContent(implode('<br />', array(
425 $stats_table->getHTML(),
426 $usage_table->getHTML()
427 )));
428 }
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...

◆ buildBasicEditFormObject()

assQuestionGUI::buildBasicEditFormObject ( )
protected

Definition at line 1953 of file class.assQuestionGUI.php.

1954 {
1955 $form = new ilPropertyFormGUI();
1956 $form->setFormAction($this->ctrl->getFormAction($this));
1957 $form->setId($this->getType());
1958 $form->setTitle($this->outQuestionType());
1959 $form->setTableWidth('100%');
1960 $form->setMultipart(true);
1961 return $form;
1962 }
getType()
needed for page editor compliance
This class represents a property form user interface.

References ILIAS\Repository\ctrl().

Referenced by assImagemapQuestionGUI\buildEditForm(), assKprimChoiceGUI\buildEditForm(), and assLongMenuGUI\buildEditForm().

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

◆ buildEditForm()

assQuestionGUI::buildEditForm ( )
protected

Reimplemented in assImagemapQuestionGUI, assKprimChoiceGUI, assLongMenuGUI, and assOrderingQuestionGUI.

Definition at line 1974 of file class.assQuestionGUI.php.

1975 {
1976 $this->editQuestion(true); // TODO bheyser: editQuestion should be added to the abstract base class with a unified signature
1977 return $this->editForm;
1978 }
ilPropertyFormGUI $editForm

Referenced by assMultipleChoiceGUI\editQuestion(), executeCommand(), and assMultipleChoiceGUI\writePostData().

+ Here is the caller graph for this function:

◆ buildFocusAnchorHtml()

assQuestionGUI::buildFocusAnchorHtml ( )

Definition at line 1980 of file class.assQuestionGUI.php.

1980 : string
1981 {
1982 return '<div id="focus"></div>';
1983 }

◆ callNewIdListeners()

assQuestionGUI::callNewIdListeners ( int  $a_new_id)

Definition at line 987 of file class.assQuestionGUI.php.

987 : void
988 {
989 for ($i = 0; $i < $this->new_id_listener_cnt; $i++) {
990 $this->new_id_listeners[$i]["parameters"]["new_id"] = $a_new_id;
991 $object = &$this->new_id_listeners[$i]["object"];
992 $method = $this->new_id_listeners[$i]["method"];
993 $parameters = $this->new_id_listeners[$i]["parameters"];
994 $object->$method($parameters);
995 }
996 }
$i
Definition: metadata.php:41

References $i, $new_id_listener_cnt, and $object.

Referenced by save(), saveReturn(), and assFormulaQuestionGUI\saveReturnFQ().

+ Here is the caller graph for this function:

◆ cancel()

assQuestionGUI::cancel ( )

Definition at line 579 of file class.assQuestionGUI.php.

579 : void
580 {
581 if ($this->request->raw("calling_test")) {
582 $_GET["ref_id"] = $this->request->raw("calling_test");
583 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $this->request->raw("calling_test"));
584 } elseif ($this->request->raw("test_ref_id")) {
585 $_GET["ref_id"] = $this->request->raw("test_ref_id");
586 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $this->request->raw("test_ref_id"));
587 } else {
588 if ($this->request->raw("q_id") > 0) {
589 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $this->request->getQuestionId());
590 $this->ctrl->redirectByClass("ilAssQuestionPageGUI", "edit");
591 } else {
592 $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
593 }
594 }
595 }
static redirect(string $a_script)
$_GET['client_id']
Definition: saml1-acs.php:21

References $_GET, ILIAS\Repository\ctrl(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ cancelExplorer()

assQuestionGUI::cancelExplorer ( )

Definition at line 1521 of file class.assQuestionGUI.php.

1521 : void
1522 {
1523 $this->ctrl->redirect($this, "suggestedsolution");
1524 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ cancelSync()

assQuestionGUI::cancelSync ( )

Definition at line 648 of file class.assQuestionGUI.php.

648 : void
649 {
650 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
651
652 if (strlen($this->request->raw("return_to"))) {
653 $this->ctrl->redirect($this, $this->request->raw("return_to"));
654 }
655 if (strlen($this->request->raw('return_to_fb'))) {
656 $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', 'showFeedbackForm');
657 } else {
658 if ($this->request->isset('calling_consumer') && (int) $this->request->raw('calling_consumer')) {
659 $ref_id = (int) $this->request->raw('calling_consumer');
661 if ($consumer instanceof ilQuestionEditingFormConsumer) {
662 $this->ctrl->redirectToURL($consumer->getQuestionEditingFormBackTarget($this->request->raw('consumer_context')));
663 }
664 $this->ctrl->redirectToURL(ilLink::_getLink($ref_id));
665 }
666
667 if ($this->request->raw('test_express_mode')) {
668 $this->ctrl->redirectToURL(ilTestExpressPage::getReturnToPageLink($this->object->getId()));
669 } else {
670 $this->ctrl->redirectByClass(ilAssQuestionPreviewGUI::class, ilAssQuestionPreviewGUI::CMD_SHOW);
671 }
672 }
673 }
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static getReturnToPageLink($q_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67

References $ref_id, ilLink\_getLink(), ilAssQuestionPreviewGUI\CMD_SHOW, ILIAS\Repository\ctrl(), ilObjectFactory\getInstanceByRefId(), ilTestExpressPage\getReturnToPageLink(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ cleanupAnswerText()

assQuestionGUI::cleanupAnswerText ( array  $answer_text,
bool  $is_rte 
)
protected

sk - 12.05.2023: This is one more of those that we need, but don't want.

Deprecated:

Definition at line 2106 of file class.assQuestionGUI.php.

2106 : array
2107 {
2108 if (!is_array($answer_text)) {
2109 return [];
2110 }
2111
2112 if ($is_rte) {
2114 $answer_text,
2115 false,
2117 );
2118 }
2119
2121 $answer_text,
2122 true,
2123 self::ALLOWED_PLAIN_TEXT_TAGS
2124 );
2125 }
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.

References ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), and ilArrayUtil\stripSlashesRecursive().

+ Here is the call graph for this function:

◆ completeTestOutputFormAction()

assQuestionGUI::completeTestOutputFormAction (   $formAction,
  $active_id,
  $pass 
)
protected

Reimplemented in assImagemapQuestionGUI.

Definition at line 1906 of file class.assQuestionGUI.php.

1908 {
1909 return $formAction;
1910 }

◆ escapeTemplatePlaceholders()

assQuestionGUI::escapeTemplatePlaceholders ( string  $text)
protected

Definition at line 1969 of file class.assQuestionGUI.php.

1969 : string
1970 {
1971 return str_replace(['{','}'], ['&#123;','&#125;'], $text);
1972 }

Referenced by assClozeTestGUI\populateJSON().

+ Here is the caller graph for this function:

◆ executeCommand()

assQuestionGUI::executeCommand ( )

Definition at line 201 of file class.assQuestionGUI.php.

202 {
203 $this->ilHelp->setScreenIdComponent('qpl');
204
205 $next_class = $this->ctrl->getNextClass($this);
206
207 switch ($next_class) {
208 case 'ilformpropertydispatchgui':
209 $form = $this->buildEditForm();
210 $form_prop_dispatch = new ilFormPropertyDispatchGUI();
211 $form_prop_dispatch->setItem($form->getItemByPostVar(ilUtil::stripSlashes($this->request->raw('postvar'))));
212 $this->ctrl->forwardCommand($form_prop_dispatch);
213 break;
214
215 default:
216 $cmd = $this->ctrl->getCmd('editQuestion');
217
218 if (in_array($cmd, self::SUGGESTED_SOLUTION_COMMANDS)) {
219 $this->suggestedsolution();
220 return;
221 }
222 if (in_array($cmd, ['save', 'saveReturn', 'editQuestion'])) {
224 $this->$cmd();
225 return;
226 }
227 if (method_exists($this, $cmd)) {
228 $this->$cmd();
229 return;
230 }
231
232 if ($this->hasSpecialQuestionCommands() === true) {
233 $this->callSpecialQuestionCommands($cmd);
234 }
235 }
236 }
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...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References addSaveOnEnterOnLoadCode(), buildEditForm(), ILIAS\Repository\ctrl(), hasSpecialQuestionCommands(), ilUtil\stripSlashes(), and suggestedsolution().

+ Here is the call graph for this function:

◆ generateCorrectnessIconsForCorrectness()

assQuestionGUI::generateCorrectnessIconsForCorrectness ( int  $correctness)
protected

Definition at line 2022 of file class.assQuestionGUI.php.

2022 : string
2023 {
2024 switch ($correctness) {
2026 $icon_name = 'icon_not_ok.svg';
2027 $label = $this->lng->txt("answer_is_wrong");
2028 break;
2030 $icon_name = 'icon_ok.svg';
2031 $label = $this->lng->txt("answer_is_not_correct_but_positive");
2032 break;
2034 $icon_name = 'icon_ok.svg';
2035 $label = $this->lng->txt("answer_is_right");
2036 break;
2037 default:
2038 return '';
2039 }
2040 $path = ilUtil::getImagePath($icon_name);
2041 $icon = $this->ui->factory()->symbol()->icon()->custom(
2042 $path,
2043 $label
2044 );
2045 return $this->ui->renderer()->render($icon);
2046 }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
$path
Definition: ltiservices.php:32

References $path, ilUtil\getImagePath(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ genericFeedbackOutputBuilder()

assQuestionGUI::genericFeedbackOutputBuilder ( string  $feedback_correct,
string  $feedback_incorrect,
int  $active_id,
?int  $pass 
)
protected

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

1160 : string {
1161 if ($pass === null) {
1162 return '';
1163 }
1164 $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
1165 $max_points = $this->object->getMaximumPoints();
1166 if ($reached_points == $max_points) {
1167 return $feedback_correct;
1168 }
1169
1170 return $feedback_incorrect;
1171 }

Referenced by getGenericFeedbackOutput().

+ Here is the caller graph for this function:

◆ getAdditionalEditQuestionCommands()

assQuestionGUI::getAdditionalEditQuestionCommands ( )
protected

Reimplemented in assKprimChoiceGUI.

Definition at line 1782 of file class.assQuestionGUI.php.

1782 : array
1783 {
1784 return array();
1785 }

◆ getAnswerFrequencyTableGUI()

assQuestionGUI::getAnswerFrequencyTableGUI (   $parentGui,
  $parentCmd,
  $relevantAnswers,
  $questionIndex 
)

Reimplemented in assClozeTestGUI, assKprimChoiceGUI, assLongMenuGUI, and assMatchingQuestionGUI.

Definition at line 2000 of file class.assQuestionGUI.php.

2001 {
2002 $table = new ilAnswerFrequencyStatisticTableGUI($parentGui, $parentCmd, $this->object);
2003 $table->setQuestionIndex($questionIndex);
2004 $table->setData($this->getAnswersFrequency($relevantAnswers, $questionIndex));
2005 $table->initColumns();
2006 return $table;
2007 }
getAnswersFrequency($relevantAnswers, $questionIndex)

◆ getAnswersFrequency()

assQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

◆ getAsValueAttribute()

assQuestionGUI::getAsValueAttribute ( string  $a_value)

Definition at line 964 of file class.assQuestionGUI.php.

964 : string
965 {
966 $result = "";
967 if (strlen($a_value)) {
968 $result = " value=\"$a_value\" ";
969 }
970 return $result;
971 }

◆ getBasicEditQuestionTabCommands()

assQuestionGUI::getBasicEditQuestionTabCommands ( )
protected

Definition at line 1777 of file class.assQuestionGUI.php.

1777 : array
1778 {
1779 return array('editQuestion', 'save', 'saveEdit', 'originalSyncForm');
1780 }

◆ getCommandsFromClassConstants()

static assQuestionGUI::getCommandsFromClassConstants ( string  $guiClassName,
string  $cmdConstantNameBegin = 'CMD_' 
)
static

Definition at line 1696 of file class.assQuestionGUI.php.

1699 : array {
1700 $reflectionClass = new ReflectionClass($guiClassName);
1701
1702 $commands = null;
1703
1704 if ($reflectionClass instanceof ReflectionClass) {
1705 $commands = array();
1706
1707 foreach ($reflectionClass->getConstants() as $constName => $constValue) {
1708 if (substr($constName, 0, strlen($cmdConstantNameBegin)) == $cmdConstantNameBegin) {
1709 $commands[] = $constValue;
1710 }
1711 }
1712 }
1713
1714 return $commands;
1715 }

Referenced by ilPCQuestionGUI\setTabs().

+ Here is the caller graph for this function:

◆ getContextPath()

assQuestionGUI::getContextPath (   $cont_obj,
int  $a_endnode_id,
int  $a_startnode_id = 1 
)

get context path in content object tree

Definition at line 901 of file class.assQuestionGUI.php.

901 : string
902 {
903 $path = "";
904
905 $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
906
907 // count -1, to exclude the learning module itself
908 for ($i = 1; $i < (count($tmpPath) - 1); $i++) {
909 if ($path != "") {
910 $path .= " > ";
911 }
912
913 $path .= $tmpPath[$i]["title"];
914 }
915
916 return $path;
917 }

References $i, and $path.

◆ getEditContext()

assQuestionGUI::getEditContext ( )

Definition at line 324 of file class.assQuestionGUI.php.

324 : string
325 {
326 return $this->editContext;
327 }

References $editContext.

Referenced by isAdjustmentEditContext(), and isAuthoringEditContext().

+ Here is the caller graph for this function:

◆ getEditQuestionTabCommands()

assQuestionGUI::getEditQuestionTabCommands ( )
final

Definition at line 1772 of file class.assQuestionGUI.php.

1772 : array
1773 {
1774 return array_merge($this->getBasicEditQuestionTabCommands(), $this->getAdditionalEditQuestionCommands());
1775 }

◆ getErrorMessage()

assQuestionGUI::getErrorMessage ( )

Definition at line 939 of file class.assQuestionGUI.php.

939 : string
940 {
941 return $this->errormessage;
942 }

References $errormessage.

Referenced by assFormulaQuestionGUI\suggestRange().

+ Here is the caller graph for this function:

◆ getFormEncodingType()

assQuestionGUI::getFormEncodingType ( )

Reimplemented in assFileUploadGUI.

Definition at line 1926 of file class.assQuestionGUI.php.

1926 : string
1927 {
1929 }

Referenced by ilTestPlayerAbstractGUI\showQuestionViewable().

+ Here is the caller graph for this function:

◆ getGenericFeedbackOutput()

assQuestionGUI::getGenericFeedbackOutput ( int  $active_id,
?int  $pass 
)
Parameters
int | null$passActive pass

Definition at line 1135 of file class.assQuestionGUI.php.

1135 : string
1136 {
1137 $output = '';
1138 $manual_feedback = ilObjTest::getManualFeedback($active_id, $this->object->getId(), $pass);
1139 if ($manual_feedback !== '') {
1140 return $manual_feedback;
1141 }
1142
1143 $correct_feedback = $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), true);
1144 $incorrect_feedback = $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), false);
1145 if ($correct_feedback . $incorrect_feedback !== '') {
1146 $output = $this->genericFeedbackOutputBuilder($correct_feedback, $incorrect_feedback, $active_id, $pass);
1147 }
1148
1149 if ($this->object->isAdditionalContentEditingModePageObject()) {
1150 return $output;
1151 }
1152 return $this->object->prepareTextareaOutput($output, true);
1153 }
genericFeedbackOutputBuilder(string $feedback_correct, string $feedback_incorrect, int $active_id, ?int $pass)
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the feedback comment for a question in a test if it is finalized.

References genericFeedbackOutputBuilder(), ilObjTest\getManualFeedback(), and ILIAS\Repository\object().

Referenced by ilTestPlayerAbstractGUI\populateGenericFeedbackBlock().

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

◆ getGenericFeedbackOutputForCorrectSolution()

assQuestionGUI::getGenericFeedbackOutputForCorrectSolution ( )

Definition at line 1173 of file class.assQuestionGUI.php.

1173 : string
1174 {
1175 return $this->object->prepareTextareaOutput(
1176 $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), true),
1177 true
1178 );
1179 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getGenericFeedbackOutputForIncorrectSolution()

assQuestionGUI::getGenericFeedbackOutputForIncorrectSolution ( )

Definition at line 1181 of file class.assQuestionGUI.php.

1181 : string
1182 {
1183 return $this->object->prepareTextareaOutput(
1184 $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), false),
1185 true
1186 );
1187 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getHeaderAction()

assQuestionGUI::getHeaderAction ( )

Definition at line 172 of file class.assQuestionGUI.php.

172 : string
173 {
174 $parentObjType = $this->ilObjDataCache->lookupType($this->object->getObjId());
175
176 $dispatcher = new ilCommonActionDispatcherGUI(
178 $this->access,
179 $parentObjType,
180 $this->request->getRefId(),
181 $this->object->getObjId()
182 );
183
184 $dispatcher->setSubObject("quest", $this->object->getId());
185
186 $ha = $dispatcher->initHeaderAction();
187 $ha->enableComments(true, false);
188
189 return $ha->getHeaderAction($this->ui->mainTemplate());
190 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\access(), ILIAS\Repository\object(), ilCommonActionDispatcherGUI\TYPE_REPOSITORY, and ILIAS\Repository\ui().

Referenced by redrawHeaderAction().

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

◆ getILIASPage()

assQuestionGUI::getILIASPage ( string  $html = "")

Returns the ILIAS Page around a question.

Definition at line 518 of file class.assQuestionGUI.php.

518 : string
519 {
520 $page_gui = new ilAssQuestionPageGUI($this->object->getId());
521 $page_gui->setQuestionHTML(
522 [$this->object->getId() => $html]
523 );
524 $presentation = $page_gui->presentation();
525 $presentation = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $presentation);
526 return $presentation;
527 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\object().

Referenced by assClozeTestGUI\getPreview().

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

◆ getNavigationGUI()

assQuestionGUI::getNavigationGUI ( )

Definition at line 349 of file class.assQuestionGUI.php.

References $navigationGUI.

Referenced by outQuestionPage().

+ Here is the caller graph for this function:

◆ getNotesHTML()

assQuestionGUI::getNotesHTML ( )

Definition at line 192 of file class.assQuestionGUI.php.

192 : string
193 {
194 $notesGUI = new ilNoteGUI($this->object->getObjId(), $this->object->getId(), 'quest');
195 $notesGUI->enablePublicNotes(true);
196 $notesGUI->enablePublicNotesDeletion(true);
197
198 return $notesGUI->getCommentsHTML();
199 }
Notes GUI class.

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getPresentationContext()

assQuestionGUI::getPresentationContext ( )

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

249 : ?string
250 {
252 }

References $presentationContext.

Referenced by isTestPresentationContext().

+ Here is the caller graph for this function:

◆ getPresentationJavascripts()

assQuestionGUI::getPresentationJavascripts ( )

Reimplemented in assMatchingQuestionGUI, assMultipleChoiceGUI, assOrderingHorizontalGUI, and assOrderingQuestionGUI.

Definition at line 488 of file class.assQuestionGUI.php.

488 : array
489 {
490 return array();
491 }

Referenced by populateJavascriptFilesRequiredForWorkForm().

+ Here is the caller graph for this function:

◆ getPreview()

◆ getPreviewSession()

assQuestionGUI::getPreviewSession ( )
Returns
ilAssQuestionPreviewSession|null

Definition at line 1948 of file class.assQuestionGUI.php.

Referenced by assClozeTestGUI\getPreview().

+ Here is the caller graph for this function:

◆ getPreviousSolutionConfirmationCheckboxHtml()

assQuestionGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

Reimplemented in assFileUploadGUI, and assImagemapQuestionGUI.

Definition at line 572 of file class.assQuestionGUI.php.

572 : string
573 {
574 $tpl = new ilTemplate('tpl.tst_question_additional_behaviour_checkbox.html', true, true, 'Modules/TestQuestionPool');
575 $tpl->setVariable('TXT_FORCE_FORM_DIFF_LABEL', $this->lng->txt('use_previous_solution'));
576 return $tpl->get();
577 }
ilGlobalPageTemplate $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
special template class to simplify handling of ITX/PEAR

References $tpl, ilGlobalPageTemplate\get(), ILIAS\Repository\lng(), and ilGlobalPageTemplate\setVariable().

Referenced by outQuestionPage().

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

◆ getPreviousSolutionProvidedMessage()

assQuestionGUI::getPreviousSolutionProvidedMessage ( )
protected

Reimplemented in assFileUploadGUI.

Definition at line 567 of file class.assQuestionGUI.php.

567 : string
568 {
569 return $this->lng->txt('use_previous_solution_advice');
570 }

References ILIAS\Repository\lng().

Referenced by outQuestionPage().

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

◆ getQuestionActionCmd()

assQuestionGUI::getQuestionActionCmd ( )

Definition at line 405 of file class.assQuestionGUI.php.

405 : string
406 {
408 }

References $questionActionCmd.

◆ getQuestionCount()

assQuestionGUI::getQuestionCount ( )

Definition at line 934 of file class.assQuestionGUI.php.

934 : int
935 {
937 }
int $question_count
question count in test

References $question_count.

◆ getQuestionHeaderBlockBuilder()

assQuestionGUI::getQuestionHeaderBlockBuilder ( )

Definition at line 390 of file class.assQuestionGUI.php.

391 {
393 }
ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $questionHeaderBlockBuilder.

Referenced by ilTestPlayerAbstractGUI\populateInstantResponseModal(), ilTestPlayerAbstractGUI\showQuestionEditable(), and ilTestPlayerAbstractGUI\showQuestionViewable().

+ Here is the caller graph for this function:

◆ getQuestionTemplate()

assQuestionGUI::getQuestionTemplate ( )

Definition at line 493 of file class.assQuestionGUI.php.

493 : void
494 {
495 // @todo Björn: Maybe this has to be changed for PHP 7/ILIAS 5.2.x (ilObjTestGUI::executeCommand, switch -> default case -> $this->prepareOutput(); already added a template to the CONTENT variable wrapped in a block named content)
496 if (!$this->tpl->blockExists('content')) {
497 $this->tpl->addBlockFile("CONTENT", "content", "tpl.il_as_qpl_content.html", "Modules/TestQuestionPool");
498 }
499 // @todo Björn: Maybe this has to be changed for PHP 7/ILIAS 5.2.x (ilObjTestGUI::executeCommand, switch -> default case -> $this->prepareOutput(); already added a template to the STATUSLINE variable wrapped in a block named statusline)
500 if (!$this->tpl->blockExists('statusline')) {
501 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
502 }
503 // @todo Björn: Maybe this has to be changed for PHP 7/ILIAS 5.2.x because ass[XYZ]QuestionGUI::editQuestion is called multiple times
504 if (!$this->tpl->blockExists('adm_content')) {
505 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_question.html", "Modules/TestQuestionPool");
506 }
507 }

Referenced by assImagemapQuestionGUI\areaEditor(), assClozeTestGUI\editQuestion(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assMultipleChoiceGUI\editQuestion(), assNumericGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assTextQuestionGUI\editQuestion(), assTextSubsetGUI\editQuestion(), assImagemapQuestionGUI\editQuestion(), assKprimChoiceGUI\editQuestion(), assLongMenuGUI\editQuestion(), and renderEditForm().

+ Here is the caller graph for this function:

◆ getQuestionType()

assQuestionGUI::getQuestionType ( )

Definition at line 959 of file class.assQuestionGUI.php.

959 : string
960 {
961 return $this->object->getQuestionType();
962 }

Referenced by ilTestCorrectionsGUI\allowedInAdjustment(), and getType().

+ Here is the caller graph for this function:

◆ getRenderPurpose()

assQuestionGUI::getRenderPurpose ( )

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

276 : string
277 {
279 }

References $renderPurpose.

Referenced by isRenderPurposeDemoplay(), isRenderPurposeInputValue(), isRenderPurposePlayback(), isRenderPurposePreview(), and isRenderPurposePrintPdf().

+ Here is the caller graph for this function:

◆ getSequenceNumber()

assQuestionGUI::getSequenceNumber ( )

Definition at line 924 of file class.assQuestionGUI.php.

924 : int
925 {
926 return $this->sequence_no;
927 }
int $sequence_no
sequence number in test

References $sequence_no.

◆ getSolutionOutput()

assQuestionGUI::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 
)
abstract

◆ getSpecificFeedbackOutput()

assQuestionGUI::getSpecificFeedbackOutput ( array  $userSolution)
abstract

Returns the answer specific feedback for the question.

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

Reimplemented in assErrorTextGUI, assClozeTestGUI, assFileUploadGUI, assFormulaQuestionGUI, assImagemapQuestionGUI, assKprimChoiceGUI, assLongMenuGUI, assMatchingQuestionGUI, assMultipleChoiceGUI, assNumericGUI, assOrderingHorizontalGUI, assOrderingQuestionGUI, assSingleChoiceGUI, assTextQuestionGUI, and assTextSubsetGUI.

Referenced by ilTestPlayerAbstractGUI\populateSpecificFeedbackBlock().

+ Here is the caller graph for this function:

◆ getSubQuestionsIndex()

assQuestionGUI::getSubQuestionsIndex ( )

Reimplemented in assClozeTestGUI, and assLongMenuGUI.

Definition at line 1990 of file class.assQuestionGUI.php.

1990 : array
1991 {
1992 return array(0);
1993 }

◆ getTargetGuiClass()

assQuestionGUI::getTargetGuiClass ( )

Definition at line 379 of file class.assQuestionGUI.php.

379 : ?string
380 {
382 }

References $targetGuiClass.

◆ getTaxonomyIds()

assQuestionGUI::getTaxonomyIds ( )

Definition at line 364 of file class.assQuestionGUI.php.

364 : array
365 {
366 return $this->taxonomyIds;
367 }

References $taxonomyIds.

Referenced by populateTaxonomyFormSection(), and saveTaxonomyAssignments().

+ Here is the caller graph for this function:

◆ getTestOutput()

assQuestionGUI::getTestOutput (   $active_id,
  $pass,
  $is_question_postponed,
  $user_post_solutions,
  $show_specific_inline_feedback 
)
abstract

◆ getType()

assQuestionGUI::getType ( )

needed for page editor compliance

Definition at line 244 of file class.assQuestionGUI.php.

244 : string
245 {
246 return $this->getQuestionType();
247 }

References getQuestionType().

+ Here is the call graph for this function:

◆ getUseUnchangedAnswerCheckboxHtml()

assQuestionGUI::getUseUnchangedAnswerCheckboxHtml ( )
protected

Reimplemented in assMultipleChoiceGUI.

Definition at line 560 of file class.assQuestionGUI.php.

560 : string
561 {
562 $tpl = new ilTemplate('tpl.tst_question_additional_behaviour_checkbox.html', true, true, 'Modules/TestQuestionPool');
563 $tpl->setVariable('TXT_FORCE_FORM_DIFF_LABEL', $this->object->getTestPresentationConfig()->getUseUnchangedAnswerLabel());
564 return $tpl->get();
565 }

References $tpl, ilGlobalPageTemplate\get(), ILIAS\Repository\object(), and ilGlobalPageTemplate\setVariable().

Referenced by outQuestionPage().

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

◆ hasCorrectSolution()

assQuestionGUI::hasCorrectSolution (   $activeId,
  $passIndex 
)
protected

Definition at line 1845 of file class.assQuestionGUI.php.

1845 : bool
1846 {
1847 $reachedPoints = $this->object->getAdjustedReachedPoints((int) $activeId, (int) $passIndex, true);
1848 $maximumPoints = $this->object->getMaximumPoints();
1849
1850 return $reachedPoints == $maximumPoints;
1851 }

◆ hasInlineFeedback()

assQuestionGUI::hasInlineFeedback ( )

Reimplemented in assKprimChoiceGUI, assMultipleChoiceGUI, and assSingleChoiceGUI.

Definition at line 157 of file class.assQuestionGUI.php.

157 : bool
158 {
159 return false;
160 }

Referenced by ilTestPlayerAbstractGUI\populateInstantResponseBlocks().

+ Here is the caller graph for this function:

◆ hasSpecialQuestionCommands()

assQuestionGUI::hasSpecialQuestionCommands ( )
protected

Definition at line 238 of file class.assQuestionGUI.php.

238 : bool
239 {
240 return static::HAS_SPECIAL_QUESTION_COMMANDS;
241 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ isAdjustmentEditContext()

assQuestionGUI::isAdjustmentEditContext ( )

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

339 : bool
340 {
342 }

References EDIT_CONTEXT_ADJUSTMENT, and getEditContext().

+ Here is the call graph for this function:

◆ isAnswerFrequencyStatisticSupported()

assQuestionGUI::isAnswerFrequencyStatisticSupported ( )

Definition at line 1985 of file class.assQuestionGUI.php.

1985 : bool
1986 {
1987 return true;
1988 }

Referenced by ilTestCorrectionsGUI\setCorrectionTabsContext().

+ Here is the caller graph for this function:

◆ isAuthoringEditContext()

assQuestionGUI::isAuthoringEditContext ( )

Definition at line 334 of file class.assQuestionGUI.php.

334 : bool
335 {
337 }

References EDIT_CONTEXT_AUTHORING, and getEditContext().

+ Here is the call graph for this function:

◆ isAutosaveable()

assQuestionGUI::isAutosaveable ( )

Definition at line 1853 of file class.assQuestionGUI.php.

1853 : bool
1854 {
1855 return $this->object->isAutosaveable();
1856 }

◆ isPreviousSolutionPrefilled()

assQuestionGUI::isPreviousSolutionPrefilled ( )

Definition at line 265 of file class.assQuestionGUI.php.

265 : bool
266 {
268 }

References $previousSolutionPrefilled.

◆ isRenderPurposeDemoplay()

assQuestionGUI::isRenderPurposeDemoplay ( )

Definition at line 306 of file class.assQuestionGUI.php.

306 : bool
307 {
309 }

References getRenderPurpose(), and RENDER_PURPOSE_DEMOPLAY.

+ Here is the call graph for this function:

◆ isRenderPurposeInputValue()

assQuestionGUI::isRenderPurposeInputValue ( )

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

296 : bool
297 {
299 }

References getRenderPurpose(), and RENDER_PURPOSE_INPUT_VALUE.

Referenced by renderPurposeSupportsFormHtml().

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

◆ isRenderPurposePlayback()

assQuestionGUI::isRenderPurposePlayback ( )

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

301 : bool
302 {
304 }

References getRenderPurpose(), and RENDER_PURPOSE_PLAYBACK.

+ Here is the call graph for this function:

◆ isRenderPurposePreview()

assQuestionGUI::isRenderPurposePreview ( )

Definition at line 291 of file class.assQuestionGUI.php.

291 : bool
292 {
294 }

References getRenderPurpose(), and RENDER_PURPOSE_PREVIEW.

+ Here is the call graph for this function:

◆ isRenderPurposePrintPdf()

assQuestionGUI::isRenderPurposePrintPdf ( )

Definition at line 286 of file class.assQuestionGUI.php.

286 : bool
287 {
289 }

References getRenderPurpose(), and RENDER_PURPOSE_PRINT_PDF.

Referenced by assOrderingQuestionGUI\buildNestingForm(), assOrderingQuestionGUI\populateAnswerSpecificFormPart(), and renderPurposeSupportsFormHtml().

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

◆ isSaveCommand()

assQuestionGUI::isSaveCommand ( )

Reimplemented in assFormulaQuestionGUI.

Definition at line 1691 of file class.assQuestionGUI.php.

1691 : bool
1692 {
1693 return in_array($this->ctrl->getCmd(), array('save', 'saveEdit', 'saveReturn'));
1694 }

References ILIAS\Repository\ctrl().

Referenced by assClozeTestGUI\editQuestion(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assMultipleChoiceGUI\editQuestion(), assNumericGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assTextQuestionGUI\editQuestion(), and assTextSubsetGUI\editQuestion().

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

◆ isTestPresentationContext()

assQuestionGUI::isTestPresentationContext ( )

Definition at line 259 of file class.assQuestionGUI.php.

259 : bool
260 {
262 }

References getPresentationContext(), and PRESENTATION_CONTEXT_TEST.

+ Here is the call graph for this function:

◆ linkChilds()

assQuestionGUI::linkChilds ( )

Definition at line 1636 of file class.assQuestionGUI.php.

1636 : void
1637 {
1638 $this->ctrl->saveParameter($this, array("subquestion_index", "link_new_type", "search_link_type"));
1639 switch ($this->request->raw("search_link_type")) {
1640 case "pg":
1641 $this->outPageSelector();
1642 break;
1643 case "st":
1644 $this->outChapterSelector();
1645 break;
1646 case "glo":
1647 $this->outGlossarySelector();
1648 break;
1649 case "lm":
1650 $subquestion_index = ($this->request->raw("subquestion_index") > 0) ? $this->request->raw("subquestion_index") : 0;
1651 $this->object->saveSuggestedSolution("lm", "il__lm_" . $this->request->raw("source_id"), $subquestion_index);
1652 $this->tpl->setOnScreenMessage('success', $this->lng->txt("suggested_solution_added_successfully"), true);
1653 $this->ctrl->redirect($this, "suggestedsolution");
1654 break;
1655 }
1656 }

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

+ Here is the call graph for this function:

◆ magicAfterTestOutput()

assQuestionGUI::magicAfterTestOutput ( )

Reimplemented in assTextQuestionGUI.

Definition at line 1912 of file class.assQuestionGUI.php.

1912 : void
1913 {
1914 return;
1915 }

◆ originalSyncForm()

assQuestionGUI::originalSyncForm ( string  $return_to = "",
string  $return_to_feedback = '' 
)

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

597 : void
598 {
599 if (strlen($return_to)) {
600 $this->ctrl->setParameter($this, "return_to", $return_to);
601 } elseif ($this->request->raw('return_to')) {
602 $this->ctrl->setParameter($this, "return_to", $this->request->raw('return_to'));
603 }
604 if (strlen($return_to_feedback)) {
605 $this->ctrl->setParameter($this, 'return_to_fb', 'true');
606 }
607
608 $this->ctrl->saveParameter($this, 'test_express_mode');
609
610 $template = new ilTemplate("tpl.il_as_qpl_sync_original.html", true, true, "Modules/TestQuestionPool");
611 $template->setVariable("BUTTON_YES", $this->lng->txt("yes"));
612 $template->setVariable("BUTTON_NO", $this->lng->txt("no"));
613 $template->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
614 $template->setVariable("TEXT_SYNC", $this->lng->txt("confirm_sync_questions"));
615 $this->tpl->setVariable("ADM_CONTENT", $template->get());
616 }

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

+ Here is the call graph for this function:

◆ outAdditionalOutput()

assQuestionGUI::outAdditionalOutput ( )

Why are you here? Some magic for plugins?

Definition at line 955 of file class.assQuestionGUI.php.

955 : void
956 {
957 }

Referenced by assTextQuestionGUI\magicAfterTestOutput().

+ Here is the caller graph for this function:

◆ outChapterSelector()

assQuestionGUI::outChapterSelector ( )

Definition at line 1580 of file class.assQuestionGUI.php.

1580 : void
1581 {
1582 $this->ctrl->setParameter($this, 'q_id', $this->object->getId());
1583
1584 $cont_obj_gui = new ilObjContentObjectGUI('', $this->request->raw('source_id'), true);
1585 $cont_obj = $cont_obj_gui->getObject();
1586 $ctree = $cont_obj->getLMTree();
1587 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
1588
1589 $rows = array();
1590
1591 foreach ($nodes as $node) {
1592 if ($node['type'] == $this->request->raw('search_link_type')) {
1593 $this->ctrl->setParameter($this, $node['type'], $node['obj_id']);
1594 $rows[] = array(
1595 'title' => $node['title'],
1596 'description' => '',
1597 'text_add' => $this->lng->txt('add'),
1598 'href_add' => $this->ctrl->getLinkTarget($this, 'add' . strtoupper($node['type']))
1599 );
1600 }
1601 }
1602
1603 $table = new ilQuestionInternalLinkSelectionTableGUI($this, 'cancelExplorer', __METHOD__);
1604 $table->setTitle($this->lng->txt('obj_' . ilUtil::stripSlashes($this->request->raw('search_link_type'))));
1605 $table->setData($rows);
1606
1607 $this->tpl->setContent($table->getHTML());
1608 }
Class ilObjContentObjectGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$rows
Definition: xhr_table.php:10

References $rows, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ outGlossarySelector()

assQuestionGUI::outGlossarySelector ( )

Definition at line 1610 of file class.assQuestionGUI.php.

1610 : void
1611 {
1612 $this->ctrl->setParameter($this, 'q_id', $this->object->getId());
1613
1614 $glossary = new ilObjGlossary($this->request->raw('source_id'), true);
1615 $terms = $glossary->getTermList();
1616
1617 $rows = array();
1618
1619 foreach ($terms as $term) {
1620 $this->ctrl->setParameter($this, 'git', $term['id']);
1621 $rows[] = array(
1622 'title' => $term['term'],
1623 'description' => '',
1624 'text_add' => $this->lng->txt('add'),
1625 'href_add' => $this->ctrl->getLinkTarget($this, 'addGIT')
1626 );
1627 }
1628
1629 $table = new ilQuestionInternalLinkSelectionTableGUI($this, 'cancelExplorer', __METHOD__);
1630 $table->setTitle($this->lng->txt('glossary_term'));
1631 $table->setData($rows);
1632
1633 $this->tpl->setContent($table->getHTML());
1634 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $rows, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ outPageSelector()

assQuestionGUI::outPageSelector ( )

Definition at line 1526 of file class.assQuestionGUI.php.

1526 : void
1527 {
1528 $this->ctrl->setParameter($this, 'q_id', $this->object->getId());
1529
1530 $cont_obj_gui = new ilObjContentObjectGUI('', $this->request->raw('source_id'), true);
1531 $cont_obj = $cont_obj_gui->getObject();
1532 $pages = ilLMPageObject::getPageList($cont_obj->getId());
1533 $shownpages = array();
1534 $tree = $cont_obj->getLMTree();
1535 $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1536
1537 $rows = array();
1538
1539 foreach ($chapters as $chapter) {
1540 $chapterpages = $tree->getChildsByType($chapter['obj_id'], 'pg');
1541 foreach ($chapterpages as $page) {
1542 if ($page['type'] == $this->request->raw('search_link_type')) {
1543 array_push($shownpages, $page['obj_id']);
1544
1545 if ($tree->isInTree($page['obj_id'])) {
1546 $path_str = $this->getContextPath($cont_obj, $page['obj_id']);
1547 } else {
1548 $path_str = '---';
1549 }
1550
1551 $this->ctrl->setParameter($this, $page['type'], $page['obj_id']);
1552 $rows[] = array(
1553 'title' => $page['title'],
1554 'description' => ilLegacyFormElementsUtil::prepareFormOutput($path_str),
1555 'text_add' => $this->lng->txt('add'),
1556 'href_add' => $this->ctrl->getLinkTarget($this, 'add' . strtoupper($page['type']))
1557 );
1558 }
1559 }
1560 }
1561 foreach ($pages as $page) {
1562 if (!in_array($page['obj_id'], $shownpages)) {
1563 $this->ctrl->setParameter($this, $page['type'], $page['obj_id']);
1564 $rows[] = array(
1565 'title' => $page['title'],
1566 'description' => '---',
1567 'text_add' => $this->lng->txt('add'),
1568 'href_add' => $this->ctrl->getLinkTarget($this, 'add' . strtoupper($page['type']))
1569 );
1570 }
1571 }
1572
1573 $table = new ilQuestionInternalLinkSelectionTableGUI($this, 'cancelExplorer', __METHOD__);
1574 $table->setTitle($this->lng->txt('obj_' . ilUtil::stripSlashes($this->request->raw('search_link_type'))));
1575 $table->setData($rows);
1576
1577 $this->tpl->setContent($table->getHTML());
1578 }
getContextPath($cont_obj, int $a_endnode_id, int $a_startnode_id=1)
get context path in content object tree
static getPageList(int $lm_id)

References $rows, ILIAS\Repository\ctrl(), ilLMPageObject\getPageList(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ outQuestionForTest()

assQuestionGUI::outQuestionForTest ( string  $formaction,
int  $active_id,
?int  $pass,
bool  $is_question_postponed = false,
  $user_post_solutions = false,
bool  $show_specific_inline_feedback = false 
)
final

Definition at line 1879 of file class.assQuestionGUI.php.

1886 : void {
1887 $formaction = $this->completeTestOutputFormAction($formaction, $active_id, $pass);
1888
1889 $test_output = $this->getTestOutput(
1890 $active_id,
1891 $pass,
1892 $is_question_postponed,
1893 $user_post_solutions,
1894 $show_specific_inline_feedback
1895 );
1896
1897 $this->magicAfterTestOutput();
1898
1899 $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
1900 $this->tpl->setVariable("FORMACTION", $formaction);
1901 $this->tpl->setVariable("ENCTYPE", 'enctype="' . $this->getFormEncodingType() . '"');
1902 $this->tpl->setVariable("FORM_TIMESTAMP", (string) time());
1903 }
getTestOutput( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
completeTestOutputFormAction($formAction, $active_id, $pass)

Referenced by ilTestPlayerAbstractGUI\showQuestionEditable().

+ Here is the caller graph for this function:

◆ outQuestionPage()

assQuestionGUI::outQuestionPage (   $a_temp_var,
  $a_postponed = false,
  $active_id = "",
  $html = "",
  $inlineFeedbackEnabled = false 
)

Definition at line 529 of file class.assQuestionGUI.php.

529 : string
530 {
531 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
532 // hey
533 $this->tpl->setOnScreenMessage('info', $this->getPreviousSolutionProvidedMessage());
535 } elseif ($this->object->getTestPresentationConfig()->isUnchangedAnswerPossible()) {
536 $html .= $this->getUseUnchangedAnswerCheckboxHtml();
537 }
538
539 $this->lng->loadLanguageModule("content");
540
541 $page_gui = new ilAssQuestionPageGUI($this->object->getId());
542 $page_gui->setOutputMode("presentation");
543 $page_gui->setTemplateTargetVar($a_temp_var);
544
545 if ($this->getNavigationGUI()) {
546 $html .= $this->getNavigationGUI()->getHTML();
547 $page_gui->setQuestionActionsHTML($this->getNavigationGUI()->getActionsHTML());
548 }
549
550 if (strlen($html)) {
551 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
552 }
553
554 $page_gui->setPresentationTitle($this->questionHeaderBlockBuilder->getPresentationTitle());
555 $page_gui->setQuestionInfoHTML($this->questionHeaderBlockBuilder->getQuestionInfoHTML());
556
557 return $page_gui->presentation();
558 }

References getNavigationGUI(), getPreviousSolutionConfirmationCheckboxHtml(), getPreviousSolutionProvidedMessage(), getUseUnchangedAnswerCheckboxHtml(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by ilTestPlayerAbstractGUI\populateInstantResponseModal(), and ilTestPlayerAbstractGUI\showQuestionViewable().

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

◆ outQuestionType()

assQuestionGUI::outQuestionType ( )

Definition at line 1195 of file class.assQuestionGUI.php.

1195 : string
1196 {
1197 $count = $this->object->usageNumber();
1198
1199 if ($this->object->_questionExistsInPool($this->object->getId()) && $count) {
1200 global $DIC;
1201 $rbacsystem = $DIC['rbacsystem'];
1202 if ($rbacsystem->checkAccess("write", $this->request->getRefId())) {
1203 $this->tpl->setOnScreenMessage('info', sprintf($this->lng->txt("qpl_question_is_in_use"), $count));
1204 }
1205 }
1206
1207 return assQuestion::_getQuestionTypeName($this->object->getQuestionType());
1208 }
static _getQuestionTypeName($type_tag)

References $DIC, assQuestion\_getQuestionTypeName(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by assOrderingQuestionGUI\buildEditForm(), assOrderingQuestionGUI\buildNestingForm(), assClozeTestGUI\editQuestion(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assNumericGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assTextQuestionGUI\editQuestion(), assTextSubsetGUI\editQuestion(), and ilTestCorrectionsGUI\populatePageTitleAndDescription().

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

◆ outSolutionExplorer()

assQuestionGUI::outSolutionExplorer ( )

Definition at line 1450 of file class.assQuestionGUI.php.

1450 : void
1451 {
1452 global $DIC;
1453 $tree = $DIC['tree'];
1454
1455 $type = $this->request->raw("link_new_type");
1456 $search = $this->request->raw("search_link_type");
1457 $this->ctrl->setParameter($this, "link_new_type", $type);
1458 $this->ctrl->setParameter($this, "search_link_type", $search);
1459 $this->ctrl->saveParameter($this, array("subquestion_index", "link_new_type", "search_link_type"));
1460
1461 $this->tpl->setOnScreenMessage('info', $this->lng->txt("select_object_to_link"));
1462
1463 $parent_ref_id = $tree->getParentId($this->request->getRefId());
1464 $exp = new ilSolutionExplorer($this->ctrl->getLinkTarget($this, 'suggestedsolution'), get_class($this));
1465 $exp->setExpand($this->request->raw('expand_sol') ? $this->request->raw('expand_sol') : $parent_ref_id);
1466 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'outSolutionExplorer'));
1467 $exp->setTargetGet("ref_id");
1468 $exp->setRefId($this->request->getRefId());
1469 $exp->addFilter($type);
1470 $exp->setSelectableType($type);
1471 if ($this->request->isset('expandCurrentPath') && $this->request->raw('expandCurrentPath')) {
1472 $exp->expandPathByRefId($parent_ref_id);
1473 }
1474
1475 // build html-output
1476 $exp->setOutput(0);
1477
1478 $template = new ilTemplate("tpl.il_as_qpl_explorer.html", true, true, "Modules/TestQuestionPool");
1479 $template->setVariable("EXPLORER_TREE", $exp->getOutput());
1480 $template->setVariable("BUTTON_CANCEL", $this->lng->txt("cancel"));
1481 $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "suggestedsolution"));
1482 $this->tpl->setVariable("ADM_CONTENT", $template->get());
1483 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type

References $DIC, $type, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ populateCorrectionsFormProperties()

◆ populateJavascriptFilesRequiredForWorkForm()

assQuestionGUI::populateJavascriptFilesRequiredForWorkForm ( ilGlobalTemplateInterface  $tpl)

Definition at line 481 of file class.assQuestionGUI.php.

481 : void
482 {
483 foreach ($this->getPresentationJavascripts() as $jsFile) {
484 $tpl->addJavaScript($jsFile);
485 }
486 }
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.

References $tpl, ilGlobalPageTemplate\addJavaScript(), and getPresentationJavascripts().

+ Here is the call graph for this function:

◆ populateTaxonomyFormSection()

assQuestionGUI::populateTaxonomyFormSection ( ilPropertyFormGUI  $form)
protected

Definition at line 1102 of file class.assQuestionGUI.php.

1102 : void
1103 {
1104 if ($this->getTaxonomyIds() !== []) {
1105 // this is needed by ilTaxSelectInputGUI in some cases
1106 ilOverlayGUI::initJavaScript();
1107
1108 $sectHeader = new ilFormSectionHeaderGUI();
1109 $sectHeader->setTitle($this->lng->txt('qpl_qst_edit_form_taxonomy_section'));
1110 $form->addItem($sectHeader);
1111
1112 foreach ($this->getTaxonomyIds() as $taxonomyId) {
1113 $taxonomy = new ilObjTaxonomy($taxonomyId);
1114 $label = sprintf($this->lng->txt('qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle());
1115 $postvar = "tax_node_assign_$taxonomyId";
1116
1117 $taxSelect = new ilTaxSelectInputGUI($taxonomy->getId(), $postvar, true);
1118 $taxSelect->setTitle($label);
1119
1120
1121 $taxNodeAssignments = new ilTaxNodeAssignment(ilObject::_lookupType($this->object->getObjId()), $this->object->getObjId(), 'quest', $taxonomyId);
1122 $assignedNodes = $taxNodeAssignments->getAssignmentsOfItem($this->object->getId());
1123
1124 $taxSelect->setValue(array_map(function ($assignedNode) {
1125 return $assignedNode['node_id'];
1126 }, $assignedNodes));
1127 $form->addItem($taxSelect);
1128 }
1129 }
1130 }
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...
static _lookupType(int $id, bool $reference=false)
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...

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

Referenced by assImagemapQuestionGUI\buildEditForm(), assKprimChoiceGUI\buildEditForm(), assLongMenuGUI\buildEditForm(), assOrderingQuestionGUI\buildEditForm(), assClozeTestGUI\editQuestion(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assMatchingQuestionGUI\editQuestion(), assNumericGUI\editQuestion(), assOrderingHorizontalGUI\editQuestion(), assSingleChoiceGUI\editQuestion(), assTextQuestionGUI\editQuestion(), and assTextSubsetGUI\editQuestion().

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

◆ prepareReprintableCorrectionsForm()

assQuestionGUI::prepareReprintableCorrectionsForm ( ilPropertyFormGUI  $form)

Reimplemented in assOrderingQuestionGUI.

Definition at line 2009 of file class.assQuestionGUI.php.

2009 : void
2010 {
2011 }

◆ prepareTextareaOutput()

static assQuestionGUI::prepareTextareaOutput (   $txt_output,
  $prepare_for_latex_output = false,
  $omitNl2BrWhenTextArea = false 
)
static

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.

Parameters
string$txt_outputString which should be prepared for output @access public

Definition at line 2056 of file class.assQuestionGUI.php.

2057 {
2058 $result = $txt_output;
2059 $is_html = false;
2060 if (strlen(strip_tags($result)) < strlen($result)) {
2061 $is_html = true;
2062 }
2063
2064 // removed: did not work with magic_quotes_gpc = On
2065 if (!$is_html) {
2066 if (!$omitNl2BrWhenTextArea) {
2067 // if the string does not contain HTML code, replace the newlines with HTML line breaks
2068 $result = preg_replace("/[\n]/", "<br />", $result);
2069 }
2070 } else {
2071 // patch for problems with the <pre> tags in tinyMCE
2072 if (preg_match_all("/(<pre>.*?<\/pre>)/ims", $result, $matches)) {
2073 foreach ($matches[0] as $found) {
2074 $replacement = "";
2075 if (strpos("\n", $found) === false) {
2076 $replacement = "\n";
2077 }
2078 $removed = preg_replace("/<br\s*?\/>/ims", $replacement, $found);
2079 $result = str_replace($found, $removed, $result);
2080 }
2081 }
2082 }
2083
2084 // since server side mathjax rendering does include svg-xml structures that indeed have linebreaks,
2085 // do latex conversion AFTER replacing linebreaks with <br>. <svg> tag MUST NOT contain any <br> tags.
2086 if ($prepare_for_latex_output) {
2087 $result = ilMathJax::getInstance()->insertLatexImages($result, "<span class\=\"latex\">", "<\/span>");
2088 $result = ilMathJax::getInstance()->insertLatexImages($result, "\[tex\]", "\[\/tex\]");
2089 }
2090
2091 if ($prepare_for_latex_output) {
2092 // replace special characters to prevent problems with the ILIAS template system
2093 // eg. if someone uses {1} as an answer, nothing will be shown without the replacement
2094 $result = str_replace("{", "&#123;", $result);
2095 $result = str_replace("}", "&#125;", $result);
2096 $result = str_replace("\\", "&#92;", $result);
2097 }
2098
2099 return $result;
2100 }
static getInstance()
Singleton: get instance for use in ILIAS requests with a config loaded from the settings.

References ilMathJax\getInstance().

+ Here is the call graph for this function:

◆ redrawHeaderAction()

assQuestionGUI::redrawHeaderAction ( )

Definition at line 166 of file class.assQuestionGUI.php.

166 : void
167 {
168 echo $this->getHeaderAction() . $this->ui->mainTemplate()->getOnLoadCodeForAsynch();
169 exit;
170 }
exit
Definition: login.php:28

References exit, getHeaderAction(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ renderEditForm()

assQuestionGUI::renderEditForm ( ilPropertyFormGUI  $form)
protected

Definition at line 509 of file class.assQuestionGUI.php.

509 : void
510 {
511 $this->getQuestionTemplate();
512 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
513 }

References ilPropertyFormGUI\getHTML(), and getQuestionTemplate().

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

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

◆ renderPurposeSupportsFormHtml()

assQuestionGUI::renderPurposeSupportsFormHtml ( )

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

311 : bool
312 {
313 if ($this->isRenderPurposePrintPdf()) {
314 return false;
315 }
316
317 if ($this->isRenderPurposeInputValue()) {
318 return false;
319 }
320
321 return true;
322 }

References isRenderPurposeInputValue(), and isRenderPurposePrintPdf().

+ Here is the call graph for this function:

◆ save()

assQuestionGUI::save ( )

Definition at line 719 of file class.assQuestionGUI.php.

719 : void
720 {
722 $old_id = $this->request->raw("q_id");
723 $result = $this->writePostData();
724
725 if ($result == 0) {
726 $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
727 $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
728 $this->object->saveToDb();
729 if ($this->object->getOriginalId() == null) {
730 $originalexists = false;
731 } else {
732 $originalexists = $this->object->_questionExistsInPool($this->object->getOriginalId());
733 }
734
735 if (($this->request->raw("calling_test") ||
736 ($this->request->isset('calling_consumer')
737 && (int) $this->request->raw('calling_consumer')))
738 && $originalexists && assQuestion::_isWriteable($this->object->getOriginalId(), $ilUser->getId())) {
739 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
740 $this->ctrl->setParameter($this, 'return_to', 'editQuestion');
741 $this->ctrl->redirect($this, "originalSyncForm");
742 return;
743 }
744
745 if ($this->request->raw("calling_test")) {
746 $test = new ilObjTest($this->request->raw("calling_test"));
747 if (!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())) {
750 global $DIC;
751 $component_repository = $DIC['component.repository'];
752
753 $test = new ilObjTest($this->request->raw("calling_test"), true);
754 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $component_repository, $test);
755
756 $new_q_id = $this->object->getId();
757 if ($test->getRefId() !== $this->request->int('ref_id')) {
758 $new_q_id = $this->object->duplicate(true, $this->object->getTitle(), $this->object->getAuthor(), $this->object->getOwner(), $test->getId());
759 }
760
761 $test->insertQuestion(
762 $testQuestionSetConfigFactory->getQuestionSetConfig(),
763 $new_q_id,
764 true
765 );
766
767 if ($this->request->isset('prev_qid')) {
768 $test->moveQuestionAfter($new_q_id, $this->request->raw('prev_qid'));
769 }
770
771 $this->ctrl->setParameter($this, 'q_id', $new_q_id);
772 $this->ctrl->setParameter($this, 'ref_id', $this->request->raw('calling_test'));
773 $this->ctrl->setParameter($this, 'calling_test', $this->request->raw("calling_test"));
774 }
775 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
776 $this->ctrl->redirect($this, 'editQuestion');
777 } else {
778 $this->callNewIdListeners($this->object->getId());
779
780 if ($this->object->getId() != $old_id) {
781 // first save
782 $this->ctrl->setParameterByClass($this->request->raw("cmdClass"), "q_id", $this->object->getId());
783 $this->ctrl->setParameterByClass($this->request->raw("cmdClass"), "sel_question_types", $this->request->raw("sel_question_types"));
784 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
785 if ($this->request->raw('prev_qid')) {
786 // @todo: bheyser/mbecker wtf? ..... thx@jposselt ....
787 $test = new ilObjTest($this->request->getRefId(), true);
788 $test->moveQuestionAfter($this->request->raw('prev_qid'), $this->object->getId());
789 }
790 if ($this->request->raw('express_mode')) {
794
795 // TODO: Courier Antipattern!
796 $test = new ilObjTest($this->request->getRefId(), true);
797 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $component_repository, $test);
798 $test->insertQuestion(
799 $testQuestionSetConfigFactory->getQuestionSetConfig(),
800 $this->object->getId()
801 );
802 $_REQUEST['q_id'] = $this->object->getId();
804 }
805
806 $this->ctrl->redirectByClass($this->request->raw("cmdClass"), "editQuestion");
807 }
808 if (ilSession::get("info") != null) {
809 $this->tpl->setOnScreenMessage('success', ilSession::get("info") . "<br />" . $this->lng->txt("msg_obj_modified"), true);
810 } else {
811 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
812 }
813 $this->ctrl->redirect($this, 'editQuestion');
814 }
815 }
816 $tabs = $this->ilTabs;
817 $tabs->setTabActive('edit_question');
818 }
callNewIdListeners(int $a_new_id)
ilComponentRepository $component_repository
static _questionExistsInTest(int $question_id, int $test_id)
static _isWriteable(int $question_id, int $user_id)
setPref(string $a_keyword, ?string $a_value)
writePref(string $a_keyword, string $a_value)
static get(string $a_var)
setTabActive(string $a_id)

References $component_repository, $DIC, $ilDB, $ilTabs, $ilUser, $tree, assQuestion\_isWriteable(), assQuestion\_questionExistsInTest(), callNewIdListeners(), ILIAS\Repository\ctrl(), ilSession\get(), ilObject\getId(), ilTestExpressPage\getReturnToPageLink(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilUtil\redirect(), ilObjUser\setPref(), ilTabsGUI\setTabActive(), writePostData(), and ilObjUser\writePref().

Referenced by assFormulaQuestionGUI\saveFQ().

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

◆ saveCorrectionsFormProperties()

◆ saveEdit()

assQuestionGUI::saveEdit ( )

Definition at line 675 of file class.assQuestionGUI.php.

675 : void
676 {
678 $result = $this->writePostData();
679 if ($result == 0) {
680 $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
681 $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
682 $this->object->saveToDb();
683 $originalexists = $this->object->_questionExists($this->object->getOriginalId());
684
685 if ($this->request->raw("calling_test") && $originalexists && assQuestion::_isWriteable($this->object->getOriginalId(), $ilUser->getId())) {
686 $this->ctrl->redirect($this, "originalSyncForm");
687 } elseif ($this->request->raw("calling_test")) {
688 $_GET["ref_id"] = $this->request->raw("calling_test");
689 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $this->request->raw("calling_test"));
690 return;
691 } elseif ($this->request->raw("test_ref_id")) {
692 global $DIC;
693 $tree = $DIC['tree'];
694 $ilDB = $DIC['ilDB'];
695 $component_repository = $DIC['component.repository'];
696 // TODO: Courier Antipattern!
697 $_GET["ref_id"] = $this->request->raw("test_ref_id");
698 $test = new ilObjTest($this->request->raw("test_ref_id"), true);
699
700 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $component_repository, $test);
701
702 $test->insertQuestion($testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId());
703
704 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $this->request->raw("test_ref_id"));
705 } else {
706 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
707 $this->editQuestion();
708 if (ilSession::get("info") != null) {
709 $this->tpl->setOnScreenMessage('success', ilSession::get("info") . "<br />" . $this->lng->txt("msg_obj_modified"), false);
710 } else {
711 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), false);
712 }
713 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $this->object->getId());
714 $this->ctrl->redirectByClass("ilAssQuestionPageGUI", "edit");
715 }
716 }
717 }

References $_GET, $component_repository, $DIC, $ilDB, $ilUser, $tree, assQuestion\_isWriteable(), ILIAS\Repository\ctrl(), ilSession\get(), ilObject\getId(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilUtil\redirect(), ilObjUser\setPref(), writePostData(), and ilObjUser\writePref().

+ Here is the call graph for this function:

◆ saveReturn()

assQuestionGUI::saveReturn ( )

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

820 : void
821 {
823 $old_id = $this->request->getQuestionId();
824 $result = $this->writePostData();
825 if ($result == 0) {
826 $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
827 $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
828 $this->object->saveToDb($old_id);
829 if ($this->object->getOriginalId() == null) {
830 $originalexists = false;
831 } else {
832 $originalexists = $this->object->_questionExistsInPool($this->object->getOriginalId());
833 }
834 if (($this->request->raw("calling_test") || ($this->request->isset('calling_consumer')
835 && (int) $this->request->raw('calling_consumer')))
836 && $originalexists && assQuestion::_isWriteable($this->object->getOriginalId(), $ilUser->getId())) {
837 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
838 $this->ctrl->setParameter($this, 'test_express_mode', $this->request->raw('test_express_mode'));
839 $this->ctrl->redirect($this, "originalSyncForm");
840 return;
841 } elseif ($this->request->raw("calling_test")) {
842 $test = new ilObjTest($this->request->raw("calling_test"));
843 if (!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())) {
847 $test = new ilObjTest($this->request->raw("calling_test"), true);
848
849 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $component_repository, $test);
850
851 $new_q_id = $this->object->getId();
852 if ($test->getRefId() !== $this->request->int('ref_id')) {
853 $new_q_id = $this->object->duplicate(true, $this->object->getTitle(), $this->object->getAuthor(), $this->object->getOwner(), $test->getId());
854 }
855
856 $test->insertQuestion(
857 $testQuestionSetConfigFactory->getQuestionSetConfig(),
858 $new_q_id,
859 true
860 );
861
862 if ($this->request->isset('prev_qid')) {
863 $test->moveQuestionAfter($new_q_id, $this->request->raw('prev_qid'));
864 }
865
866 $this->ctrl->setParameter($this, 'q_id', $new_q_id);
867 $this->ctrl->setParameter($this, 'ref_id', $this->request->raw('calling_test'));
868 $this->ctrl->setParameter($this, 'calling_test', $this->request->raw("calling_test"));
869 }
870 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
871 $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
872 } else {
873 if ($this->object->getId() != $old_id) {
874 $this->callNewIdListeners($this->object->getId());
875 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
876 $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
877 }
878 if (ilSession::get("info") != null) {
879 $this->tpl->setOnScreenMessage('success', ilSession::get("info") . "<br />" . $this->lng->txt("msg_obj_modified"), true);
880 } else {
881 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
882 }
883 $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
884 }
885 }
886 $tabs = $this->ilTabs;
887 $tabs->setTabActive('edit_question');
888 }

References $component_repository, $ilDB, $ilTabs, $ilUser, $tree, assQuestion\_isWriteable(), assQuestion\_questionExistsInTest(), callNewIdListeners(), ilAssQuestionPreviewGUI\CMD_SHOW, ILIAS\Repository\ctrl(), ilSession\get(), ilObject\getId(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilObjUser\setPref(), ilTabsGUI\setTabActive(), writePostData(), and ilObjUser\writePref().

+ Here is the call graph for this function:

◆ saveSuggestedSolutionType()

assQuestionGUI::saveSuggestedSolutionType ( )

Definition at line 1485 of file class.assQuestionGUI.php.

1485 : void
1486 {
1487 global $DIC;
1488 $tree = $DIC['tree'];
1489
1490 switch ($_POST["solutiontype"]) {
1491 case "lm":
1492 $type = "lm";
1493 $search = "lm";
1494 break;
1495 case "git":
1496 $type = "glo";
1497 $search = "glo";
1498 break;
1499 case "st":
1500 $type = "lm";
1501 $search = "st";
1502 break;
1503 case "pg":
1504 $type = "lm";
1505 $search = "pg";
1506 break;
1507 case "file":
1508 case "text":
1509 default:
1510 $this->suggestedsolution();
1511 return;
1512 }
1513 if (isset($_POST['solutiontype'])) {
1514 $this->ctrl->setParameter($this, 'expandCurrentPath', 1);
1515 }
1516 $this->ctrl->setParameter($this, "link_new_type", $type);
1517 $this->ctrl->setParameter($this, "search_link_type", $search);
1518 $this->ctrl->redirect($this, "outSolutionExplorer");
1519 }

References $DIC, $type, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ saveTaxonomyAssignments()

assQuestionGUI::saveTaxonomyAssignments ( )
protected

Definition at line 1089 of file class.assQuestionGUI.php.

1089 : void
1090 {
1091 if (count($this->getTaxonomyIds())) {
1092 foreach ($this->getTaxonomyIds() as $taxonomyId) {
1093 $postvar = "tax_node_assign_$taxonomyId";
1094
1095 $tax_node_assign = new ilTaxAssignInputGUI($taxonomyId, true, '', $postvar);
1096 // TODO: determine tst/qpl when tax assigns become maintainable within tests
1097 $tax_node_assign->saveInput("qpl", $this->object->getObjId(), "quest", $this->object->getId());
1098 }
1099 }
1100 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

Referenced by assErrorTextGUI\analyze(), assFormulaQuestionGUI\saveFQ(), assFormulaQuestionGUI\saveReturnFQ(), assClozeTestGUI\writePostData(), assErrorTextGUI\writePostData(), assFileUploadGUI\writePostData(), assImagemapQuestionGUI\writePostData(), assKprimChoiceGUI\writePostData(), assLongMenuGUI\writePostData(), assMatchingQuestionGUI\writePostData(), assMultipleChoiceGUI\writePostData(), assNumericGUI\writePostData(), assOrderingHorizontalGUI\writePostData(), assOrderingQuestionGUI\writePostData(), assSingleChoiceGUI\writePostData(), assTextQuestionGUI\writePostData(), assTextSubsetGUI\writePostData(), and assLongMenuGUI\writeQuestionSpecificPostData().

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

◆ setAdjustmentEditContext()

assQuestionGUI::setAdjustmentEditContext ( )

Definition at line 344 of file class.assQuestionGUI.php.

344 : void
345 {
346 $this->setEditContext(self::EDIT_CONTEXT_ADJUSTMENT);
347 }
setEditContext(string $editContext)

References setEditContext().

+ Here is the call graph for this function:

◆ setDefaultTabs()

assQuestionGUI::setDefaultTabs ( ilTabsGUI  $ilTabs)
protected

Definition at line 1726 of file class.assQuestionGUI.php.

1726 : void
1727 {
1728 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $this->request->getQuestionId());
1729 $q_type = $this->object->getQuestionType();
1730
1731 if (strlen($q_type)) {
1732 $classname = $q_type . "GUI";
1733 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
1734 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $this->request->getQuestionId());
1735 }
1736
1737 if ($this->request->isset("q_id")) {
1738 $this->addTab_Question($ilTabs);
1739 }
1740
1741 // add tab for question feedback within common class assQuestionGUI
1742 $this->addTab_QuestionFeedback($ilTabs);
1743
1744 // add tab for question hint within common class assQuestionGUI
1745 $this->addTab_QuestionHints($ilTabs);
1746
1747 // add tab for question's suggested solution within common class assQuestionGUI
1748 $this->addTab_SuggestedSolution($ilTabs, $classname);
1749
1750 $this->addBackTab($ilTabs);
1751 }
addTab_QuestionHints(ilTabsGUI $tabs)
addTab_Question(ilTabsGUI $tabsGUI)
addTab_SuggestedSolution(ilTabsGUI $tabs, string $classname)
addBackTab(ilTabsGUI $ilTabs)
addTab_QuestionFeedback(ilTabsGUI $tabs)

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ setEditContext()

assQuestionGUI::setEditContext ( string  $editContext)

Definition at line 329 of file class.assQuestionGUI.php.

329 : void
330 {
331 $this->editContext = $editContext;
332 }

References $editContext.

Referenced by setAdjustmentEditContext().

+ Here is the caller graph for this function:

◆ setErrorMessage()

assQuestionGUI::setErrorMessage ( string  $errormessage)

Definition at line 944 of file class.assQuestionGUI.php.

944 : void
945 {
946 $this->errormessage = $errormessage;
947 }

References $errormessage.

Referenced by assErrorTextGUI\__construct(), assFileUploadGUI\__construct(), assMatchingQuestionGUI\__construct(), and assOrderingHorizontalGUI\__construct().

+ Here is the caller graph for this function:

◆ setNavigationGUI()

assQuestionGUI::setNavigationGUI ( ?ilTestQuestionNavigationGUI  $navigationGUI)

Definition at line 354 of file class.assQuestionGUI.php.

354 : void
355 {
356 $this->navigationGUI = $navigationGUI;
357 }

References $navigationGUI.

Referenced by ilTestPlayerAbstractGUI\populateInstantResponseModal(), ilTestPlayerAbstractGUI\showQuestionEditable(), and ilTestPlayerAbstractGUI\showQuestionViewable().

+ Here is the caller graph for this function:

◆ setPresentationContext()

assQuestionGUI::setPresentationContext ( string  $presentationContext)

Definition at line 254 of file class.assQuestionGUI.php.

254 : void
255 {
256 $this->presentationContext = $presentationContext;
257 }

References $presentationContext.

◆ setPreviewSession()

assQuestionGUI::setPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

Definition at line 1940 of file class.assQuestionGUI.php.

1940 : void
1941 {
1942 $this->previewSession = $previewSession;
1943 }

◆ setPreviousSolutionPrefilled()

assQuestionGUI::setPreviousSolutionPrefilled ( bool  $previousSolutionPrefilled)

Definition at line 270 of file class.assQuestionGUI.php.

270 : void
271 {
272 $this->previousSolutionPrefilled = $previousSolutionPrefilled;
273 }

References $previousSolutionPrefilled.

◆ setQuestionActionCmd()

assQuestionGUI::setQuestionActionCmd ( string  $questionActionCmd)

Definition at line 396 of file class.assQuestionGUI.php.

396 : void
397 {
398 $this->questionActionCmd = $questionActionCmd;
399
400 if (is_object($this->object)) {
401 $this->object->questionActionCmd = $questionActionCmd;
402 }
403 }

References $questionActionCmd.

◆ setQuestionCount()

assQuestionGUI::setQuestionCount ( int  $a_question_count)

Definition at line 929 of file class.assQuestionGUI.php.

929 : void
930 {
931 $this->question_count = $a_question_count;
932 }

◆ setQuestionHeaderBlockBuilder()

assQuestionGUI::setQuestionHeaderBlockBuilder ( \ilQuestionHeaderBlockBuilder  $questionHeaderBlockBuilder)

Definition at line 384 of file class.assQuestionGUI.php.

384 : void
385 {
386 $this->questionHeaderBlockBuilder = $questionHeaderBlockBuilder;
387 }

References $questionHeaderBlockBuilder.

◆ setQuestionSpecificTabs()

assQuestionGUI::setQuestionSpecificTabs ( ilTabsGUI  $ilTabs)
protected

Reimplemented in assFormulaQuestionGUI.

Definition at line 1753 of file class.assQuestionGUI.php.

1753 : void
1754 {
1755 }

◆ setQuestionTabs()

assQuestionGUI::setQuestionTabs ( )

Definition at line 1717 of file class.assQuestionGUI.php.

1717 : void
1718 {
1719 $this->ilTabs->clearTargets();
1720
1721 $this->setDefaultTabs($this->ilTabs);
1722 $this->setQuestionSpecificTabs($this->ilTabs);
1723 $this->addBackTab($this->ilTabs);
1724 }
setQuestionSpecificTabs(ilTabsGUI $ilTabs)
setDefaultTabs(ilTabsGUI $ilTabs)

◆ setRenderPurpose()

assQuestionGUI::setRenderPurpose ( string  $renderPurpose)

Definition at line 281 of file class.assQuestionGUI.php.

281 : void
282 {
283 $this->renderPurpose = $renderPurpose;
284 }

References $renderPurpose.

◆ setSequenceNumber()

assQuestionGUI::setSequenceNumber ( int  $nr)

Definition at line 919 of file class.assQuestionGUI.php.

919 : void
920 {
921 $this->sequence_no = $nr;
922 }

◆ setTargetGui()

assQuestionGUI::setTargetGui (   $linkTargetGui)

Definition at line 369 of file class.assQuestionGUI.php.

369 : void
370 {
371 $this->setTargetGuiClass(get_class($linkTargetGui));
372 }
setTargetGuiClass($targetGuiClass)

References setTargetGuiClass().

+ Here is the call graph for this function:

◆ setTargetGuiClass()

assQuestionGUI::setTargetGuiClass (   $targetGuiClass)

Definition at line 374 of file class.assQuestionGUI.php.

374 : void
375 {
376 $this->targetGuiClass = $targetGuiClass;
377 }

References $targetGuiClass.

Referenced by setTargetGui().

+ Here is the caller graph for this function:

◆ setTaxonomyIds()

assQuestionGUI::setTaxonomyIds ( array  $taxonomyIds)

Definition at line 359 of file class.assQuestionGUI.php.

359 : void
360 {
361 $this->taxonomyIds = $taxonomyIds;
362 }

References $taxonomyIds.

◆ showHints()

assQuestionGUI::showHints ( )

Definition at line 1964 of file class.assQuestionGUI.php.

1964 : void
1965 {
1966 $this->ctrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
1967 }

References ilAssQuestionHintsGUI\CMD_SHOW_LIST, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ suggestedsolution()

assQuestionGUI::suggestedsolution ( )

Definition at line 1210 of file class.assQuestionGUI.php.

1210 : void
1211 {
1213 $ilAccess = $this->access;
1214
1215 $cmd = $this->request->raw('cmd');
1216 $save = is_array($cmd) && array_key_exists('saveSuggestedSolution', $cmd);
1217 if ($save && $this->request->int('deleteSuggestedSolution') === 1) {
1218 $this->object->deleteSuggestedSolutions();
1219 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1220 $this->ctrl->redirect($this, "suggestedsolution");
1221 }
1222
1223 $output = "";
1224 $solution_array = $this->object->getSuggestedSolution(0);
1225 $options = array(
1226 "lm" => $this->lng->txt("obj_lm"),
1227 "st" => $this->lng->txt("obj_st"),
1228 "pg" => $this->lng->txt("obj_pg"),
1229 "git" => $this->lng->txt("glossary_term"),
1230 "file" => $this->lng->txt("fileDownload"),
1231 "text" => $this->lng->txt("solutionText")
1232 );
1233
1234 if (!array_key_exists('type', $solution_array)) {
1235 $solution_array['type'] = '';
1236 }
1237
1238 $solution_type = $this->ctrl->getCmd() === 'cancelSuggestedSolution'
1239 ? $solution_array["type"]
1240 : $this->request->raw('solutiontype');
1241 if (is_string($solution_type) &&
1242 strcmp($solution_type, "file") == 0 &&
1243 strcmp($solution_array["type"], "file") != 0) {
1244 $solution_array = array(
1245 "type" => "file"
1246 );
1247 } elseif (is_string($solution_type) &&
1248 strcmp($solution_type, "text") == 0 &&
1249 strcmp($solution_array["type"], "text") != 0) {
1250 $oldsaveSuggestedSolutionOutputMode = $this->getRenderPurpose();
1251 $this->setRenderPurpose(self::RENDER_PURPOSE_INPUT_VALUE);
1252
1253 $solution_array = array(
1254 "type" => "text",
1255 "value" => $this->getSolutionOutput(0, null, false, false, true, false, true)
1256 );
1257 $this->setRenderPurpose($oldsaveSuggestedSolutionOutputMode);
1258 }
1259
1260 $solution_filename = $this->request->raw('filename');
1261 if ($save &&
1262 is_string($solution_filename) &&
1263 strlen($solution_filename)) {
1264 $solution_array["value"]["filename"] = $solution_filename;
1265 }
1266
1267 $solution_text = $this->request->raw('solutiontext');
1268 if ($save &&
1269 is_string($solution_text) &&
1270 strlen($solution_text)) {
1271 $solution_array["value"] = $solution_text;
1272 }
1273 if (isset($solution_array['type']) && $solution_array['type'] !== "") {
1274 $form = new ilPropertyFormGUI();
1275 $form->setFormAction($this->ctrl->getFormAction($this));
1276 $form->setTitle($this->lng->txt("solution_hint"));
1277 $form->setMultipart(true);
1278 $form->setTableWidth("100%");
1279 $form->setId("suggestedsolutiondisplay");
1280
1281 // suggested solution output
1282 $title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype");
1283 $template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", true, true, "Modules/TestQuestionPool");
1284 if (array_key_exists("internal_link", $solution_array) &&
1285 strlen($solution_array["internal_link"])) {
1286 $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
1287 $template->setCurrentBlock("preview");
1288 $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
1289 $template->setVariable("VALUE_SOLUTION", " <a href=\"$href\" target=\"content\">" . $this->lng->txt("view") . "</a> ");
1290 $template->parseCurrentBlock();
1291 } elseif ((strcmp($solution_array["type"], "file") == 0) &&
1292 array_key_exists('value', $solution_array) && is_array($solution_array["value"])) {
1293 $href = $this->object->getSuggestedSolutionPathWeb() . ($solution_array["value"]["name"] ?? "");
1294 $template->setCurrentBlock("preview");
1295 $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
1296 $template->setVariable("VALUE_SOLUTION", " <a href=\"$href\" target=\"content\">" . ilLegacyFormElementsUtil::prepareFormOutput(
1297 (strlen(
1298 $solution_array["value"]["filename"]
1299 )) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]
1300 ) . "</a> ");
1301 $template->parseCurrentBlock();
1302 }
1303 $template->setVariable("TEXT_TYPE", $this->lng->txt("type"));
1304 $template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]);
1305 $title->setHtml($template->get());
1306 $deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution");
1307 $deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution"));
1308 $title->addSubItem($deletesolution);
1309 $form->addItem($title);
1310
1311 if (strcmp($solution_array["type"], "file") == 0) {
1312 // file
1313 $file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file");
1314 $file->setRequired(true);
1315 $file->enableFileNameSelection("filename");
1316
1317 if ($save && array_key_exists("file", $_FILES) &&
1318 array_key_exists("tmp_name", $_FILES["file"]) &&
1319 $_FILES["file"]["tmp_name"] && $file->checkInput()) {
1320 if (!file_exists($this->object->getSuggestedSolutionPath())) {
1321 ilFileUtils::makeDirParents($this->object->getSuggestedSolutionPath());
1322 }
1323
1325 $_FILES["file"]["tmp_name"],
1326 $_FILES["file"]["name"],
1327 $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]
1328 );
1329 if ($res) {
1330 ilFileUtils::renameExecutables($this->object->getSuggestedSolutionPath());
1331
1332 // remove an old file download
1333 if (array_key_exists('value', $solution_array) && is_array($solution_array["value"])) {
1334 @unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]);
1335 }
1336 $file->setValue($_FILES["file"]["name"]);
1337 $this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"]));
1338
1339 if (($this->request->raw("calling_test") ||
1340 ($this->request->isset('calling_consumer') && (int) $this->request->raw('calling_consumer'))) &&
1341 $this->object->_questionExistsInPool($this->object->getOriginalId()) &&
1342 assQuestion::_isWriteable($this->object->getOriginalId(), $ilUser->getId())) {
1343 $this->originalSyncForm("suggestedsolution");
1344 return;
1345 } else {
1346 $this->tpl->setOnScreenMessage('success', $this->lng->txt("suggested_solution_added_successfully"), true);
1347 $this->ctrl->redirect($this, "suggestedsolution");
1348 }
1349 } else {
1350 // BH: $res as info string? wtf? it holds a bool or something else!!?
1351 $this->tpl->setOnScreenMessage('info', $res);
1352 }
1353 } else {
1354 if (array_key_exists('value', $solution_array) && is_array($solution_array["value"])) {
1355 $file->setValue($solution_array["value"]["name"]);
1356 $file->setFilename((strlen($solution_array["value"]["filename"])) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]);
1357 }
1358 }
1359 $form->addItem($file);
1360 $hidden = new ilHiddenInputGUI("solutiontype");
1361 $hidden->setValue("file");
1362 $form->addItem($hidden);
1363 } elseif (strcmp($solution_array["type"], "text") == 0) {
1364 $solutionContent = $solution_array['value'];
1365 $solutionContent = $this->object->fixSvgToPng($solutionContent);
1366 $solutionContent = $this->object->fixUnavailableSkinImageSources($solutionContent);
1367 $question = new ilTextAreaInputGUI($this->lng->txt("solutionText"), "solutiontext");
1368 $question->setValue($this->object->prepareTextareaOutput($solutionContent));
1369 $question->setRequired(true);
1370 $question->setRows(10);
1371 $question->setCols(80);
1372 $question->setUseRte(true);
1373 $question->addPlugin("latex");
1374 $question->addButton("latex");
1375 $question->setRTESupport($this->object->getId(), "qpl", "assessment");
1376 $hidden = new ilHiddenInputGUI("solutiontype");
1377 $hidden->setValue("text");
1378 $form->addItem($hidden);
1379 $form->addItem($question);
1380 }
1381 if ($ilAccess->checkAccess("write", "", $this->request->getRefId())) {
1382 $form->addCommandButton('cancelSuggestedSolution', $this->lng->txt('cancel'));
1383 $form->addCommandButton('saveSuggestedSolution', $this->lng->txt('save'));
1384 }
1385
1386 if ($save) {
1387 if ($form->checkInput()) {
1388 switch ($solution_array["type"]) {
1389 case "file":
1390 $this->object->saveSuggestedSolution("file", "", 0, array(
1391 "name" => $solution_array["value"]["name"],
1392 "type" => $solution_array["value"]["type"],
1393 "size" => $solution_array["value"]["size"],
1394 "filename" => $_POST["filename"]
1395 ));
1396 break;
1397 case "text":
1398 $this->object->saveSuggestedSolution("text", "", 0, $solution_array["value"]);
1399 break;
1400 }
1401 $originalexists = !is_null($this->object->getOriginalId()) &&
1402 $this->object->_questionExistsInPool($this->object->getOriginalId());
1403 if (($this->request->raw("calling_test") || ($this->request->isset('calling_consumer')
1404 && (int) $this->request->raw('calling_consumer'))) && $originalexists
1405 && assQuestion::_isWriteable($this->object->getOriginalId(), $ilUser->getId())) {
1406 $this->originalSyncForm("suggestedsolution");
1407 return;
1408 } else {
1409 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1410 $this->ctrl->redirect($this, "suggestedsolution");
1411 }
1412 }
1413 }
1414
1415 $output = $form->getHTML();
1416 }
1417
1418 $savechange = (strcmp($this->ctrl->getCmd(), "saveSuggestedSolutionType") == 0) ? true : false;
1419
1420 $changeoutput = "";
1421 if ($ilAccess->checkAccess("write", "", $this->request->getRefId())) {
1422 $formchange = new ilPropertyFormGUI();
1423 $formchange->setFormAction($this->ctrl->getFormAction($this));
1424 $formchange->setTitle((count($solution_array)) ? $this->lng->txt("changeSuggestedSolution") : $this->lng->txt("addSuggestedSolution"));
1425 $formchange->setMultipart(false);
1426 $formchange->setTableWidth("100%");
1427 $formchange->setId("suggestedsolution");
1428
1429 $solutiontype = new ilRadioGroupInputGUI($this->lng->txt("suggestedSolutionType"), "solutiontype");
1430 foreach ($options as $opt_value => $opt_caption) {
1431 $solutiontype->addOption(new ilRadioOption($opt_caption, $opt_value));
1432 }
1433 if (count($solution_array)) {
1434 $solutiontype->setValue($solution_array["type"]);
1435 }
1436 $solutiontype->setRequired(true);
1437 $formchange->addItem($solutiontype);
1438
1439 $formchange->addCommandButton("saveSuggestedSolutionType", $this->lng->txt("select"));
1440
1441 if ($savechange) {
1442 $formchange->checkInput();
1443 }
1444 $changeoutput = $formchange->getHTML();
1445 }
1446
1447 $this->tpl->setVariable("ADM_CONTENT", $changeoutput . $output);
1448 }
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)
originalSyncForm(string $return_to="", string $return_to_feedback='')
setRenderPurpose(string $renderPurpose)
ilAccessHandler $access
static _getInternalLinkHref(string $target="")
This class represents a checkbox property in a property form.
This class represents a file property in a property form.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static renameExecutables(string $a_dir)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
This class represents a property in a property form.
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...
$res
Definition: ltiservices.php:69

References $ilUser, $res, assQuestion\_getInternalLinkHref(), assQuestion\_isWriteable(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilFileUtils\makeDirParents(), ilFileUtils\moveUploadedFile(), ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilFileUtils\renameExecutables().

Referenced by executeCommand().

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

◆ sync()

assQuestionGUI::sync ( )

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

618 : void
619 {
620 $original_id = $this->object->getOriginalId();
621 if ($original_id) {
622 $this->object->syncWithOriginal();
623 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
624 }
625 if (strlen($this->request->raw("return_to"))) {
626 $this->ctrl->redirect($this, $this->request->raw("return_to"));
627 }
628 if (strlen($this->request->raw("return_to_fb"))) {
629 $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', 'showFeedbackForm');
630 } else {
631 if ($this->request->isset('calling_consumer') && (int) $this->request->raw('calling_consumer')) {
632 $ref_id = (int) $this->request->raw('calling_consumer');
634 if ($consumer instanceof ilQuestionEditingFormConsumer) {
635 $this->ctrl->redirectToURL($consumer->getQuestionEditingFormBackTarget($this->request->raw('consumer_context')));
636 }
637 $this->ctrl->redirectToURL(ilLink::_getLink($ref_id));
638 }
639
640 if ($this->request->raw('test_express_mode')) {
641 $this->ctrl->redirectToURL(ilTestExpressPage::getReturnToPageLink($this->object->getId()));
642 } else {
643 $this->ctrl->redirectByClass(ilAssQuestionPreviewGUI::class, ilAssQuestionPreviewGUI::CMD_SHOW);
644 }
645 }
646 }

References $ref_id, ilLink\_getLink(), ilAssQuestionPreviewGUI\CMD_SHOW, ILIAS\Repository\ctrl(), ilObjectFactory\getInstanceByRefId(), ilTestExpressPage\getReturnToPageLink(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ writePostData()

assQuestionGUI::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 in assClozeTestGUI, assErrorTextGUI, assFileUploadGUI, assFormulaQuestionGUI, assImagemapQuestionGUI, assKprimChoiceGUI, assLongMenuGUI, assMatchingQuestionGUI, assMultipleChoiceGUI, assNumericGUI, assOrderingHorizontalGUI, assOrderingQuestionGUI, assSingleChoiceGUI, assTextQuestionGUI, and assTextSubsetGUI.

Definition at line 414 of file class.assQuestionGUI.php.

414 : int
415 {
416 return 0;
417 }

Referenced by apply(), save(), saveEdit(), and saveReturn().

+ Here is the caller graph for this function:

◆ writeQuestionGenericPostData()

assQuestionGUI::writeQuestionGenericPostData ( )
protected

Definition at line 1858 of file class.assQuestionGUI.php.

1858 : void
1859 {
1860 $this->object->setTitle($_POST["title"]);
1861 $this->object->setAuthor($_POST["author"]);
1862 $this->object->setComment($_POST["comment"] ?? '');
1863 if ($this->object->getSelfAssessmentEditingMode()) {
1864 $this->object->setNrOfTries((int) ($_POST['nr_of_tries'] ?? 0));
1865 }
1866
1867 try {
1868 $lifecycle = ilAssQuestionLifecycle::getInstance($_POST['lifecycle']);
1869 $this->object->setLifecycle($lifecycle);
1871 }
1872
1873 $this->object->setQuestion(ilUtil::stripOnlySlashes($_POST['question']));
1874 }
static stripOnlySlashes(string $a_str)

References Vendor\Package\$e, ilAssQuestionLifecycle\getInstance(), ILIAS\Repository\object(), and ilUtil\stripOnlySlashes().

Referenced by assOrderingQuestionGUI\uploadElementImage(), assClozeTestGUI\writePostData(), assErrorTextGUI\writePostData(), assFileUploadGUI\writePostData(), assImagemapQuestionGUI\writePostData(), assKprimChoiceGUI\writePostData(), assLongMenuGUI\writePostData(), assMatchingQuestionGUI\writePostData(), assMultipleChoiceGUI\writePostData(), assNumericGUI\writePostData(), assOrderingHorizontalGUI\writePostData(), assOrderingQuestionGUI\writePostData(), assSingleChoiceGUI\writePostData(), assTextQuestionGUI\writePostData(), and assTextSubsetGUI\writePostData().

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

Field Documentation

◆ $access

ilAccessHandler assQuestionGUI::$access
private

Definition at line 60 of file class.assQuestionGUI.php.

◆ $component_repository

ilComponentRepository assQuestionGUI::$component_repository
private

◆ $ctrl

ilCtrl assQuestionGUI::$ctrl
protected

Definition at line 70 of file class.assQuestionGUI.php.

◆ $editContext

string assQuestionGUI::$editContext = self::EDIT_CONTEXT_AUTHORING
private

Definition at line 116 of file class.assQuestionGUI.php.

Referenced by getEditContext(), and setEditContext().

◆ $editForm

ilPropertyFormGUI assQuestionGUI::$editForm
protected

Definition at line 120 of file class.assQuestionGUI.php.

◆ $error

assQuestionGUI::$error

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

◆ $errormessage

string assQuestionGUI::$errormessage

Definition at line 82 of file class.assQuestionGUI.php.

Referenced by addErrorMessage(), getErrorMessage(), and setErrorMessage().

◆ $ilDB

ilDBInterface assQuestionGUI::$ilDB
private

◆ $ilHelp

ilHelpGUI assQuestionGUI::$ilHelp
private

Definition at line 59 of file class.assQuestionGUI.php.

◆ $ilObjDataCache

ilObjectDataCache assQuestionGUI::$ilObjDataCache
private

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

◆ $ilTabs

ilTabsGUI assQuestionGUI::$ilTabs
private

◆ $ilUser

◆ $lng

ilLanguage assQuestionGUI::$lng

Definition at line 79 of file class.assQuestionGUI.php.

Referenced by assLongMenuGUI\__construct(), and _getQuestionGUI().

◆ $navigationGUI

ilTestQuestionNavigationGUI assQuestionGUI::$navigationGUI = null
private

Definition at line 98 of file class.assQuestionGUI.php.

Referenced by getNavigationGUI(), and setNavigationGUI().

◆ $new_id_listener_cnt

int assQuestionGUI::$new_id_listener_cnt = 0
private

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

Referenced by addNewIdListener(), and callNewIdListeners().

◆ $new_id_listeners

array assQuestionGUI::$new_id_listeners = array()
private

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

◆ $notes_gui

ILIAS Notes GUIService assQuestionGUI::$notes_gui
protected

Definition at line 68 of file class.assQuestionGUI.php.

◆ $object

assQuestion assQuestionGUI::$object

Definition at line 77 of file class.assQuestionGUI.php.

Referenced by callNewIdListeners().

◆ $presentationContext

string assQuestionGUI::$presentationContext = null
private

Definition at line 103 of file class.assQuestionGUI.php.

Referenced by getPresentationContext(), and setPresentationContext().

◆ $previewSession

assQuestionGUI::$previewSession
private

Definition at line 75 of file class.assQuestionGUI.php.

◆ $previousSolutionPrefilled

bool assQuestionGUI::$previousSolutionPrefilled = false
private

◆ $question_count

int assQuestionGUI::$question_count

question count in test

Definition at line 88 of file class.assQuestionGUI.php.

Referenced by getQuestionCount().

◆ $questionActionCmd

string assQuestionGUI::$questionActionCmd = 'handleQuestionAction'
private

Definition at line 94 of file class.assQuestionGUI.php.

Referenced by getQuestionActionCmd(), and setQuestionActionCmd().

◆ $questionHeaderBlockBuilder

ilQuestionHeaderBlockBuilder assQuestionGUI::$questionHeaderBlockBuilder
private

◆ $renderPurpose

string assQuestionGUI::$renderPurpose = self::RENDER_PURPOSE_PLAYBACK
private

Definition at line 111 of file class.assQuestionGUI.php.

Referenced by getRenderPurpose(), and setRenderPurpose().

◆ $request

ILIAS TestQuestionPool InternalRequestService assQuestionGUI::$request
protected

Definition at line 121 of file class.assQuestionGUI.php.

◆ $sequence_no

int assQuestionGUI::$sequence_no

sequence number in test

Definition at line 85 of file class.assQuestionGUI.php.

Referenced by getSequenceNumber().

◆ $targetGuiClass

assQuestionGUI::$targetGuiClass = null
private

Definition at line 92 of file class.assQuestionGUI.php.

Referenced by getTargetGuiClass(), and setTargetGuiClass().

◆ $taxonomyIds

assQuestionGUI::$taxonomyIds = array()
private

Definition at line 90 of file class.assQuestionGUI.php.

Referenced by getTaxonomyIds(), and setTaxonomyIds().

◆ $tpl

◆ $tree

assQuestionGUI::$tree
private

◆ $ui

assQuestionGUI::$ui
private

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

◆ ALLOWED_PLAIN_TEXT_TAGS

const assQuestionGUI::ALLOWED_PLAIN_TEXT_TAGS = "<em>, <strong>"

sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI.

Don't ask, but I didn't find an easy fix without undoing two more question types.

Definition at line 54 of file class.assQuestionGUI.php.

Referenced by ilKprimChoiceWizardInputGUI\cleanupAnswerText().

◆ CORRECTNESS_MOSTLY_OK

const assQuestionGUI::CORRECTNESS_MOSTLY_OK = 1

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

◆ CORRECTNESS_NOT_OK

const assQuestionGUI::CORRECTNESS_NOT_OK = 0

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

◆ CORRECTNESS_OK

const assQuestionGUI::CORRECTNESS_OK = 2

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

◆ EDIT_CONTEXT_ADJUSTMENT

const assQuestionGUI::EDIT_CONTEXT_ADJUSTMENT = 'adjustment'

Definition at line 114 of file class.assQuestionGUI.php.

Referenced by isAdjustmentEditContext().

◆ EDIT_CONTEXT_AUTHORING

const assQuestionGUI::EDIT_CONTEXT_AUTHORING = 'authoring'

◆ FORM_ENCODING_MULTIPART

const assQuestionGUI::FORM_ENCODING_MULTIPART = 'multipart/form-data'

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

◆ FORM_ENCODING_URLENCODE

const assQuestionGUI::FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'

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

◆ FORM_MODE_ADJUST

const assQuestionGUI::FORM_MODE_ADJUST = 'adjust'

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

◆ FORM_MODE_EDIT

const assQuestionGUI::FORM_MODE_EDIT = 'edit'

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

◆ HAS_SPECIAL_QUESTION_COMMANDS

const assQuestionGUI::HAS_SPECIAL_QUESTION_COMMANDS = false
protected

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

◆ PRESENTATION_CONTEXT_RESULTS

const assQuestionGUI::PRESENTATION_CONTEXT_RESULTS = 'pContextResults'

Definition at line 101 of file class.assQuestionGUI.php.

◆ PRESENTATION_CONTEXT_TEST

const assQuestionGUI::PRESENTATION_CONTEXT_TEST = 'pContextTest'

◆ RENDER_PURPOSE_DEMOPLAY

const assQuestionGUI::RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'

◆ RENDER_PURPOSE_INPUT_VALUE

const assQuestionGUI::RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'

Definition at line 109 of file class.assQuestionGUI.php.

Referenced by isRenderPurposeInputValue().

◆ RENDER_PURPOSE_PLAYBACK

const assQuestionGUI::RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'

Definition at line 105 of file class.assQuestionGUI.php.

Referenced by isRenderPurposePlayback().

◆ RENDER_PURPOSE_PREVIEW

const assQuestionGUI::RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'

◆ RENDER_PURPOSE_PRINT_PDF

◆ SESSION_PREVIEW_DATA_BASE_INDEX

const assQuestionGUI::SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'

Definition at line 56 of file class.assQuestionGUI.php.

◆ SUGGESTED_SOLUTION_COMMANDS

const assQuestionGUI::SUGGESTED_SOLUTION_COMMANDS
protected
Initial value:
= [
'cancelSuggestedSolution',
'saveSuggestedSolution',
'suggestedsolution'
]

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


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