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

Basic GUI class for assessment questions. More...

+ Inheritance diagram for assQuestionGUI:
+ Collaboration diagram for assQuestionGUI:

Public Member Functions

 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 

Static Public Member Functions

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

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 SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $request
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 

Protected Member Functions

 hasSpecialQuestionCommands ()
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 addSaveOnEnterOnLoadCode ()
 

Protected Attributes

const HAS_SPECIAL_QUESTION_COMMANDS = false
 
 $ctrl
 
 $editForm
 
 $use_intermediate_solution = false
 

Private Attributes

 $taxonomyIds = array()
 
 $targetGuiClass = null
 
 $questionActionCmd = 'handleQuestionAction'
 
 $questionHeaderBlockBuilder
 
 $navigationGUI
 
 $presentationContext = null
 
 $renderPurpose = self::RENDER_PURPOSE_PLAYBACK
 
 $editContext = self::EDIT_CONTEXT_AUTHORING
 
 $previousSolutionPrefilled = false
 
 $previewSession
 

Detailed Description

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 23 of file class.assQuestionGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assQuestionGUI::__construct ( )

assQuestionGUI constructor

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

134 {
135 global $DIC;
136 $lng = $DIC['lng'];
137 $tpl = $DIC['tpl'];
138 $ilCtrl = $DIC['ilCtrl'];
139
140 $this->lng = &$lng;
141 $this->tpl = &$tpl;
142 $this->ctrl = &$ilCtrl;
143 $this->request = $DIC->http()->request();
144
145 $this->ctrl->saveParameter($this, "q_id");
146 $this->ctrl->saveParameter($this, "prev_qid");
147 $this->ctrl->saveParameter($this, "calling_test");
148 $this->ctrl->saveParameter($this, "calling_consumer");
149 $this->ctrl->saveParameter($this, "consumer_context");
150 $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'test_express_mode');
151 $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'calling_consumer');
152 $this->ctrl->saveParameterByClass('ilAssQuestionPageGUI', 'consumer_context');
153 $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'test_express_mode');
154 $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'calling_consumer');
155 $this->ctrl->saveParameterByClass('ilobjquestionpoolgui', 'consumer_context');
156
157 $this->errormessage = $this->lng->txt("fill_out_all_required_fields");
158 $this->selfassessmenteditingmode = false;
159 $this->new_id_listeners = array();
160 $this->new_id_listener_cnt = 0;
161 $this->navigationGUI = null;
162 }
global $DIC
Definition: goto.php:24

References $DIC, $lng, and $tpl.

Member Function Documentation

◆ _getClassNameForQType()

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

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

557 {
558 return $q_type . "GUI";
559 }

Referenced by _getGUIClassNameForId().

+ Here is the caller graph for this function:

◆ _getGUIClassNameForId()

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

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

545 {
546 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
547 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
548 $q_type = assQuestion::getQuestionTypeFromDb($a_q_id);
549 $class_name = assQuestionGUI::_getClassNameForQType($q_type);
550 return $class_name;
551 }
static _getClassNameForQType($q_type)
static getQuestionTypeFromDb($question_id)
get question type for 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 (   $question_type,
  $question_id = -1 
)
static

Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls.

Parameters
string$question_typeThe question type as it is used in the language database
integer$question_idThe database ID of an existing question to load it into assQuestionGUI
Returns
assQuestionGUI The alias to the question object

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

510 {
511 global $DIC;
512 $ilCtrl = $DIC['ilCtrl'];
513 $ilDB = $DIC['ilDB'];
514 $lng = $DIC['lng'];
515
516 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
517
518 if ((!$question_type) and ($question_id > 0)) {
519 $question_type = assQuestion::getQuestionTypeFromDb($question_id);
520 }
521
522 if (strlen($question_type) == 0) {
523 return null;
524 }
525
526 assQuestion::_includeClass($question_type, 1);
527
528 $question_type_gui = assQuestion::getGuiClassNameByQuestionType($question_type);
529 $question = new $question_type_gui();
530
531 $feedbackObjectClassname = assQuestion::getFeedbackClassNameByQuestionType($question_type);
532 $question->object->feedbackOBJ = new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
533
534 if ($question_id > 0) {
535 $question->object->loadFromDb($question_id);
536 }
537
538 return $question;
539 }
static getFeedbackClassNameByQuestionType($questionType)
static getGuiClassNameByQuestionType($questionType)
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
global $ilDB

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

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

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

◆ addBackTab()

assQuestionGUI::addBackTab ( ilTabsGUI  $ilTabs)
protected
Parameters
ilTabsGUI$ilTabs

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

2226 {
2227 $this->ctrl->saveParameterByClass(ilAssQuestionPreviewGUI::class, 'prev_qid');
2228 $ilTabs->setBackTarget(
2229 $this->lng->txt('backtocallingpage'),
2230 $this->ctrl->getLinkTargetByClass(ilAssQuestionPreviewGUI::class, ilAssQuestionPreviewGUI::CMD_SHOW)
2231 );
2232 }
setBackTarget($a_title, $a_target, $a_frame="")
back target for upper context

References ilAssQuestionPreviewGUI\CMD_SHOW, and ilTabsGUI\setBackTarget().

Referenced by setQuestionTabs().

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

◆ addBasicQuestionFormProperties()

assQuestionGUI::addBasicQuestionFormProperties (   $form)

Add basic question form properties: assessment: title, author, description, question, working time.

Returns
int Default Nr of Tries

Reimplemented in assClozeTestGUI, and assMultipleChoiceGUI.

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

1197 {
1198 // title
1199 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
1200 $title->setMaxLength(100);
1201 $title->setValue($this->object->getTitle());
1202 $title->setRequired(true);
1203 $form->addItem($title);
1204
1205 if (!$this->object->getSelfAssessmentEditingMode()) {
1206 // author
1207 $author = new ilTextInputGUI($this->lng->txt("author"), "author");
1208 $author->setValue($this->object->getAuthor());
1209 $author->setRequired(true);
1210 $form->addItem($author);
1211
1212 // description
1213 $description = new ilTextInputGUI($this->lng->txt("description"), "comment");
1214 $description->setValue($this->object->getComment());
1215 $description->setRequired(false);
1216 $form->addItem($description);
1217 } else {
1218 // author as hidden field
1219 $hi = new ilHiddenInputGUI("author");
1220 $author = ilUtil::prepareFormOutput($this->object->getAuthor());
1221 if (trim($author) == "") {
1222 $author = "-";
1223 }
1224 $hi->setValue($author);
1225 $form->addItem($hi);
1226 }
1227
1228 // lifecycle
1229 $lifecycle = new ilSelectInputGUI($this->lng->txt('qst_lifecycle'), 'lifecycle');
1230 $lifecycle->setOptions($this->object->getLifecycle()->getSelectOptions($this->lng));
1231 $lifecycle->setValue($this->object->getLifecycle()->getIdentifier());
1232 $form->addItem($lifecycle);
1233
1234 // questiontext
1235 $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
1236 $question->setValue($this->object->getQuestion());
1237 $question->setRequired(true);
1238 $question->setRows(10);
1239 $question->setCols(80);
1240
1241 if (!$this->object->getSelfAssessmentEditingMode()) {
1242 if ($this->object->getAdditionalContentEditingMode() != assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_IPE) {
1243 $question->setUseRte(true);
1244 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
1245 $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
1246 $question->addPlugin("latex");
1247 $question->addButton("latex");
1248 $question->addButton("pastelatex");
1249 $question->setRTESupport($this->object->getId(), "qpl", "assessment");
1250 }
1251 } else {
1252 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
1254 $question->setUseTagsForRteOnly(false);
1255 }
1256 $form->addItem($question);
1257
1258 if (!$this->object->getSelfAssessmentEditingMode()) {
1259 // duration
1260 $duration = new ilDurationInputGUI($this->lng->txt("working_time"), "Estimated");
1261 $duration->setShowHours(true);
1262 $duration->setShowMinutes(true);
1263 $duration->setShowSeconds(true);
1264 $ewt = $this->object->getEstimatedWorkingTime();
1265 $duration->setHours($ewt["h"]);
1266 $duration->setMinutes($ewt["m"]);
1267 $duration->setSeconds($ewt["s"]);
1268 $duration->setRequired(false);
1269 $form->addItem($duration);
1270 } else {
1271 // number of tries
1272 if (strlen($this->object->getNrOfTries())) {
1273 $nr_tries = $this->object->getNrOfTries();
1274 } else {
1275 $nr_tries = $this->object->getDefaultNrOfTries();
1276 }
1277 if ($nr_tries < 1) {
1278 $nr_tries = "";
1279 }
1280
1281 $ni = new ilNumberInputGUI($this->lng->txt("qst_nr_of_tries"), "nr_of_tries");
1282 $ni->setValue($nr_tries);
1283 $ni->setMinValue(0);
1284 $ni->setSize(5);
1285 $ni->setMaxLength(5);
1286 $form->addItem($ni);
1287 }
1288 }
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
constant for additional content editing mode "pageobject"
static getSelfAssessmentTags()
Get tags allowed in question tags in self assessment mode.
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
static _getUsedHTMLTags($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.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References ilObjAdvancedEditing\_getUsedHTMLTags(), assQuestion\ADDITIONAL_CONTENT_EDITING_MODE_IPE, ilAssSelfAssessmentQuestionFormatter\getSelfAssessmentTags(), and ilUtil\prepareFormOutput().

Referenced by assImagemapQuestionGUI\buildEditForm(), assKprimChoiceGUI\buildEditForm(), assLongMenuGUI\buildEditForm(), assOrderingQuestionGUI\buildEditForm(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assFlashQuestionGUI\editQuestion(), assJavaAppletGUI\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 (   $errormessage)

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

1109 {
1110 $this->errormessage .= ((strlen($this->errormessage)) ? "<br />" : "") . $errormessage;
1111 }

References $errormessage.

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

+ Here is the caller graph for this function:

◆ addGIT()

assQuestionGUI::addGIT ( )

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

1888 {
1889 $subquestion_index = 0;
1890 if (strlen($_GET["subquestion_index"]) && $_GET["subquestion_index"] >= 0) {
1891 $subquestion_index = $_GET["subquestion_index"];
1892 }
1893 $this->object->saveSuggestedSolution("git", "il__git_" . $_GET["git"], $subquestion_index);
1894 ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), true);
1895 $this->ctrl->redirect($this, "suggestedsolution");
1896 }
$_GET["client_id"]

References $_GET.

◆ addHeaderAction()

assQuestionGUI::addHeaderAction ( )

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

175 {
176 }

◆ addNewIdListener()

assQuestionGUI::addNewIdListener ( $a_object,
  $a_method,
  $a_parameters = "" 
)

Add a listener that is notified with the new question ID, when a new question is saved.

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

1152 {
1153 $cnt = $this->new_id_listener_cnt;
1154 $this->new_id_listeners[$cnt]["object"] = &$a_object;
1155 $this->new_id_listeners[$cnt]["method"] = $a_method;
1156 $this->new_id_listeners[$cnt]["parameters"] = $a_parameters;
1157 $this->new_id_listener_cnt++;
1158 }

◆ addPG()

assQuestionGUI::addPG ( )

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

1866 {
1867 $subquestion_index = 0;
1868 if (strlen($_GET["subquestion_index"]) && $_GET["subquestion_index"] >= 0) {
1869 $subquestion_index = $_GET["subquestion_index"];
1870 }
1871 $this->object->saveSuggestedSolution("pg", "il__pg_" . $_GET["pg"], $subquestion_index);
1872 ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), true);
1873 $this->ctrl->redirect($this, "suggestedsolution");
1874 }

References $_GET.

◆ addQuestionFormCommandButtons()

assQuestionGUI::addQuestionFormCommandButtons (   $form)

Add the command buttons of a question properties form.

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

1182 {
1183 //if (!$this->object->getSelfAssessmentEditingMode() && !$_GET["calling_test"]) $form->addCommandButton("saveEdit", $this->lng->txt("save_edit"));
1184 if (!$this->object->getSelfAssessmentEditingMode()) {
1185 $form->addCommandButton("saveReturn", $this->lng->txt("save_return"));
1186 }
1187 $form->addCommandButton("save", $this->lng->txt("save"));
1188 }

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

+ Here is the caller graph for this function:

◆ addSaveOnEnterOnLoadCode()

assQuestionGUI::addSaveOnEnterOnLoadCode ( )
protected

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

2359 : void
2360 {
2361 $this->tpl->addOnloadCode("
2362 let form = document.querySelector('#ilContentContainer form');
2363 let button = form.querySelector('input[name=\"cmd[save]\"]');
2364 if (button === null) {
2365 button = form.querySelector('input[name=\"cmd[saveFQ]\"]');
2366 };
2367 if (form && button) {
2368 form.addEventListener('keydown', function (e) {
2369 if (e.key === 'Enter'
2370 && e.target.type !== 'textarea'
2371 && e.target.type !== 'submit'
2372 && e.target.type !== 'file'
2373 ) {
2374 e.preventDefault();
2375 form.requestSubmit(button);
2376 }
2377 })
2378 }
2379 ");
2380 }

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

+ Here is the caller graph for this function:

◆ addST()

assQuestionGUI::addST ( )

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

1877 {
1878 $subquestion_index = 0;
1879 if (strlen($_GET["subquestion_index"]) && $_GET["subquestion_index"] >= 0) {
1880 $subquestion_index = $_GET["subquestion_index"];
1881 }
1882 $this->object->saveSuggestedSolution("st", "il__st_" . $_GET["st"], $subquestion_index);
1883 ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), true);
1884 $this->ctrl->redirect($this, "suggestedsolution");
1885 }

References $_GET.

◆ addTab_Question()

assQuestionGUI::addTab_Question ( ilTabsGUI  $tabsGUI)
protected

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

2055 {
2056 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
2057
2058 $tabsGUI->addTarget(
2059 'edit_question',
2060 $this->ctrl->getLinkTargetByClass(
2061 array('ilrepositorygui','ilobjquestionpoolgui', get_class($this)),
2062 'editQuestion'
2063 ),
2064 'editQuestion',
2065 '',
2066 '',
2067 false
2068 );
2069 }
addTarget( $a_text, $a_link, $a_cmd="", $a_cmdClass="", $a_frame="", $a_activate=false, $a_dir_text=false)

References ilTabsGUI\addTarget().

Referenced by setDefaultTabs().

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

◆ addTab_QuestionFeedback()

assQuestionGUI::addTab_QuestionFeedback ( ilTabsGUI  $tabs)
protected

adds the feedback tab to ilTabsGUI

@global ilCtrl $ilCtrl

Parameters
ilTabsGUI$tabs

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

2007 {
2008 global $DIC;
2009 $ilCtrl = $DIC['ilCtrl'];
2010
2011 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
2012 $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionFeedbackEditingGUI');
2013
2014 $tabLink = $ilCtrl->getLinkTargetByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
2015
2016 $tabs->addTarget('tst_feedback', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), '');
2017 }
static getCommandsFromClassConstants($guiClassName, $cmdConstantNameBegin='CMD_')
extracts values of all constants of given class with given prefix as array can be used to get all pos...

References $DIC, ilTabsGUI\addTarget(), ilAssQuestionFeedbackEditingGUI\CMD_SHOW, and getCommandsFromClassConstants().

Referenced by setDefaultTabs().

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

◆ addTab_QuestionHints()

assQuestionGUI::addTab_QuestionHints ( ilTabsGUI  $tabs)
protected

adds the hints tab to ilTabsGUI

@global ilCtrl $ilCtrl

Parameters
ilTabsGUI$tabs

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

2026 {
2027 global $DIC;
2028 $ilCtrl = $DIC['ilCtrl'];
2029
2030 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
2031
2032 switch ($ilCtrl->getCmdClass()) {
2033 case 'ilassquestionhintsgui':
2034
2035 $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionHintsGUI');
2036 break;
2037
2038 case 'ilassquestionhintgui':
2039
2040 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
2041 $tabCommands = self::getCommandsFromClassConstants('ilAssQuestionHintGUI');
2042 break;
2043
2044 default:
2045
2046 $tabCommands = array();
2047 }
2048
2049 $tabLink = $ilCtrl->getLinkTargetByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
2050
2051 $tabs->addTarget('tst_question_hints_tab', $tabLink, $tabCommands, $ilCtrl->getCmdClass(), '');
2052 }
const CMD_SHOW_LIST
command constants

References $DIC, ilTabsGUI\addTarget(), ilAssQuestionHintsGUI\CMD_SHOW_LIST, and getCommandsFromClassConstants().

Referenced by setDefaultTabs().

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

◆ addTab_SuggestedSolution()

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

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

1971 {
1972 if ($_GET["q_id"]) {
1973 $tabs->addTarget(
1974 "suggested_solution",
1975 $this->ctrl->getLinkTargetByClass($classname, "suggestedsolution"),
1976 array("suggestedsolution", "saveSuggestedSolution", "outSolutionExplorer", "cancel",
1977 "addSuggestedSolution","cancelExplorer", "linkChilds", "removeSuggestedSolution"
1978 ),
1979 $classname,
1980 ""
1981 );
1982 }
1983 }

References $_GET, and ilTabsGUI\addTarget().

Referenced by setDefaultTabs().

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

◆ apply()

assQuestionGUI::apply ( )

apply changes

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

1047 {
1048 $this->writePostData();
1049 $this->object->saveToDb();
1050 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
1051 $this->editQuestion();
1052 }
writePostData($always=false)
Evaluates a posted edit form and writes the form data in the question object.

References writePostData().

+ Here is the call graph for this function:

◆ buildBasicEditFormObject()

assQuestionGUI::buildBasicEditFormObject ( )
protected
Returns
ilPropertyFormGUI

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

2259 {
2260 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
2261 $form = new ilPropertyFormGUI();
2262
2263 $form->setFormAction($this->ctrl->getFormAction($this));
2264
2265 $form->setId($this->getType());
2266 $form->setTitle($this->outQuestionType());
2267
2268 $form->setTableWidth('100%');
2269
2270 $form->setMultipart(true);
2271
2272 return $form;
2273 }
getType()
needed for page editor compliance
This class represents a property form user interface.

References getType(), and outQuestionType().

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, assMultipleChoiceGUI, and assOrderingQuestionGUI.

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

2291 {
2292 $errors = $this->editQuestion(true); // TODO bheyser: editQuestion should be added to the abstract base class with a unified signature
2293 return $this->editForm;
2294 }
$errors
Definition: imgupload.php:49

References $editForm, and $errors.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ buildFocusAnchorHtml()

assQuestionGUI::buildFocusAnchorHtml ( )
Returns
string

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

2300 {
2301 return '<div id="focus"></div>';
2302 }

Referenced by assKprimChoiceGUI\getPreview(), assMultipleChoiceGUI\getPreview(), assSingleChoiceGUI\getPreview(), assKprimChoiceGUI\getSolutionOutput(), assMultipleChoiceGUI\getSolutionOutput(), and assSingleChoiceGUI\getSolutionOutput().

+ Here is the caller graph for this function:

◆ callNewIdListeners()

assQuestionGUI::callNewIdListeners (   $a_new_id)

Call the new id listeners.

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

1164 {
1165 for ($i = 0; $i < $this->new_id_listener_cnt; $i++) {
1166 $this->new_id_listeners[$i]["parameters"]["new_id"] = $a_new_id;
1167 $object = &$this->new_id_listeners[$i]["object"];
1168 $method = $this->new_id_listeners[$i]["method"];
1169 $parameters = $this->new_id_listeners[$i]["parameters"];
1170 //var_dump($object);
1171 //var_dump($method);
1172 //var_dump($parameters);
1173
1174 $object->$method($parameters);
1175 }
1176 }
$i
Definition: metadata.php:24

References $i, and $object.

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

+ Here is the caller graph for this function:

◆ cancel()

assQuestionGUI::cancel ( )

cancel action

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

713 {
714 if ($_GET["calling_test"]) {
715 $_GET["ref_id"] = $_GET["calling_test"];
716 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["calling_test"]);
717 } elseif ($_GET["test_ref_id"]) {
718 $_GET["ref_id"] = $_GET["test_ref_id"];
719 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["test_ref_id"]);
720 } else {
721 if ($_GET["q_id"] > 0) {
722 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
723 $this->ctrl->redirectByClass("ilAssQuestionPageGUI", "edit");
724 } else {
725 $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
726 }
727 }
728 }
static redirect($a_script)

References $_GET, and ilUtil\redirect().

+ Here is the call graph for this function:

◆ cancelExplorer()

assQuestionGUI::cancelExplorer ( )

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

1721 {
1722 $this->ctrl->redirect($this, "suggestedsolution");
1723 }

◆ cancelSync()

assQuestionGUI::cancelSync ( )

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

787 {
788 if (strlen($_GET["return_to"])) {
789 $this->ctrl->redirect($this, $_GET["return_to"]);
790 }
791 if (strlen($_REQUEST['return_to_fb'])) {
792 $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', 'showFeedbackForm');
793 } else {
794 if (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) {
795 $ref_id = (int) $_GET['calling_consumer'];
796 $consumer = ilObjectFactory::getInstanceByRefId($ref_id);
797 if ($consumer instanceof ilQuestionEditingFormConsumer) {
798 ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET['consumer_context']));
799 }
800 require_once 'Services/Link/classes/class.ilLink.php';
802 }
803 $_GET["ref_id"] = $_GET["calling_test"];
804
805 if ($_REQUEST['test_express_mode']) {
807 } else {
808 $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
809 }
810 }
811 }
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getReturnToPageLink($q_id=null)

References $_GET, ilLink\_getLink(), ilAssQuestionPreviewGUI\CMD_SHOW, ilObjectFactory\getInstanceByRefId(), ilTestExpressPage\getReturnToPageLink(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ completeTestOutputFormAction()

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

Reimplemented in assImagemapQuestionGUI.

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

2200 {
2201 return $formAction;
2202 }

Referenced by outQuestionForTest().

+ Here is the caller graph for this function:

◆ createQuestionGUI()

& assQuestionGUI::createQuestionGUI (   $question_type,
  $question_id = -1 
)

Creates a question gui representation.

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

Parameters
string$question_typeThe question type as it is used in the language database
integer$question_idThe database ID of an existing question to load it into assQuestionGUI
Returns
object The alias to the question object @access public
Deprecated:
: WTF is this? GUIobject::question should be a GUIobject !? WTF is a question alias !?

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

574 {
575 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
576 $this->question = &assQuestionGUI::_getQuestionGUI($question_type, $question_id);
577 }
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...

References _getQuestionGUI().

+ Here is the call graph for this function:

◆ escapeTemplatePlaceholders()

assQuestionGUI::escapeTemplatePlaceholders ( string  $text)
protected

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

2282 : string
2283 {
2284 return str_replace(['{','}'], ['&#123;','&#125;'], $text);
2285 }

Referenced by assTextSubsetGUI\getPreview(), assTextSubsetGUI\getSolutionOutput(), assTextSubsetGUI\getTestOutput(), and assClozeTestGUI\populateJSON().

+ Here is the caller graph for this function:

◆ executeCommand()

assQuestionGUI::executeCommand ( )

execute command

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

222 {
223 global $DIC;
224 $DIC['ilHelp']->setScreenIdComponent('qpl');
225
226 $next_class = $this->ctrl->getNextClass($this);
227
228 switch ($next_class) {
229 case 'ilformpropertydispatchgui':
230 $form = $this->buildEditForm();
231 $form_prop_dispatch = new ilFormPropertyDispatchGUI();
232 $form_prop_dispatch->setItem($form->getItemByPostVar(ilUtil::stripSlashes($_GET['postvar'])));
233 $this->ctrl->forwardCommand($form_prop_dispatch);
234 break;
235
236 default:
237 $cmd = $this->ctrl->getCmd('editQuestion');
238
239 if (in_array($cmd, ['save', 'saveReturn','saveFQ', 'saveReturnFQ', 'editQuestion'])) {
241 $this->$cmd();
242 return;
243 }
244
245 if (method_exists($this, $cmd)) {
246 $this->$cmd();
247 return;
248 }
249
250 if ($this->hasSpecialQuestionCommands() === true) {
251 $this->callSpecialQuestionCommands($cmd);
252 }
253 }
254 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_GET, $DIC, addSaveOnEnterOnLoadCode(), buildEditForm(), hasSpecialQuestionCommands(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getAdditionalEditQuestionCommands()

assQuestionGUI::getAdditionalEditQuestionCommands ( )
protected

Reimplemented in assKprimChoiceGUI.

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

1996 {
1997 return array();
1998 }

Referenced by getEditQuestionTabCommands().

+ Here is the caller graph for this function:

◆ getAnswerFeedbackOutput()

assQuestionGUI::getAnswerFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer generic feedback depending on the results of the question.

Deprecated:
Use getGenericFeedbackOutput instead.
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented in assClozeTestGUI.

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

1348 {
1349 return $this->getGenericFeedbackOutput($active_id, $pass);
1350 }
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.

References $pass, and getGenericFeedbackOutput().

Referenced by assFileUploadGUI\getSolutionOutput(), assJavaAppletGUI\getSolutionOutput(), assMultipleChoiceGUI\getSolutionOutput(), assSingleChoiceGUI\getSolutionOutput(), and assTextSubsetGUI\getSolutionOutput().

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

◆ getAnswerFrequencyTableGUI()

assQuestionGUI::getAnswerFrequencyTableGUI (   $parentGui,
  $parentCmd,
  $relevantAnswers,
  $questionIndex 
)
Parameters
$parentGui
$parentCmd
$relevantAnswers
$questionIndex
Returns
ilAnswerFrequencyStatisticTableGUI

Reimplemented in assClozeTestGUI, assKprimChoiceGUI, assLongMenuGUI, and assMatchingQuestionGUI.

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

2327 {
2328 require_once 'Modules/TestQuestionPool/classes/tables/class.ilAnswerFrequencyStatisticTableGUI.php';
2329
2330 $table = new ilAnswerFrequencyStatisticTableGUI($parentGui, $parentCmd, $this->object);
2331 $table->setQuestionIndex($questionIndex);
2332 $table->setData($this->getAnswersFrequency($relevantAnswers, $questionIndex));
2333 $table->initColumns();
2334
2335 return $table;
2336 }
getAnswersFrequency($relevantAnswers, $questionIndex)

References getAnswersFrequency().

+ Here is the call graph for this function:

◆ getAnswersFrequency()

assQuestionGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

◆ getAsValueAttribute()

assQuestionGUI::getAsValueAttribute (   $a_value)

Returns a HTML value attribute.

Parameters
mixed$a_valueA given text or value
Returns
string The value as HTML value attribute @access public

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

1138 {
1139 $result = "";
1140 if (strlen($a_value)) {
1141 $result = " value=\"$a_value\" ";
1142 }
1143 return $result;
1144 }
$result

References $result.

◆ getBasicEditQuestionTabCommands()

assQuestionGUI::getBasicEditQuestionTabCommands ( )
protected

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

1991 {
1992 return array('editQuestion', 'save', 'saveEdit', 'originalSyncForm');
1993 }

Referenced by getEditQuestionTabCommands().

+ Here is the caller graph for this function:

◆ getCommandsFromClassConstants()

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

extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants

Parameters
string$guiClassName
string$cmdConstantNameBegin
Returns
array

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

1912 {
1913 $reflectionClass = new ReflectionClass($guiClassName);
1914
1915 $commands = null;
1916
1917 if ($reflectionClass instanceof ReflectionClass) {
1918 $commands = array();
1919
1920 foreach ($reflectionClass->getConstants() as $constName => $constValue) {
1921 if (substr($constName, 0, strlen($cmdConstantNameBegin)) == $cmdConstantNameBegin) {
1922 $commands[] = $constValue;
1923 }
1924 }
1925 }
1926
1927 return $commands;
1928 }

Referenced by addTab_QuestionFeedback(), addTab_QuestionHints(), and ilPCQuestionGUI\setTabs().

+ Here is the caller graph for this function:

◆ getContextPath()

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

get context path in content object tree

Parameters
int$a_endnode_idid of endnode
int$a_startnode_idid of startnode

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

1061 {
1062 $path = "";
1063
1064 $tmpPath = $cont_obj->getLMTree()->getPathFull($a_endnode_id, $a_startnode_id);
1065
1066 // count -1, to exclude the learning module itself
1067 for ($i = 1; $i < (count($tmpPath) - 1); $i++) {
1068 if ($path != "") {
1069 $path .= " > ";
1070 }
1071
1072 $path .= $tmpPath[$i]["title"];
1073 }
1074
1075 return $path;
1076 }

References $i.

Referenced by outPageSelector().

+ Here is the caller graph for this function:

◆ getEditContext()

assQuestionGUI::getEditContext ( )
Returns
string

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

366 {
367 return $this->editContext;
368 }

References $editContext.

Referenced by isAdjustmentEditContext(), and isAuthoringEditContext().

+ Here is the caller graph for this function:

◆ getEditQuestionTabCommands()

assQuestionGUI::getEditQuestionTabCommands ( )
final

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

1986 {
1987 return array_merge($this->getBasicEditQuestionTabCommands(), $this->getAdditionalEditQuestionCommands());
1988 }

References getAdditionalEditQuestionCommands(), and getBasicEditQuestionTabCommands().

+ Here is the call graph for this function:

◆ getErrorMessage()

assQuestionGUI::getErrorMessage ( )

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

1099 {
1100 return $this->errormessage;
1101 }

References $errormessage.

Referenced by assTextQuestionGUI\addSuggestedSolution(), assFlashQuestionGUI\suggestRange(), and assFormulaQuestionGUI\suggestRange().

+ Here is the caller graph for this function:

◆ getFormEncodingType()

assQuestionGUI::getFormEncodingType ( )

Reimplemented in assFileUploadGUI.

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

2218 {
2220 }

References FORM_ENCODING_URLENCODE.

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

+ Here is the caller graph for this function:

◆ getGenericFeedbackOutput()

assQuestionGUI::getGenericFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer specific feedback for the question.

Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback @access public

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

1362 {
1363 $output = "";
1364 include_once "./Modules/Test/classes/class.ilObjTest.php";
1365 $manual_feedback = ilObjTest::getManualFeedback($active_id, $this->object->getId(), $pass);
1366 if (strlen($manual_feedback)) {
1367 return $manual_feedback;
1368 }
1369
1370 $correct_feedback = $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), true);
1371 $incorrect_feedback = $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), false);
1372 if (strlen($correct_feedback . $incorrect_feedback)) {
1373 $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
1374 $max_points = $this->object->getMaximumPoints();
1375 if ($reached_points == $max_points) {
1376 $output = $correct_feedback;
1377 } else {
1378 $output = $incorrect_feedback;
1379 }
1380 }
1381
1382 if ($this->object->isAdditionalContentEditingModePageObject()) {
1383 return $output;
1384 }
1385 return $this->object->prepareTextareaOutput($output, true);
1386 }
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the feedback comment for a question in a test if it is finalized.

References $pass, and ilObjTest\getManualFeedback().

Referenced by getAnswerFeedbackOutput(), assClozeTestGUI\getSolutionOutput(), assErrorTextGUI\getSolutionOutput(), assFormulaQuestionGUI\getSolutionOutput(), assKprimChoiceGUI\getSolutionOutput(), assLongMenuGUI\getSolutionOutput(), assMatchingQuestionGUI\getSolutionOutput(), assNumericGUI\getSolutionOutput(), assOrderingHorizontalGUI\getSolutionOutput(), assOrderingQuestionGUI\getSolutionOutput(), assTextQuestionGUI\getSolutionOutput(), and ilTestPlayerAbstractGUI\populateGenericFeedbackBlock().

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

◆ getGenericFeedbackOutputForCorrectSolution()

assQuestionGUI::getGenericFeedbackOutputForCorrectSolution ( )

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

1389 {
1390 return $this->object->prepareTextareaOutput(
1391 $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), true),
1392 true
1393 );
1394 }

◆ getGenericFeedbackOutputForIncorrectSolution()

assQuestionGUI::getGenericFeedbackOutputForIncorrectSolution ( )

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

1397 {
1398 return $this->object->prepareTextareaOutput(
1399 $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), false),
1400 true
1401 );
1402 }

◆ getHeaderAction()

assQuestionGUI::getHeaderAction ( )

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

186 {
187 global $DIC; /* @var ILIAS\DI\Container $DIC */
188 /* @var ilObjectDataCache $ilObjDataCache */
189 $ilObjDataCache = $DIC['ilObjDataCache'];
190
191 $parentObjType = $ilObjDataCache->lookupType($this->object->getObjId());
192
193 $dispatcher = new ilCommonActionDispatcherGUI(
195 $DIC->access(),
196 $parentObjType,
197 $_GET["ref_id"],
198 $this->object->getObjId()
199 );
200
201 $dispatcher->setSubObject("quest", $this->object->getId());
202
203 $ha = $dispatcher->initHeaderAction();
204 $ha->enableComments(true, false);
205
206 return $ha->getHeaderAction($DIC->ui()->mainTemplate());
207 }
Class ilCommonActionDispatcherGUI.

References $_GET, $DIC, and ilCommonActionDispatcherGUI\TYPE_REPOSITORY.

Referenced by redrawHeaderAction().

+ Here is the caller graph for this function:

◆ getILIASPage()

assQuestionGUI::getILIASPage (   $html = "")

Returns the ILIAS Page around a question.

Returns
string The ILIAS page content @access public

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

626 {
627 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
628 $page_gui = new ilAssQuestionPageGUI($this->object->getId());
629 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
630 $presentation = $page_gui->presentation();
631 $presentation = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $presentation);
632 return $presentation;
633 }
Question page GUI class.

Referenced by assClozeTestGUI\getPreview(), assErrorTextGUI\getPreview(), assFileUploadGUI\getPreview(), assFlashQuestionGUI\getPreview(), assFormulaQuestionGUI\getPreview(), assImagemapQuestionGUI\getPreview(), assJavaAppletGUI\getPreview(), assKprimChoiceGUI\getPreview(), assLongMenuGUI\getPreview(), assMatchingQuestionGUI\getPreview(), assMultipleChoiceGUI\getPreview(), assNumericGUI\getPreview(), assOrderingHorizontalGUI\getPreview(), assOrderingQuestionGUI\getPreview(), assSingleChoiceGUI\getPreview(), assTextQuestionGUI\getPreview(), assTextSubsetGUI\getPreview(), assClozeTestGUI\getSolutionOutput(), assErrorTextGUI\getSolutionOutput(), assFileUploadGUI\getSolutionOutput(), assFlashQuestionGUI\getSolutionOutput(), assFormulaQuestionGUI\getSolutionOutput(), assJavaAppletGUI\getSolutionOutput(), assKprimChoiceGUI\getSolutionOutput(), assLongMenuGUI\getSolutionOutput(), assMatchingQuestionGUI\getSolutionOutput(), assMultipleChoiceGUI\getSolutionOutput(), assNumericGUI\getSolutionOutput(), assOrderingHorizontalGUI\getSolutionOutput(), assOrderingQuestionGUI\getSolutionOutput(), assSingleChoiceGUI\getSolutionOutput(), assTextQuestionGUI\getSolutionOutput(), assTextSubsetGUI\getSolutionOutput(), assErrorTextGUI\getTestOutput(), assFileUploadGUI\getTestOutput(), and assOrderingHorizontalGUI\getTestOutput().

+ Here is the caller graph for this function:

◆ getNavigationGUI()

assQuestionGUI::getNavigationGUI ( )
Returns
ilTestQuestionNavigationGUI

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

403 {
405 }

References $navigationGUI.

Referenced by outQuestionPage().

+ Here is the caller graph for this function:

◆ getNotesHTML()

assQuestionGUI::getNotesHTML ( )

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

210 {
211 $notesGUI = new ilNoteGUI($this->object->getObjId(), $this->object->getId(), 'quest');
212 $notesGUI->enablePublicNotes(true);
213 $notesGUI->enablePublicNotesDeletion(true);
214
215 return $notesGUI->getNotesHTML();
216 }
Notes GUI class.

◆ getPresentationContext()

assQuestionGUI::getPresentationContext ( )
Returns
string

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

273 {
275 }

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 586 of file class.assQuestionGUI.php.

587 {
588 return array();
589 }

Referenced by populateJavascriptFilesRequiredForWorkForm().

+ Here is the caller graph for this function:

◆ getPreview()

◆ getPreviewSession()

◆ getPreviousSolutionConfirmationCheckboxHtml()

assQuestionGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

Reimplemented in assFileUploadGUI, and assImagemapQuestionGUI.

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

700 {
701 $tpl = new ilTemplate('tpl.tst_question_additional_behaviour_checkbox.html', true, true, 'Modules/TestQuestionPool');
702 // hey: prevPassSolutions - use abtract template
703 $tpl->setVariable('TXT_FORCE_FORM_DIFF_LABEL', $this->lng->txt('use_previous_solution'));
704 // hey.
705 return $tpl->get();
706 }
special template class to simplify handling of ITX/PEAR

References $tpl.

Referenced by outQuestionPage().

+ Here is the caller graph for this function:

◆ getPreviousSolutionProvidedMessage()

assQuestionGUI::getPreviousSolutionProvidedMessage ( )
protected

Reimplemented in assFileUploadGUI.

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

695 {
696 return $this->lng->txt('use_previous_solution_advice');
697 }

Referenced by outQuestionPage().

+ Here is the caller graph for this function:

◆ getQuestionActionCmd()

assQuestionGUI::getQuestionActionCmd ( )

◆ getQuestionCount()

assQuestionGUI::getQuestionCount ( )

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

1094 {
1095 return $this->question_count;
1096 }
$question_count
question count in test

References $question_count.

◆ getQuestionHeaderBlockBuilder()

assQuestionGUI::getQuestionHeaderBlockBuilder ( )
Returns
\ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder

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

References $questionHeaderBlockBuilder.

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

+ Here is the caller graph for this function:

◆ getQuestionTemplate()

assQuestionGUI::getQuestionTemplate ( )

get question template

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

595 {
596 // @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)
597 if (!$this->tpl->blockExists('content')) {
598 $this->tpl->addBlockFile("CONTENT", "content", "tpl.il_as_qpl_content.html", "Modules/TestQuestionPool");
599 }
600 // @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)
601 if (!$this->tpl->blockExists('statusline')) {
602 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
603 }
604 // @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
605 if (!$this->tpl->blockExists('adm_content')) {
606 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_question.html", "Modules/TestQuestionPool");
607 }
608 }

Referenced by assTextQuestionGUI\addSuggestedSolution(), assImagemapQuestionGUI\areaEditor(), assClozeTestGUI\editQuestion(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assFlashQuestionGUI\editQuestion(), assJavaAppletGUI\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 ( )

Returns the question type string.

Returns the question type string

Returns
string The question type string @access public

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

1126 {
1127 return $this->object->getQuestionType();
1128 }

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

+ Here is the caller graph for this function:

◆ getRenderPurpose()

assQuestionGUI::getRenderPurpose ( )
Returns
string

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

312 {
314 }

References $renderPurpose.

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

+ Here is the caller graph for this function:

◆ getSequenceNumber()

assQuestionGUI::getSequenceNumber ( )

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

1084 {
1085 return $this->sequence_no;
1086 }
$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 (   $userSolution)
abstract

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

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

Reimplemented in assClozeTestGUI, assErrorTextGUI, assFileUploadGUI, assFlashQuestionGUI, assFormulaQuestionGUI, assImagemapQuestionGUI, assJavaAppletGUI, 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 2309 of file class.assQuestionGUI.php.

2310 {
2311 return array(0);
2312 }

◆ getTargetGuiClass()

assQuestionGUI::getTargetGuiClass ( )

◆ getTaxonomyIds()

assQuestionGUI::getTaxonomyIds ( )

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

421 {
422 return $this->taxonomyIds;
423 }

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 264 of file class.assQuestionGUI.php.

265 {
266 return $this->getQuestionType();
267 }
getQuestionType()
Returns the question type string.

References getQuestionType().

Referenced by buildBasicEditFormObject().

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

◆ getUseIntermediateSolution()

◆ getUseUnchangedAnswerCheckboxHtml()

assQuestionGUI::getUseUnchangedAnswerCheckboxHtml ( )
protected

Reimplemented in assMultipleChoiceGUI.

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

684 {
685 // hey: prevPassSolutions - use abstracted template to share with other purposes of this kind
686 $tpl = new ilTemplate('tpl.tst_question_additional_behaviour_checkbox.html', true, true, 'Modules/TestQuestionPool');
687 $tpl->setVariable('TXT_FORCE_FORM_DIFF_LABEL', $this->object->getTestPresentationConfig()->getUseUnchangedAnswerLabel());
688 // hey.
689 return $tpl->get();
690 }

References $tpl.

Referenced by outQuestionPage().

+ Here is the caller graph for this function:

◆ hasCorrectSolution()

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

◆ hasInlineFeedback()

assQuestionGUI::hasInlineFeedback ( )

this method can be overwritten per question type

Returns
bool

Reimplemented in assKprimChoiceGUI, assMultipleChoiceGUI, and assSingleChoiceGUI.

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

170 {
171 return false;
172 }

Referenced by ilTestPlayerAbstractGUI\populateInstantResponseBlocks().

+ Here is the caller graph for this function:

◆ hasIntermediateSolution()

assQuestionGUI::hasIntermediateSolution (   $activeId,
  $passIndex 
)

Check if the question has an intermediate solution.

Parameters
int$activeId
int$passIndex
Returns
bool

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

2100 {
2101 $result = $this->object->lookupForExistingSolutions($activeId, $passIndex);
2102 return ($result['intermediate']);
2103 }

References $result.

◆ hasSpecialQuestionCommands()

assQuestionGUI::hasSpecialQuestionCommands ( )
protected

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

256 : bool
257 {
258 return static::HAS_SPECIAL_QUESTION_COMMANDS;
259 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ isAdjustmentEditContext()

assQuestionGUI::isAdjustmentEditContext ( )
Parameters
bool$isAdjustmentEditContext

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

References EDIT_CONTEXT_ADJUSTMENT, and getEditContext().

+ Here is the call graph for this function:

◆ isAnswerFreuqencyStatisticSupported()

assQuestionGUI::isAnswerFreuqencyStatisticSupported ( )

Reimplemented in assFileUploadGUI, and assTextQuestionGUI.

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

2305 {
2306 return true;
2307 }

Referenced by ilTestCorrectionsGUI\setCorrectionTabsContext().

+ Here is the caller graph for this function:

◆ isAuthoringEditContext()

assQuestionGUI::isAuthoringEditContext ( )
Parameters
bool$isAuthoringEditContext

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

382 {
384 }

References EDIT_CONTEXT_AUTHORING, and getEditContext().

+ Here is the call graph for this function:

◆ isAutosaveable()

assQuestionGUI::isAutosaveable ( )

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

2132 {
2133 return $this->object->isAutosaveable();
2134 }

◆ isPreviousSolutionPrefilled()

assQuestionGUI::isPreviousSolutionPrefilled ( )
Returns
boolean

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

References $previousSolutionPrefilled.

◆ isRenderPurposeDemoplay()

assQuestionGUI::isRenderPurposeDemoplay ( )

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

References getRenderPurpose(), and RENDER_PURPOSE_DEMOPLAY.

Referenced by assOrderingQuestionGUI\isInteractivePresentation().

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

◆ isRenderPurposeInputValue()

assQuestionGUI::isRenderPurposeInputValue ( )

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

335 {
337 }

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 339 of file class.assQuestionGUI.php.

340 {
342 }

References getRenderPurpose(), and RENDER_PURPOSE_PLAYBACK.

Referenced by assOrderingQuestionGUI\isInteractivePresentation().

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

◆ isRenderPurposePreview()

assQuestionGUI::isRenderPurposePreview ( )

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

330 {
332 }

References getRenderPurpose(), and RENDER_PURPOSE_PREVIEW.

+ Here is the call graph for this function:

◆ isRenderPurposePrintPdf()

◆ isSaveCommand()

◆ isTestPresentationContext()

◆ linkChilds()

assQuestionGUI::linkChilds ( )

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

1844 {
1845 $this->ctrl->saveParameter($this, array("subquestion_index", "link_new_type", "search_link_type"));
1846 switch ($_GET["search_link_type"]) {
1847 case "pg":
1848 return $this->outPageSelector();
1849 break;
1850 case "st":
1851 return $this->outChapterSelector();
1852 break;
1853 case "glo":
1854 return $this->outGlossarySelector();
1855 break;
1856 case "lm":
1857 $subquestion_index = ($_GET["subquestion_index"] > 0) ? $_GET["subquestion_index"] : 0;
1858 $this->object->saveSuggestedSolution("lm", "il__lm_" . $_GET["source_id"], $subquestion_index);
1859 ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), true);
1860 $this->ctrl->redirect($this, "suggestedsolution");
1861 break;
1862 }
1863 }

References $_GET, outChapterSelector(), outGlossarySelector(), and outPageSelector().

+ Here is the call graph for this function:

◆ magicAfterTestOutput()

assQuestionGUI::magicAfterTestOutput ( )

Reimplemented in assTextQuestionGUI.

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

2205 {
2206 return;
2207 }

Referenced by outQuestionForTest().

+ Here is the caller graph for this function:

◆ originalSyncForm()

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

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

735 {
736 if (strlen($return_to)) {
737 $this->ctrl->setParameter($this, "return_to", $return_to);
738 } elseif ($_REQUEST['return_to']) {
739 $this->ctrl->setParameter($this, "return_to", $_REQUEST['return_to']);
740 }
741 if (strlen($return_to_feedback)) {
742 $this->ctrl->setParameter($this, 'return_to_fb', 'true');
743 }
744
745 $this->ctrl->saveParameter($this, 'test_express_mode');
746
747 $template = new ilTemplate("tpl.il_as_qpl_sync_original.html", true, true, "Modules/TestQuestionPool");
748 $template->setVariable("BUTTON_YES", $this->lng->txt("yes"));
749 $template->setVariable("BUTTON_NO", $this->lng->txt("no"));
750 $template->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
751 $template->setVariable("TEXT_SYNC", $this->lng->txt("confirm_sync_questions"));
752 $this->tpl->setVariable("ADM_CONTENT", $template->get());
753 }

Referenced by suggestedsolution().

+ Here is the caller graph for this function:

◆ outAdditionalOutput()

assQuestionGUI::outAdditionalOutput ( )

Reimplemented in assTextQuestionGUI.

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

1114 {
1115 }

◆ outChapterSelector()

assQuestionGUI::outChapterSelector ( )

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

1785 {
1786 require_once 'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
1787 require_once 'Modules/LearningModule/classes/class.ilObjContentObjectGUI.php';
1788
1789 $this->ctrl->setParameter($this, 'q_id', $this->object->getId());
1790
1791 $cont_obj_gui = new ilObjContentObjectGUI('', $_GET['source_id'], true);
1792 $cont_obj = $cont_obj_gui->object;
1793 $ctree = $cont_obj->getLMTree();
1794 $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId()));
1795
1796 $rows = array();
1797
1798 foreach ($nodes as $node) {
1799 if ($node['type'] == $_GET['search_link_type']) {
1800 $this->ctrl->setParameter($this, $node['type'], $node['obj_id']);
1801 $rows[] = array(
1802 'title' => $node['title'],
1803 'description' => '',
1804 'text_add' => $this->lng->txt('add'),
1805 'href_add' => $this->ctrl->getLinkTarget($this, 'add' . strtoupper($node['type']))
1806 );
1807 }
1808 }
1809
1810 $table = new ilQuestionInternalLinkSelectionTableGUI($this, 'cancelExplorer', __METHOD__);
1811 $table->setTitle($this->lng->txt('obj_' . ilUtil::stripSlashes($_GET['search_link_type'])));
1812 $table->setData($rows);
1813
1814 $this->tpl->setContent($table->getHTML());
1815 }
Class ilObjContentObjectGUI.
$rows
Definition: xhr_table.php:10

References $_GET, $rows, and ilUtil\stripSlashes().

Referenced by linkChilds().

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

◆ outGlossarySelector()

assQuestionGUI::outGlossarySelector ( )

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

1818 {
1819 $this->ctrl->setParameter($this, 'q_id', $this->object->getId());
1820
1821 $glossary = new ilObjGlossary($_GET['source_id'], true);
1822 $terms = $glossary->getTermList();
1823
1824 $rows = array();
1825
1826 foreach ($terms as $term) {
1827 $this->ctrl->setParameter($this, 'git', $term['id']);
1828 $rows[] = array(
1829 'title' => $term['term'],
1830 'description' => '',
1831 'text_add' => $this->lng->txt('add'),
1832 'href_add' => $this->ctrl->getLinkTarget($this, 'addGIT')
1833 );
1834 }
1835
1836 $table = new ilQuestionInternalLinkSelectionTableGUI($this, 'cancelExplorer', __METHOD__);
1837 $table->setTitle($this->lng->txt('glossary_term'));
1838 $table->setData($rows);
1839
1840 $this->tpl->setContent($table->getHTML());
1841 }
Class ilObjGlossary.

References $_GET, and $rows.

Referenced by linkChilds().

+ Here is the caller graph for this function:

◆ outPageSelector()

assQuestionGUI::outPageSelector ( )

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

1726 {
1727 require_once 'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
1728 require_once 'Modules/LearningModule/classes/class.ilLMPageObject.php';
1729 require_once 'Modules/LearningModule/classes/class.ilObjContentObjectGUI.php';
1730
1731 $this->ctrl->setParameter($this, 'q_id', $this->object->getId());
1732
1733 $cont_obj_gui = new ilObjContentObjectGUI('', $_GET['source_id'], true);
1734 $cont_obj = $cont_obj_gui->object;
1735 $pages = ilLMPageObject::getPageList($cont_obj->getId());
1736 $shownpages = array();
1737 $tree = $cont_obj->getLMTree();
1738 $chapters = $tree->getSubtree($tree->getNodeData($tree->getRootId()));
1739
1740 $rows = array();
1741
1742 foreach ($chapters as $chapter) {
1743 $chapterpages = $tree->getChildsByType($chapter['obj_id'], 'pg');
1744 foreach ($chapterpages as $page) {
1745 if ($page['type'] == $_GET['search_link_type']) {
1746 array_push($shownpages, $page['obj_id']);
1747
1748 if ($tree->isInTree($page['obj_id'])) {
1749 $path_str = $this->getContextPath($cont_obj, $page['obj_id']);
1750 } else {
1751 $path_str = '---';
1752 }
1753
1754 $this->ctrl->setParameter($this, $page['type'], $page['obj_id']);
1755 $rows[] = array(
1756 'title' => $page['title'],
1757 'description' => ilUtil::prepareFormOutput($path_str),
1758 'text_add' => $this->lng->txt('add'),
1759 'href_add' => $this->ctrl->getLinkTarget($this, 'add' . strtoupper($page['type']))
1760 );
1761 }
1762 }
1763 }
1764 foreach ($pages as $page) {
1765 if (!in_array($page['obj_id'], $shownpages)) {
1766 $this->ctrl->setParameter($this, $page['type'], $page['obj_id']);
1767 $rows[] = array(
1768 'title' => $page['title'],
1769 'description' => '---',
1770 'text_add' => $this->lng->txt('add'),
1771 'href_add' => $this->ctrl->getLinkTarget($this, 'add' . strtoupper($page['type']))
1772 );
1773 }
1774 }
1775
1776 require_once 'Modules/TestQuestionPool/classes/tables/class.ilQuestionInternalLinkSelectionTableGUI.php';
1777 $table = new ilQuestionInternalLinkSelectionTableGUI($this, 'cancelExplorer', __METHOD__);
1778 $table->setTitle($this->lng->txt('obj_' . ilUtil::stripSlashes($_GET['search_link_type'])));
1779 $table->setData($rows);
1780
1781 $this->tpl->setContent($table->getHTML());
1782 }
getContextPath($cont_obj, $a_endnode_id, $a_startnode_id=1)
get context path in content object tree
static getPageList($lm_id)
static

References $_GET, $rows, getContextPath(), ilLMPageObject\getPageList(), ilUtil\prepareFormOutput(), and ilUtil\stripSlashes().

Referenced by linkChilds().

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

◆ outQuestionForTest()

assQuestionGUI::outQuestionForTest (   $formaction,
  $active_id,
  $pass,
  $is_question_postponed = false,
  $user_post_solutions = false,
  $show_specific_inline_feedback = false 
)
final
Parameters
string$formaction
integer$active_id
integer | null$pass
bool$is_question_postponed
bool$user_post_solutions
bool$show_specific_inline_feedback

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

2178 {
2179 $formaction = $this->completeTestOutputFormAction($formaction, $active_id, $pass);
2180
2181 $test_output = $this->getTestOutput(
2182 $active_id,
2183 $pass,
2184 $is_question_postponed,
2185 $user_post_solutions,
2186 $show_specific_inline_feedback
2187 );
2188
2189 $this->magicAfterTestOutput();
2190
2191 $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
2192 $this->tpl->setVariable("FORMACTION", $formaction);
2193 $this->tpl->setVariable("ENCTYPE", 'enctype="' . $this->getFormEncodingType() . '"');
2194 $this->tpl->setVariable("FORM_TIMESTAMP", time());
2195 }
getTestOutput( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
completeTestOutputFormAction($formAction, $active_id, $pass)

References $pass, completeTestOutputFormAction(), getFormEncodingType(), getTestOutput(), and magicAfterTestOutput().

Referenced by ilTestPlayerAbstractGUI\showQuestionEditable().

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

◆ outQuestionPage()

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

output question page

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

639 {
640 // hey: prevPassSolutions - add the "use previous answer"
641 // hey: prevPassSolutions - refactored identifiers
642 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
643 // hey
646 } elseif // (!) --> if ($this->object->getTestQuestionConfig()->isUnchangedAnswerPossible())
647 // hey.
648// fau: testNav - add the "use unchanged answer checkbox"
649 // hey: prevPassSolutions - refactored identifiers
650 ($this->object->getTestPresentationConfig()->isUnchangedAnswerPossible()) {
651 // hey.
652 $html .= $this->getUseUnchangedAnswerCheckboxHtml();
653 }
654 // fau.
655
656 $this->lng->loadLanguageModule("content");
657
658 // fau: testNav - add question buttons below question, add actions menu
659 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
660 $page_gui = new ilAssQuestionPageGUI($this->object->getId());
661 $page_gui->setOutputMode("presentation");
662 $page_gui->setTemplateTargetVar($a_temp_var);
663
664 if ($this->getNavigationGUI()) {
665 $html .= $this->getNavigationGUI()->getHTML();
666 $page_gui->setQuestionActionsHTML($this->getNavigationGUI()->getActionsHTML());
667 }
668 // fau.
669
670 if (strlen($html)) {
671 $page_gui->setQuestionHTML(array($this->object->getId() => $html));
672 }
673
674 // fau: testNav - fill the header with subtitle blocks for question info an actions
675 $page_gui->setPresentationTitle($this->questionHeaderBlockBuilder->getPresentationTitle());
676 $page_gui->setQuestionInfoHTML($this->questionHeaderBlockBuilder->getQuestionInfoHTML());
677 // fau.
678
679 return $page_gui->presentation();
680 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References getNavigationGUI(), getPreviousSolutionConfirmationCheckboxHtml(), getPreviousSolutionProvidedMessage(), getUseUnchangedAnswerCheckboxHtml(), and ilUtil\sendInfo().

Referenced by assClozeTestGUI\getTestOutput(), assErrorTextGUI\getTestOutput(), assLongMenuGUI\getTestOutput(), assMultipleChoiceGUI\getTestOutput(), assKprimChoiceGUI\getTestOutput(), assNumericGUI\getTestOutput(), assFileUploadGUI\getTestOutput(), assFlashQuestionGUI\getTestOutput(), assFormulaQuestionGUI\getTestOutput(), assImagemapQuestionGUI\getTestOutput(), assJavaAppletGUI\getTestOutput(), assOrderingHorizontalGUI\getTestOutput(), assSingleChoiceGUI\getTestOutput(), assMatchingQuestionGUI\getTestOutput(), assTextQuestionGUI\getTestOutput(), assTextSubsetGUI\getTestOutput(), assOrderingQuestionGUI\getTestOutput(), 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 1416 of file class.assQuestionGUI.php.

1417 {
1418 $count = $this->object->isInUse();
1419
1420 if ($this->object->_questionExistsInPool($this->object->getId()) && $count) {
1421 global $DIC;
1422 $rbacsystem = $DIC['rbacsystem'];
1423 if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) {
1424 ilUtil::sendInfo(sprintf($this->lng->txt("qpl_question_is_in_use"), $count));
1425 }
1426 }
1427
1428 return assQuestion::_getQuestionTypeName($this->object->getQuestionType());
1429 }
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.

References $_GET, $DIC, assQuestion\_getQuestionTypeName(), and ilUtil\sendInfo().

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

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

◆ outSolutionExplorer()

assQuestionGUI::outSolutionExplorer ( )

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

1646 {
1647 global $DIC;
1648 $tree = $DIC['tree'];
1649
1650 include_once("./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1651 $type = $_GET["link_new_type"];
1652 $search = $_GET["search_link_type"];
1653 $this->ctrl->setParameter($this, "link_new_type", $type);
1654 $this->ctrl->setParameter($this, "search_link_type", $search);
1655 $this->ctrl->saveParameter($this, array("subquestion_index", "link_new_type", "search_link_type"));
1656
1657 ilUtil::sendInfo($this->lng->txt("select_object_to_link"));
1658
1659 $parent_ref_id = $tree->getParentId($_GET["ref_id"]);
1660 $exp = new ilSolutionExplorer($this->ctrl->getLinkTarget($this, 'suggestedsolution'), get_class($this));
1661 $exp->setExpand($_GET['expand_sol'] ? $_GET['expand_sol'] : $parent_ref_id);
1662 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'outSolutionExplorer'));
1663 $exp->setTargetGet("ref_id");
1664 $exp->setRefId($_GET["ref_id"]);
1665 $exp->addFilter($type);
1666 $exp->setSelectableType($type);
1667 if (isset($_GET['expandCurrentPath']) && $_GET['expandCurrentPath']) {
1668 $exp->expandPathByRefId($parent_ref_id);
1669 }
1670
1671 // build html-output
1672 $exp->setOutput(0);
1673
1674 $template = new ilTemplate("tpl.il_as_qpl_explorer.html", true, true, "Modules/TestQuestionPool");
1675 $template->setVariable("EXPLORER_TREE", $exp->getOutput());
1676 $template->setVariable("BUTTON_CANCEL", $this->lng->txt("cancel"));
1677 $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "suggestedsolution"));
1678 $this->tpl->setVariable("ADM_CONTENT", $template->get());
1679 }
$type

References $_GET, $DIC, $type, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ populateCorrectionsFormProperties()

◆ populateJavascriptFilesRequiredForWorkForm()

assQuestionGUI::populateJavascriptFilesRequiredForWorkForm ( ilGlobalTemplateInterface  $tpl)

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

580 {
581 foreach ($this->getPresentationJavascripts() as $jsFile) {
582 $tpl->addJavaScript($jsFile);
583 }
584 }

References $tpl, and getPresentationJavascripts().

+ Here is the call graph for this function:

◆ populateTaxonomyFormSection()

assQuestionGUI::populateTaxonomyFormSection ( ilPropertyFormGUI  $form)
protected

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

1306 {
1307 if ($this->getTaxonomyIds() !== []) {
1308 // this is needed by ilTaxSelectInputGUI in some cases
1309 require_once 'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
1310 ilOverlayGUI::initJavaScript();
1311
1312 $sectHeader = new ilFormSectionHeaderGUI();
1313 $sectHeader->setTitle($this->lng->txt('qpl_qst_edit_form_taxonomy_section'));
1314 $form->addItem($sectHeader);
1315
1316 require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
1317
1318 foreach ($this->getTaxonomyIds() as $taxonomyId) {
1319 $taxonomy = new ilObjTaxonomy($taxonomyId);
1320 $label = sprintf($this->lng->txt('qpl_qst_edit_form_taxonomy'), $taxonomy->getTitle());
1321 $postvar = "tax_node_assign_$taxonomyId";
1322
1323 $taxSelect = new ilTaxSelectInputGUI($taxonomy->getId(), $postvar, true);
1324 $taxSelect->setTitle($label);
1325
1326 require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
1327 $taxNodeAssignments = new ilTaxNodeAssignment(ilObject::_lookupType($this->object->getObjId()), $this->object->getObjId(), 'quest', $taxonomyId);
1328 $assignedNodes = $taxNodeAssignments->getAssignmentsOfItem($this->object->getId());
1329
1330 $taxSelect->setValue(array_map(function ($assignedNode) {
1331 return $assignedNode['node_id'];
1332 }, $assignedNodes));
1333 $form->addItem($taxSelect);
1334 }
1335 }
1336 }
This class represents a section header in a property form.
static _lookupType($a_id, $a_reference=false)
lookup object type
addItem($a_item)
Add Item (Property, SectionHeader).
Taxonomy node <-> item assignment.
Select taxonomy nodes input GUI.

References ilObject\_lookupType(), ilPropertyFormGUI\addItem(), and getTaxonomyIds().

Referenced by assImagemapQuestionGUI\buildEditForm(), assKprimChoiceGUI\buildEditForm(), assLongMenuGUI\buildEditForm(), assMultipleChoiceGUI\buildEditForm(), assOrderingQuestionGUI\buildEditForm(), assClozeTestGUI\editQuestion(), assErrorTextGUI\editQuestion(), assFileUploadGUI\editQuestion(), assFlashQuestionGUI\editQuestion(), assJavaAppletGUI\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)
Parameters
ilPropertyFormGUI$form

Reimplemented in assOrderingQuestionGUI.

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

2342 {
2343 }

◆ redrawHeaderAction()

assQuestionGUI::redrawHeaderAction ( )

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

179 {
180 global $DIC; /* @var ILIAS\DI\Container $DIC */
181 echo $this->getHeaderAction() . $DIC->ui()->mainTemplate()->getOnLoadCodeForAsynch();
182 exit;
183 }
exit
Definition: login.php:29

References $DIC, exit, and getHeaderAction().

+ Here is the call graph for this function:

◆ renderEditForm()

assQuestionGUI::renderEditForm (   $form)
protected
Parameters
$form

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

614 {
615 $this->getQuestionTemplate();
616 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
617 }
getQuestionTemplate()
get question template

References 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 349 of file class.assQuestionGUI.php.

350 {
351 if ($this->isRenderPurposePrintPdf()) {
352 return false;
353 }
354
355 if ($this->isRenderPurposeInputValue()) {
356 return false;
357 }
358
359 return true;
360 }

References isRenderPurposeInputValue(), and isRenderPurposePrintPdf().

Referenced by assKprimChoiceGUI\getSolutionOutput(), assMultipleChoiceGUI\getSolutionOutput(), assSingleChoiceGUI\getSolutionOutput(), assTextQuestionGUI\getSolutionOutput(), and assClozeTestGUI\populateSolutiontextToGapTpl().

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

◆ save()

assQuestionGUI::save ( )

save question

in express mode, so add question to test directly

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

868 {
869 global $DIC;
870 $ilUser = $DIC['ilUser'];
871 $old_id = $_GET["q_id"];
872 $result = $this->writePostData();
873
874 if ($result == 0) {
875 $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
876 $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
877 $this->object->saveToDb();
878 $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
879
880
881 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
882 if (($_GET["calling_test"] || (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer'])) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
883 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
884 $this->ctrl->setParameter($this, 'return_to', 'editQuestion');
885 $this->ctrl->redirect($this, "originalSyncForm");
886 return;
887 } elseif ($_GET["calling_test"]) {
888 require_once 'Modules/Test/classes/class.ilObjTest.php';
889 $test = new ilObjTest($_GET["calling_test"]);
890 if (!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())) {
891 $tree = $DIC['tree'];
892 $ilDB = $DIC['ilDB'];
893 $ilPluginAdmin = $DIC['ilPluginAdmin'];
894
895 include_once("./Modules/Test/classes/class.ilObjTest.php");
896 $_GET["ref_id"] = $_GET["calling_test"];
897 $test = new ilObjTest($_GET["calling_test"], true);
898
899 require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
900 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
901
902 $new_id = $test->insertQuestion(
903 $testQuestionSetConfigFactory->getQuestionSetConfig(),
904 $this->object->getId()
905 );
906
907 if (isset($_REQUEST['prev_qid'])) {
908 $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST['prev_qid']);
909 }
910
911 $this->ctrl->setParameter($this, 'q_id', $new_id);
912 $this->ctrl->setParameter($this, 'calling_test', $_GET['calling_test']);
913 #$this->ctrl->setParameter($this, 'test_ref_id', false);
914 }
915 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
916 $this->ctrl->redirect($this, 'editQuestion');
917 } else {
918 $this->callNewIdListeners($this->object->getId());
919
920 if ($this->object->getId() != $old_id) {
921 // first save
922 $this->ctrl->setParameterByClass($_GET["cmdClass"], "q_id", $this->object->getId());
923 $this->ctrl->setParameterByClass($_GET["cmdClass"], "sel_question_types", $_GET["sel_question_types"]);
924 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
925
926 //global $___test_express_mode;
930 if ($_REQUEST['prev_qid']) {
931 // @todo: bheyser/mbecker wtf? ..... thx@jposselt ....
932 // mbecker: Possible fix: Just instantiate the obj?
933 include_once("./Modules/Test/classes/class.ilObjTest.php");
934 $test = new ilObjTest($_GET["ref_id"], true);
935 $test->moveQuestionAfter($_REQUEST['prev_qid'], $this->object->getId());
936 }
937 if ( /*$___test_express_mode || */ $_REQUEST['express_mode']) {
938 $tree = $DIC['tree'];
939 $ilDB = $DIC['ilDB'];
940 $ilPluginAdmin = $DIC['ilPluginAdmin'];
941
942 include_once("./Modules/Test/classes/class.ilObjTest.php");
943 $test = new ilObjTest($_GET["ref_id"], true);
944
945 require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
946 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
947
948 $test->insertQuestion(
949 $testQuestionSetConfigFactory->getQuestionSetConfig(),
950 $this->object->getId()
951 );
952
953 require_once 'Modules/Test/classes/class.ilTestExpressPage.php';
954 $_REQUEST['q_id'] = $this->object->getId();
956 }
957
958 $this->ctrl->redirectByClass($_GET["cmdClass"], "editQuestion");
959 }
960 if (strcmp($_SESSION["info"], "") != 0) {
961 ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), true);
962 } else {
963 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
964 }
965 $this->ctrl->redirect($this, 'editQuestion');
966 }
967 }
968 $tabs = $DIC['ilTabs'];
969 $tabs->setTabActive('edit_question');
970 }
$test
Definition: Utf8Test.php:84
$_SESSION["AccountId"]
callNewIdListeners($a_new_id)
Call the new id listeners.
static _questionExistsInTest($question_id, $test_id)
static _isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
$ilUser
Definition: imgupload.php:18

References $_GET, $_SESSION, $DIC, $ilDB, $ilUser, $result, $test, assQuestion\_isWriteable(), assQuestion\_questionExistsInTest(), callNewIdListeners(), ilTestExpressPage\getReturnToPageLink(), ilUtil\redirect(), and writePostData().

Referenced by assFormulaQuestionGUI\saveFQ().

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

◆ saveCorrectionsFormProperties()

◆ saveEdit()

assQuestionGUI::saveEdit ( )

save question

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

817 {
818 global $DIC;
819 $ilUser = $DIC['ilUser'];
820
821 $result = $this->writePostData();
822 if ($result == 0) {
823 $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
824 $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
825 $this->object->saveToDb();
826 $originalexists = $this->object->_questionExists($this->object->original_id);
827 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
828 if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
829 $this->ctrl->redirect($this, "originalSyncForm");
830 } elseif ($_GET["calling_test"]) {
831 $_GET["ref_id"] = $_GET["calling_test"];
832 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["calling_test"]);
833 return;
834 } elseif ($_GET["test_ref_id"]) {
835 global $DIC;
836 $tree = $DIC['tree'];
837 $ilDB = $DIC['ilDB'];
838 $ilPluginAdmin = $DIC['ilPluginAdmin'];
839
840 include_once("./Modules/Test/classes/class.ilObjTest.php");
841 $_GET["ref_id"] = $_GET["test_ref_id"];
842 $test = new ilObjTest($_GET["test_ref_id"], true);
843
844 require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
845 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
846
847 $test->insertQuestion($testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId());
848
849 ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["test_ref_id"]);
850 } else {
851 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
852 $this->editQuestion();
853 if (strcmp($_SESSION["info"], "") != 0) {
854 ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), false);
855 } else {
856 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), false);
857 }
858 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $this->object->getId());
859 $this->ctrl->redirectByClass("ilAssQuestionPageGUI", "edit");
860 }
861 }
862 }

References $_GET, $_SESSION, $DIC, $ilDB, $ilUser, $result, $test, assQuestion\_isWriteable(), ilUtil\redirect(), and writePostData().

+ Here is the call graph for this function:

◆ saveReturn()

assQuestionGUI::saveReturn ( )

save question

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

976 {
977 global $DIC;
978 $ilUser = $DIC['ilUser'];
979 $old_id = $_GET["q_id"];
980 $result = $this->writePostData();
981 if ($result == 0) {
982 $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType());
983 $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType());
984 $this->object->saveToDb();
985 $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
986
987 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
988 if (($_GET["calling_test"] || (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer'])) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
989 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
990 $this->ctrl->setParameter($this, 'test_express_mode', $_REQUEST['test_express_mode']);
991 $this->ctrl->redirect($this, "originalSyncForm");
992 return;
993 } elseif ($_GET["calling_test"]) {
994 require_once 'Modules/Test/classes/class.ilObjTest.php';
995 $test = new ilObjTest($_GET["calling_test"]);
996 $q_id = $this->object->getId();
997 if (!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())) {
998 $tree = $DIC['tree'];
999 $ilDB = $DIC['ilDB'];
1000 $ilPluginAdmin = $DIC['ilPluginAdmin'];
1001
1002 include_once("./Modules/Test/classes/class.ilObjTest.php");
1003 $_GET["ref_id"] = $_GET["calling_test"];
1004 $test = new ilObjTest($_GET["calling_test"], true);
1005
1006 require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1007 $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test);
1008
1009 $new_id = $test->insertQuestion(
1010 $testQuestionSetConfigFactory->getQuestionSetConfig(),
1011 $this->object->getId()
1012 );
1013
1014 $q_id = $new_id;
1015 if (isset($_REQUEST['prev_qid'])) {
1016 $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST['prev_qid']);
1017 }
1018
1019 $this->ctrl->setParameter($this, 'q_id', $new_id);
1020 $this->ctrl->setParameter($this, 'calling_test', $_GET['calling_test']);
1021 }
1022 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1023 $this->ctrl->setParameterByClass('ilAssQuestionPreviewGUI', 'q_id', $q_id);
1024 $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
1025 } else {
1026 if ($this->object->getId() != $old_id) {
1027 $this->callNewIdListeners($this->object->getId());
1028 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1029 $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions");
1030 }
1031 if (strcmp($_SESSION["info"], "") != 0) {
1032 ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), true);
1033 } else {
1034 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1035 }
1036 $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
1037 }
1038 }
1039 $tabs = $DIC['ilTabs'];
1040 $tabs->setTabActive('edit_question');
1041 }

References $_GET, $_SESSION, $DIC, $ilDB, $ilUser, $result, $test, assQuestion\_isWriteable(), assQuestion\_questionExistsInTest(), callNewIdListeners(), ilAssQuestionPreviewGUI\CMD_SHOW, and writePostData().

+ Here is the call graph for this function:

◆ saveSuggestedSolution()

assQuestionGUI::saveSuggestedSolution ( )

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

1682 {
1683 global $DIC;
1684 $tree = $DIC['tree'];
1685
1686 include_once("./Modules/TestQuestionPool/classes/class.ilSolutionExplorer.php");
1687 switch ($_POST["solutiontype"]) {
1688 case "lm":
1689 $type = "lm";
1690 $search = "lm";
1691 break;
1692 case "git":
1693 $type = "glo";
1694 $search = "glo";
1695 break;
1696 case "st":
1697 $type = "lm";
1698 $search = "st";
1699 break;
1700 case "pg":
1701 $type = "lm";
1702 $search = "pg";
1703 break;
1704 case "file":
1705 case "text":
1706 return $this->suggestedsolution();
1707 break;
1708 default:
1709 return $this->suggestedsolution();
1710 break;
1711 }
1712 if (isset($_POST['solutiontype'])) {
1713 $this->ctrl->setParameter($this, 'expandCurrentPath', 1);
1714 }
1715 $this->ctrl->setParameter($this, "link_new_type", $type);
1716 $this->ctrl->setParameter($this, "search_link_type", $search);
1717 $this->ctrl->redirect($this, "outSolutionExplorer");
1718 }
$_POST["username"]
suggestedsolution()
Allows to add suggested solutions for questions.

References $_POST, $DIC, $type, and suggestedsolution().

+ Here is the call graph for this function:

◆ saveTaxonomyAssignments()

assQuestionGUI::saveTaxonomyAssignments ( )
protected

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

1291 {
1292 if (count($this->getTaxonomyIds())) {
1293 require_once 'Services/Taxonomy/classes/class.ilTaxAssignInputGUI.php';
1294
1295 foreach ($this->getTaxonomyIds() as $taxonomyId) {
1296 $postvar = "tax_node_assign_$taxonomyId";
1297
1298 $tax_node_assign = new ilTaxAssignInputGUI($taxonomyId, true, '', $postvar);
1299 // TODO: determine tst/qpl when tax assigns become maintainable within tests
1300 $tax_node_assign->saveInput("qpl", $this->object->getObjId(), "quest", $this->object->getId());
1301 }
1302 }
1303 }
Input GUI class for taxonomy assignments.

References getTaxonomyIds().

Referenced by assFormulaQuestionGUI\saveFQ(), assFormulaQuestionGUI\saveReturnFQ(), assClozeTestGUI\writePostData(), assErrorTextGUI\writePostData(), assFileUploadGUI\writePostData(), assFlashQuestionGUI\writePostData(), assImagemapQuestionGUI\writePostData(), assJavaAppletGUI\writePostData(), assLongMenuGUI\writePostData(), assMatchingQuestionGUI\writePostData(), assMultipleChoiceGUI\writePostData(), assNumericGUI\writePostData(), assOrderingHorizontalGUI\writePostData(), assSingleChoiceGUI\writePostData(), assTextQuestionGUI\writePostData(), assTextSubsetGUI\writePostData(), assOrderingQuestionGUI\writePostData(), assKprimChoiceGUI\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 394 of file class.assQuestionGUI.php.

395 {
396 return $this->setEditContext(self::EDIT_CONTEXT_ADJUSTMENT);
397 }
setEditContext($editContext)

References setEditContext().

+ Here is the call graph for this function:

◆ setDefaultTabs()

assQuestionGUI::setDefaultTabs ( ilTabsGUI  $ilTabs)
protected

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

1942 {
1943 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
1944 $q_type = $this->object->getQuestionType();
1945
1946 if (strlen($q_type)) {
1947 $classname = $q_type . "GUI";
1948 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
1949 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
1950 }
1951
1952 if ($_GET["q_id"]) {
1953 $this->addTab_Question($ilTabs);
1954 }
1955
1956 // add tab for question feedback within common class assQuestionGUI
1957 $this->addTab_QuestionFeedback($ilTabs);
1958
1959 // add tab for question hint within common class assQuestionGUI
1960 $this->addTab_QuestionHints($ilTabs);
1961
1962 // add tab for question's suggested solution within common class assQuestionGUI
1963 $this->addTab_SuggestedSolution($ilTabs, $classname);
1964 }
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addTab_Question(ilTabsGUI $tabsGUI)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI

References $_GET, addTab_Question(), addTab_QuestionFeedback(), addTab_QuestionHints(), and addTab_SuggestedSolution().

Referenced by setQuestionTabs().

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

◆ setEditContext()

assQuestionGUI::setEditContext (   $editContext)
Parameters
string$editContext

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

374 {
375 $this->editContext = $editContext;
376 }

References $editContext.

Referenced by setAdjustmentEditContext().

+ Here is the caller graph for this function:

◆ setErrorMessage()

assQuestionGUI::setErrorMessage (   $errormessage)

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

1104 {
1105 $this->errormessage = $errormessage;
1106 }

References $errormessage.

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

+ Here is the caller graph for this function:

◆ setNavigationGUI()

assQuestionGUI::setNavigationGUI (   $navigationGUI)
Parameters
ilTestQuestionNavigationGUI$navigationGUI

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

411 {
412 $this->navigationGUI = $navigationGUI;
413 }

References $navigationGUI.

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

+ Here is the caller graph for this function:

◆ setPresentationContext()

assQuestionGUI::setPresentationContext (   $presentationContext)
Parameters
string$presentationContext

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

281 {
282 $this->presentationContext = $presentationContext;
283 }

References $presentationContext.

◆ setPreviewSession()

assQuestionGUI::setPreviewSession (   $previewSession)
Parameters
\ilAssQuestionPreviewSession$previewSession

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

2243 {
2244 $this->previewSession = $previewSession;
2245 }

References $previewSession.

◆ setPreviousSolutionPrefilled()

assQuestionGUI::setPreviousSolutionPrefilled (   $previousSolutionPrefilled)
Parameters
boolean$previousSolutionPrefilled

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

303 {
304 $this->previousSolutionPrefilled = $previousSolutionPrefilled;
305 }

References $previousSolutionPrefilled.

◆ setQuestionActionCmd()

assQuestionGUI::setQuestionActionCmd (   $questionActionCmd)

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

459 {
460 $this->questionActionCmd = $questionActionCmd;
461
462 if (is_object($this->object)) {
463 $this->object->questionActionCmd = $questionActionCmd;
464 }
465 }

References $questionActionCmd.

◆ setQuestionCount()

assQuestionGUI::setQuestionCount (   $a_question_count)

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

1089 {
1090 $this->question_count = $a_question_count;
1091 }

◆ setQuestionHeaderBlockBuilder()

assQuestionGUI::setQuestionHeaderBlockBuilder (   $questionHeaderBlockBuilder)
Parameters
\ilQuestionHeaderBlockBuilder$questionHeaderBlockBuilder

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

444 {
445 $this->questionHeaderBlockBuilder = $questionHeaderBlockBuilder;
446 }

References $questionHeaderBlockBuilder.

◆ setQuestionSpecificTabs()

assQuestionGUI::setQuestionSpecificTabs ( ilTabsGUI  $ilTabs)
protected

Reimplemented in assFormulaQuestionGUI.

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

1967 {
1968 }

Referenced by setQuestionTabs().

+ Here is the caller graph for this function:

◆ setQuestionTabs()

assQuestionGUI::setQuestionTabs ( )

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

1931 {
1932 global $DIC;
1933 $ilTabs = $DIC['ilTabs'];
1934
1935 $ilTabs->clearTargets();
1936 $this->setDefaultTabs($ilTabs);
1937 $this->setQuestionSpecificTabs($ilTabs);
1938 $this->addBackTab($ilTabs);
1939 }
setQuestionSpecificTabs(ilTabsGUI $ilTabs)
setDefaultTabs(ilTabsGUI $ilTabs)
addBackTab(ilTabsGUI $ilTabs)

References $DIC, addBackTab(), setDefaultTabs(), and setQuestionSpecificTabs().

+ Here is the call graph for this function:

◆ setRenderPurpose()

assQuestionGUI::setRenderPurpose (   $renderPurpose)
Parameters
string$renderPurpose

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

320 {
321 $this->renderPurpose = $renderPurpose;
322 }

References $renderPurpose.

Referenced by suggestedsolution().

+ Here is the caller graph for this function:

◆ setSequenceNumber()

assQuestionGUI::setSequenceNumber (   $nr)

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

1079 {
1080 $this->sequence_no = $nr;
1081 }

◆ setTargetGui()

assQuestionGUI::setTargetGui (   $linkTargetGui)

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

426 {
427 $this->setTargetGuiClass(get_class($linkTargetGui));
428 }
setTargetGuiClass($targetGuiClass)

References setTargetGuiClass().

+ Here is the call graph for this function:

◆ setTargetGuiClass()

assQuestionGUI::setTargetGuiClass (   $targetGuiClass)

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

431 {
432 $this->targetGuiClass = $targetGuiClass;
433 }

References $targetGuiClass.

Referenced by setTargetGui().

+ Here is the caller graph for this function:

◆ setTaxonomyIds()

assQuestionGUI::setTaxonomyIds (   $taxonomyIds)

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

416 {
417 $this->taxonomyIds = $taxonomyIds;
418 }

References $taxonomyIds.

◆ setUseIntermediateSolution()

assQuestionGUI::setUseIntermediateSolution (   $use)

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

2110 {
2111 $this->use_intermediate_solution = (bool) $use;
2112 }

◆ showHints()

assQuestionGUI::showHints ( )

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

2276 {
2277 global $DIC;
2278 $ilCtrl = $DIC['ilCtrl'];
2279 $ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
2280 }

References $DIC, and ilAssQuestionHintsGUI\CMD_SHOW_LIST.

◆ showSuggestedSolution()

assQuestionGUI::showSuggestedSolution ( )

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

1432 {
1433 $this->suggestedsolution();
1434 }

References suggestedsolution().

+ Here is the call graph for this function:

◆ suggestedsolution()

assQuestionGUI::suggestedsolution ( )

Allows to add suggested solutions for questions.

@access public

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

1442 {
1443 global $DIC;
1444 $ilUser = $DIC['ilUser'];
1445 $ilAccess = $DIC['ilAccess'];
1446
1447 $save = (is_array($_POST["cmd"]) && array_key_exists("suggestedsolution", $_POST["cmd"])) ? true : false;
1448
1449 if ($save && $_POST["deleteSuggestedSolution"] == 1) {
1450 $this->object->deleteSuggestedSolutions();
1451 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1452 $this->ctrl->redirect($this, "suggestedsolution");
1453 }
1454
1455 $output = "";
1456 $solution_array = $this->object->getSuggestedSolution(0);
1457 $options = array(
1458 "lm" => $this->lng->txt("obj_lm"),
1459 "st" => $this->lng->txt("obj_st"),
1460 "pg" => $this->lng->txt("obj_pg"),
1461 "git" => $this->lng->txt("glossary_term"),
1462 "file" => $this->lng->txt("fileDownload"),
1463 "text" => $this->lng->txt("solutionText")
1464 );
1465
1466 if ((strcmp($_POST["solutiontype"], "file") == 0) && (strcmp($solution_array["type"], "file") != 0)) {
1467 $solution_array = array(
1468 "type" => "file"
1469 );
1470 } elseif ((strcmp($_POST["solutiontype"], "text") == 0) && (strcmp($solution_array["type"], "text") != 0)) {
1471 $oldOutputMode = $this->getRenderPurpose();
1472 $this->setRenderPurpose(self::RENDER_PURPOSE_INPUT_VALUE);
1473
1474 $solution_array = array(
1475 "type" => "text",
1476 "value" => $this->getSolutionOutput(0, null, false, false, true, false, true)
1477 );
1478 $this->setRenderPurpose($oldsaveSuggestedSolutionOutputMode);
1479 }
1480 if ($save && strlen($_POST["filename"])) {
1481 $solution_array["value"]["filename"] = $_POST["filename"];
1482 }
1483 if ($save && strlen($_POST["solutiontext"])) {
1484 $solution_array["value"] = $_POST["solutiontext"];
1485 }
1486 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1487 if (count($solution_array)) {
1488 $form = new ilPropertyFormGUI();
1489 $form->setFormAction($this->ctrl->getFormAction($this));
1490 $form->setTitle($this->lng->txt("solution_hint"));
1491 $form->setMultipart(true);
1492 $form->setTableWidth("100%");
1493 $form->setId("suggestedsolutiondisplay");
1494
1495 // suggested solution output
1496 include_once "./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
1497 $title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype");
1498 $template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", true, true, "Modules/TestQuestionPool");
1499 if (strlen($solution_array["internal_link"])) {
1500 $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
1501 $template->setCurrentBlock("preview");
1502 $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
1503 $template->setVariable("VALUE_SOLUTION", " <a href=\"$href\" target=\"content\">" . $this->lng->txt("view") . "</a> ");
1504 $template->parseCurrentBlock();
1505 } elseif ((strcmp($solution_array["type"], "file") == 0) && (is_array($solution_array["value"]))) {
1506 $href = $this->object->getSuggestedSolutionPathWeb() . $solution_array["value"]["name"];
1507 $template->setCurrentBlock("preview");
1508 $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
1509 $template->setVariable("VALUE_SOLUTION", " <a href=\"$href\" target=\"content\">" . ilUtil::prepareFormOutput((strlen($solution_array["value"]["filename"])) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]) . "</a> ");
1510 $template->parseCurrentBlock();
1511 }
1512 $template->setVariable("TEXT_TYPE", $this->lng->txt("type"));
1513 $template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]);
1514 $title->setHtml($template->get());
1515 $deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution");
1516 $deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution"));
1517 $title->addSubItem($deletesolution);
1518 $form->addItem($title);
1519
1520 if (strcmp($solution_array["type"], "file") == 0) {
1521 // file
1522 $file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file");
1523 $file->setRequired(true);
1524 $file->enableFileNameSelection("filename");
1525 //$file->setSuffixes(array("doc","xls","png","jpg","gif","pdf"));
1526 if ($_FILES["file"]["tmp_name"] && $file->checkInput()) {
1527 if (!file_exists($this->object->getSuggestedSolutionPath())) {
1528 ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
1529 }
1530
1531 $res = ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"], $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]);
1532 if ($res) {
1533 ilUtil::renameExecutables($this->object->getSuggestedSolutionPath());
1534
1535 // remove an old file download
1536 if (is_array($solution_array["value"])) {
1537 @unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]);
1538 }
1539 $file->setValue($_FILES["file"]["name"]);
1540 $this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"]));
1541 $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
1542 if (($_GET["calling_test"] || (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer'])) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
1543 return $this->originalSyncForm("suggestedsolution");
1544 } else {
1545 ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), true);
1546 $this->ctrl->redirect($this, "suggestedsolution");
1547 }
1548 } else {
1549 // BH: $res as info string? wtf? it holds a bool or something else!!?
1551 }
1552 } else {
1553 if (is_array($solution_array["value"])) {
1554 $file->setValue($solution_array["value"]["name"]);
1555 $file->setFilename((strlen($solution_array["value"]["filename"])) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]);
1556 }
1557 }
1558 $form->addItem($file);
1559 $hidden = new ilHiddenInputGUI("solutiontype");
1560 $hidden->setValue("file");
1561 $form->addItem($hidden);
1562 } elseif (strcmp($solution_array["type"], "text") == 0) {
1563 $solutionContent = $solution_array['value'];
1564 $solutionContent = $this->object->fixSvgToPng($solutionContent);
1565 $solutionContent = $this->object->fixUnavailableSkinImageSources($solutionContent);
1566 $question = new ilTextAreaInputGUI($this->lng->txt("solutionText"), "solutiontext");
1567 $question->setValue($this->object->prepareTextareaOutput($solutionContent));
1568 $question->setRequired(true);
1569 $question->setRows(10);
1570 $question->setCols(80);
1571 $question->setUseRte(true);
1572 $question->addPlugin("latex");
1573 $question->addButton("latex");
1574 $question->setRTESupport($this->object->getId(), "qpl", "assessment");
1575 $hidden = new ilHiddenInputGUI("solutiontype");
1576 $hidden->setValue("text");
1577 $form->addItem($hidden);
1578 $form->addItem($question);
1579 }
1580 if ($ilAccess->checkAccess("write", "", $_GET['ref_id'])) {
1581 $form->addCommandButton('showSuggestedSolution', $this->lng->txt('cancel'));
1582 $form->addCommandButton('suggestedsolution', $this->lng->txt('save'));
1583 }
1584
1585 if ($save) {
1586 if ($form->checkInput()) {
1587 switch ($solution_array["type"]) {
1588 case "file":
1589 $this->object->saveSuggestedSolution("file", "", 0, array(
1590 "name" => $solution_array["value"]["name"],
1591 "type" => $solution_array["value"]["type"],
1592 "size" => $solution_array["value"]["size"],
1593 "filename" => $_POST["filename"]
1594 ));
1595 break;
1596 case "text":
1597 $this->object->saveSuggestedSolution("text", "", 0, $solution_array["value"]);
1598 break;
1599 }
1600 $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
1601 if (($_GET["calling_test"] || (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer'])) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
1602 return $this->originalSyncForm("suggestedsolution");
1603 } else {
1604 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1605 $this->ctrl->redirect($this, "suggestedsolution");
1606 }
1607 }
1608 }
1609
1610 $output = $form->getHTML();
1611 }
1612
1613 $savechange = (strcmp($this->ctrl->getCmd(), "saveSuggestedSolution") == 0) ? true : false;
1614
1615 $changeoutput = "";
1616 if ($ilAccess->checkAccess("write", "", $_GET['ref_id'])) {
1617 $formchange = new ilPropertyFormGUI();
1618 $formchange->setFormAction($this->ctrl->getFormAction($this));
1619 $formchange->setTitle((count($solution_array)) ? $this->lng->txt("changeSuggestedSolution") : $this->lng->txt("addSuggestedSolution"));
1620 $formchange->setMultipart(false);
1621 $formchange->setTableWidth("100%");
1622 $formchange->setId("suggestedsolution");
1623
1624 $solutiontype = new ilRadioGroupInputGUI($this->lng->txt("suggestedSolutionType"), "solutiontype");
1625 foreach ($options as $opt_value => $opt_caption) {
1626 $solutiontype->addOption(new ilRadioOption($opt_caption, $opt_value));
1627 }
1628 if (count($solution_array)) {
1629 $solutiontype->setValue($solution_array["type"]);
1630 }
1631 $solutiontype->setRequired(true);
1632 $formchange->addItem($solutiontype);
1633
1634 $formchange->addCommandButton("saveSuggestedSolution", $this->lng->txt("select"));
1635
1636 if ($savechange) {
1637 $formchange->checkInput();
1638 }
1639 $changeoutput = $formchange->getHTML();
1640 }
1641
1642 $this->tpl->setVariable("ADM_CONTENT", $changeoutput . $output);
1643 }
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($return_to="", $return_to_feedback='')
setRenderPurpose($renderPurpose)
static _getInternalLinkHref($target="")
This class represents a checkbox property in a property form.
This class represents a file property in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a custom property in a property form.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
foreach($_POST as $key=> $value) $res

References $_GET, $_POST, $DIC, $ilUser, $res, assQuestion\_getInternalLinkHref(), assQuestion\_isWriteable(), getRenderPurpose(), getSolutionOutput(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), originalSyncForm(), ilUtil\prepareFormOutput(), ilUtil\renameExecutables(), ilUtil\sendInfo(), and setRenderPurpose().

Referenced by saveSuggestedSolution(), and showSuggestedSolution().

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

◆ supportsIntermediateSolutionOutput()

assQuestionGUI::supportsIntermediateSolutionOutput ( )

Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution()

Returns
bool

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

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

2089 {
2090 return false;
2091 }

◆ sync()

assQuestionGUI::sync ( )

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

756 {
757 $original_id = $this->object->original_id;
758 if ($original_id) {
759 $this->object->syncWithOriginal();
760 }
761 if (strlen($_GET["return_to"])) {
762 $this->ctrl->redirect($this, $_GET["return_to"]);
763 }
764 if (strlen($_REQUEST["return_to_fb"])) {
765 $this->ctrl->redirectByClass('ilAssQuestionFeedbackEditingGUI', 'showFeedbackForm');
766 } else {
767 if (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) {
768 $ref_id = (int) $_GET['calling_consumer'];
769 $consumer = ilObjectFactory::getInstanceByRefId($ref_id);
770 if ($consumer instanceof ilQuestionEditingFormConsumer) {
771 ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET['consumer_context']));
772 }
773 require_once 'Services/Link/classes/class.ilLink.php';
775 }
776 $_GET["ref_id"] = $_GET["calling_test"];
777
778 if ($_REQUEST['test_express_mode']) {
780 } else {
781 $this->ctrl->redirectByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW);
782 }
783 }
784 }

References $_GET, ilLink\_getLink(), ilAssQuestionPreviewGUI\CMD_SHOW, ilObjectFactory\getInstanceByRefId(), ilTestExpressPage\getReturnToPageLink(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ writePostData()

assQuestionGUI::writePostData (   $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, assFlashQuestionGUI, assFormulaQuestionGUI, assImagemapQuestionGUI, assJavaAppletGUI, assLongMenuGUI, assMatchingQuestionGUI, assMultipleChoiceGUI, assNumericGUI, assOrderingHorizontalGUI, assSingleChoiceGUI, assTextQuestionGUI, assTextSubsetGUI, assOrderingQuestionGUI, and assKprimChoiceGUI.

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

477 {
478 }

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

+ Here is the caller graph for this function:

◆ writeQuestionGenericPostData()

assQuestionGUI::writeQuestionGenericPostData ( )
protected

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

2137 {
2138 $this->object->setTitle($_POST["title"]);
2139 $this->object->setAuthor($_POST["author"]);
2140 $this->object->setComment($_POST["comment"]);
2141 if ($this->object->getSelfAssessmentEditingMode()) {
2142 $this->object->setNrOfTries($_POST['nr_of_tries']);
2143 }
2144
2145 try {
2146 $lifecycle = ilAssQuestionLifecycle::getInstance($_POST['lifecycle']);
2147 $this->object->setLifecycle($lifecycle);
2149 }
2150
2151 $this->object->setQuestion(ilUtil::stripOnlySlashes($_POST['question'])); // ?
2152 $this->object->setEstimatedWorkingTime(
2153 $_POST["Estimated"]["hh"],
2154 $_POST["Estimated"]["mm"],
2155 $_POST["Estimated"]["ss"]
2156 );
2157 }
static stripOnlySlashes($a_str)
strip slashes if magic qoutes is enabled

References $_POST, Vendor\Package\$e, ilAssQuestionLifecycle\getInstance(), and ilUtil\stripOnlySlashes().

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

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

Field Documentation

◆ $ctrl

assQuestionGUI::$ctrl
protected

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

◆ $editContext

assQuestionGUI::$editContext = self::EDIT_CONTEXT_AUTHORING
private

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

Referenced by getEditContext(), and setEditContext().

◆ $editForm

assQuestionGUI::$editForm
protected

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

Referenced by buildEditForm().

◆ $error

assQuestionGUI::$error

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

◆ $errormessage

assQuestionGUI::$errormessage

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

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

◆ $lng

assQuestionGUI::$lng

◆ $navigationGUI

assQuestionGUI::$navigationGUI
private

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

Referenced by getNavigationGUI(), and setNavigationGUI().

◆ $object

assQuestionGUI::$object

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

Referenced by callNewIdListeners().

◆ $presentationContext

assQuestionGUI::$presentationContext = null
private

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

Referenced by getPresentationContext(), and setPresentationContext().

◆ $previewSession

assQuestionGUI::$previewSession
private

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

Referenced by getPreviewSession(), and setPreviewSession().

◆ $previousSolutionPrefilled

assQuestionGUI::$previousSolutionPrefilled = false
private

◆ $question_count

assQuestionGUI::$question_count

question count in test

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

Referenced by getQuestionCount().

◆ $questionActionCmd

assQuestionGUI::$questionActionCmd = 'handleQuestionAction'
private

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

Referenced by getQuestionActionCmd(), and setQuestionActionCmd().

◆ $questionHeaderBlockBuilder

assQuestionGUI::$questionHeaderBlockBuilder
private

◆ $renderPurpose

assQuestionGUI::$renderPurpose = self::RENDER_PURPOSE_PLAYBACK
private

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

Referenced by getRenderPurpose(), and setRenderPurpose().

◆ $request

assQuestionGUI::$request

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

◆ $sequence_no

assQuestionGUI::$sequence_no

sequence number in test

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

Referenced by getSequenceNumber().

◆ $targetGuiClass

assQuestionGUI::$targetGuiClass = null
private

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

Referenced by getTargetGuiClass(), and setTargetGuiClass().

◆ $taxonomyIds

assQuestionGUI::$taxonomyIds = array()
private

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

Referenced by getTaxonomyIds(), and setTaxonomyIds().

◆ $tpl

◆ $use_intermediate_solution

assQuestionGUI::$use_intermediate_solution = false
protected

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

Referenced by getUseIntermediateSolution().

◆ EDIT_CONTEXT_ADJUSTMENT

const assQuestionGUI::EDIT_CONTEXT_ADJUSTMENT = 'adjustment'

Definition at line 100 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 29 of file class.assQuestionGUI.php.

Referenced by assFileUploadGUI\getFormEncodingType().

◆ FORM_ENCODING_URLENCODE

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

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

Referenced by getFormEncodingType().

◆ FORM_MODE_ADJUST

const assQuestionGUI::FORM_MODE_ADJUST = 'adjust'

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

◆ FORM_MODE_EDIT

const assQuestionGUI::FORM_MODE_EDIT = 'edit'

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

◆ HAS_SPECIAL_QUESTION_COMMANDS

const assQuestionGUI::HAS_SPECIAL_QUESTION_COMMANDS = false
protected

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

◆ PRESENTATION_CONTEXT_RESULTS

const assQuestionGUI::PRESENTATION_CONTEXT_RESULTS = 'pContextResults'

Definition at line 81 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 92 of file class.assQuestionGUI.php.

Referenced by isRenderPurposeInputValue().

◆ RENDER_PURPOSE_PLAYBACK

const assQuestionGUI::RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'

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

Referenced by isRenderPurposePlayback().

◆ RENDER_PURPOSE_PREVIEW

◆ RENDER_PURPOSE_PRINT_PDF

◆ SESSION_PREVIEW_DATA_BASE_INDEX

const assQuestionGUI::SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'

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


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