ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
assTextSubsetGUI Class Reference

Multiple choice question GUI representation. More...

+ Inheritance diagram for assTextSubsetGUI:
+ Collaboration diagram for assTextSubsetGUI:

Public Member Functions

 __construct ($id=-1)
 assTextSubsetGUI constructor More...
 
 editQuestion ($checkonly=false)
 Creates an output of the edit form for the question. More...
 
 addanswers ()
 Add a new answer. More...
 
 removeanswers ()
 Remove an answer. More...
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 Get the question solution output. More...
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getTestOutput ($active_id, $pass=null, $is_postponed=false, $use_post_solutions=false, $inlineFeedback=false)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 populateAnswerSpecificFormPart (\ilPropertyFormGUI $form)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 aggregateAnswers ($relevant_answers_chosen)
 
 renderAggregateView ($aggregate)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 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 (ilTemplate $tpl)
 
 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="")
 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 ($active_id, $pass)
 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)
 
 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 ()
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
- Public Member Functions inherited from ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 

Protected Member Functions

 writePostData ($always=false)
 {Evaluates a posted edit form and writes the form data in the question object.
Returns
integer A positive value, if one of the required fields wasn't set, else 0
} More...
 
- Protected Member Functions inherited from assQuestionGUI
 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)
 
 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_QuestionPreview (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
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 inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $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 Attributes inherited from assQuestionGUI
 $editForm
 

Detailed Description

Multiple choice question GUI representation.

The assTextSubsetGUI class encapsulates the GUI representation for multiple choice questions.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

@ilCtrl_Calls assTextSubsetGUI: ilFormPropertyDispatchGUI

Definition at line 24 of file class.assTextSubsetGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assTextSubsetGUI::__construct (   $id = -1)

assTextSubsetGUI constructor

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

Parameters
integer$idThe database id of a text subset question object

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

34 {
35 parent::__construct();
36 require_once './Modules/TestQuestionPool/classes/class.assTextSubset.php';
37 $this->object = new assTextSubset();
38 if ($id >= 0) {
39 $this->object->loadFromDb($id);
40 }
41 }
Class for TextSubset questions.
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id.

Member Function Documentation

◆ addanswers()

assTextSubsetGUI::addanswers ( )

Add a new answer.

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

106 {
107 $this->writePostData(true);
108 $position = key($_POST['cmd']['addanswers']);
109 $this->object->addAnswer("", 0, $position+1);
110 $this->editQuestion();
111 }
$_POST["username"]
writePostData($always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
editQuestion($checkonly=false)
Creates an output of the edit form for the question.

References $_POST, editQuestion(), and writePostData().

+ Here is the call graph for this function:

◆ aggregateAnswers()

assTextSubsetGUI::aggregateAnswers (   $relevant_answers_chosen)

Definition at line 506 of file class.assTextSubsetGUI.php.

507 {
508 $aggregate = array();
509
510 foreach ($relevant_answers_chosen as $relevant_answer) {
511 if (array_key_exists($relevant_answer['value1'], $aggregate)) {
512 $aggregate[$relevant_answer['value1']]++;
513 } else {
514 $aggregate[$relevant_answer['value1']] = 1;
515 }
516 }
517 return $aggregate;
518 }

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ editQuestion()

assTextSubsetGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

Definition at line 63 of file class.assTextSubsetGUI.php.

64 {
65 $save = $this->isSaveCommand();
66 $this->getQuestionTemplate();
67
68 require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
70 $this->editForm = $form;
71
72 $form->setFormAction($this->ctrl->getFormAction($this));
73 $form->setTitle($this->outQuestionType());
74 $form->setMultipart(false);
75 $form->setTableWidth("100%");
76 $form->setId("asstextsubset");
77
83
84 $errors = false;
85 if ($save) {
86 $form->setValuesByPost();
87 $points = $form->getItemByPostVar('points');
88 $points->setValue($this->object->getMaximumPoints());
89 $errors = !$form->checkInput();
90 $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
91 if ($errors) {
92 $checkonly = false;
93 }
94 }
95
96 if (!$checkonly) {
97 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
98 }
99 return $errors;
100 }
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getQuestionTemplate()
get question template
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
This class represents a property form user interface.
$errors
Definition: index.php:6
if(isset($_POST['submit'])) $form

References $errors, $form, assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), assQuestionGUI\getQuestionTemplate(), assQuestionGUI\isSaveCommand(), assQuestionGUI\outQuestionType(), populateAnswerSpecificFormPart(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by addanswers(), removeanswers(), and writePostData().

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

◆ getAfterParticipationSuppressionAnswerPostVars()

assTextSubsetGUI::getAfterParticipationSuppressionAnswerPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiAnswerScoringAdjustable.

Definition at line 472 of file class.assTextSubsetGUI.php.

473 {
474 return array();
475 }

◆ getAfterParticipationSuppressionQuestionPostVars()

assTextSubsetGUI::getAfterParticipationSuppressionQuestionPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiQuestionScoringAdjustable.

Definition at line 486 of file class.assTextSubsetGUI.php.

487 {
488 return array();
489 }

◆ getAggregatedAnswersView()

assTextSubsetGUI::getAggregatedAnswersView (   $relevant_answers)

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

Parameters
array$relevant_answers
Returns
string

Implements ilGuiQuestionScoringAdjustable.

Definition at line 499 of file class.assTextSubsetGUI.php.

500 {
501 return $this->renderAggregateView(
502 $this->aggregateAnswers($relevant_answers)
503 )->get();
504 }
aggregateAnswers($relevant_answers_chosen)

References aggregateAnswers(), and renderAggregateView().

+ Here is the call graph for this function:

◆ getPreview()

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

Reimplemented from assQuestionGUI.

Definition at line 234 of file class.assTextSubsetGUI.php.

235 {
236 $solutions = is_object($this->getPreviewSession()) ? (array) $this->getPreviewSession()->getParticipantsSolution() : array();
237 // generate the question output
238 include_once "./Services/UICore/classes/class.ilTemplate.php";
239 $template = new ilTemplate("tpl.il_as_qpl_textsubset_output.html", true, true, "Modules/TestQuestionPool");
240 $width = $this->object->getMaxTextboxWidth();
241 for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++) {
242 $template->setCurrentBlock("textsubset_row");
243 foreach ($solutions as $idx => $solution_value) {
244 if ($idx == $i) {
245 $template->setVariable("TEXTFIELD_VALUE", " value=\"" . $solution_value . "\"");
246 }
247 }
248 $template->setVariable("COUNTER", $i+1);
249 $template->setVariable("TEXTFIELD_ID", sprintf("%02d", $i+1));
250 $template->setVariable("TEXTFIELD_SIZE", $width);
251 $template->parseCurrentBlock();
252 }
253 $questiontext = $this->object->getQuestion();
254 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
255 $questionoutput = $template->get();
256 if (!$show_question_only) {
257 // get page object output
258 $questionoutput = $this->getILIASPage($questionoutput);
259 }
260 return $questionoutput;
261 }
sprintf('%.4f', $callTime)
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
$template
$i
Definition: disco.tpl.php:19

References $i, $template, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), and sprintf.

+ Here is the call graph for this function:

◆ getSolutionOutput()

assTextSubsetGUI::getSolutionOutput (   $active_id,
  $pass = null,
  $graphicalOutput = false,
  $result_output = false,
  $show_question_only = true,
  $show_feedback = false,
  $show_correct_solution = false,
  $show_manual_scoring = false,
  $show_question_text = true 
)

Get the question solution output.

Parameters
integer$active_idThe active user id
integer$passThe test pass
boolean$graphicalOutputShow visual feedback for right/wrong answers
boolean$result_outputShow the reached points for parts of the question
boolean$show_question_onlyShow the question without the ILIAS content around
boolean$show_feedbackShow the question feedback
boolean$show_correct_solutionShow the correct solution instead of the user solution
boolean$show_manual_scoringShow specific information for the manual scoring output
Returns
The solution output of the question as HTML code

Reimplemented from assQuestionGUI.

Definition at line 137 of file class.assTextSubsetGUI.php.

147 {
148 // get the solution of the user for the active pass or from the last pass if allowed
149 $solutions = array();
150 if (($active_id > 0) && (!$show_correct_solution)) {
151 $solutions =&$this->object->getSolutionValues($active_id, $pass);
152 } else {
153 $rank = array();
154 foreach ($this->object->answers as $answer) {
155 if ($answer->getPoints() > 0) {
156 if (!is_array($rank[$answer->getPoints()])) {
157 $rank[$answer->getPoints()] = array();
158 }
159 array_push($rank[$answer->getPoints()], $answer->getAnswertext());
160 }
161 }
162 krsort($rank, SORT_NUMERIC);
163 foreach ($rank as $index => $bestsolutions) {
164 array_push($solutions, array("value1" => join(",", $bestsolutions), "points" => $index));
165 }
166 }
167
168 // generate the question output
169 include_once "./Services/UICore/classes/class.ilTemplate.php";
170 $template = new ilTemplate("tpl.il_as_qpl_textsubset_output_solution.html", true, true, "Modules/TestQuestionPool");
171 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
172 $available_answers =&$this->object->getAvailableAnswers();
173 for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++) {
174 if ((!$test_id) && (strcmp($solutions[$i]["value1"], "") == 0)) {
175 } else {
176 if (($active_id > 0) && (!$show_correct_solution)) {
177 if ($graphicalOutput) {
178 // output of ok/not ok icons for user entered solutions
179 $index = $this->object->isAnswerCorrect($available_answers, $solutions[$i]["value1"]);
180 $correct = false;
181 if ($index !== false) {
182 unset($available_answers[$index]);
183 $correct = true;
184 }
185 if ($correct) {
186 $template->setCurrentBlock("icon_ok");
187 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
188 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
189 $template->parseCurrentBlock();
190 } else {
191 $template->setCurrentBlock("icon_ok");
192 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
193 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
194 $template->parseCurrentBlock();
195 }
196 }
197 }
198 $template->setCurrentBlock("textsubset_row");
199 $template->setVariable("SOLUTION", $solutions[$i]["value1"]);
200 $template->setVariable("COUNTER", $i+1);
201 if ($result_output) {
202 $points = $solutions[$i]["points"];
203 $resulttext = ($points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
204 $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $points));
205 }
206 $template->parseCurrentBlock();
207 }
208 }
209 $questiontext = $this->object->getQuestion();
210 if ($show_question_text==true) {
211 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
212 }
213 $questionoutput = $template->get();
214 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
215 if (strlen($feedback)) {
216 $cssClass = (
217 $this->hasCorrectSolution($active_id, $pass) ?
219 );
220
221 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
222 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
223 }
224 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
225
226 $solutionoutput = $solutiontemplate->get();
227 if (!$show_question_only) {
228 // get page object output
229 $solutionoutput = $this->getILIASPage($solutionoutput);
230 }
231 return $solutionoutput;
232 }
hasCorrectSolution($activeId, $passIndex)
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$index
Definition: metadata.php:60

References $i, $index, $pass, $template, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getAnswerFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), and sprintf.

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assTextSubsetGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

382 {
383 $output = "";
384 return $this->object->prepareTextareaOutput($output, true);
385 }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output

References $output.

◆ getTestOutput()

assTextSubsetGUI::getTestOutput (   $active_id,
  $pass = null,
  $is_postponed = false,
  $use_post_solutions = false,
  $inlineFeedback = false 
)

Reimplemented from assQuestionGUI.

Definition at line 263 of file class.assTextSubsetGUI.php.

264 {
265 // get the solution of the user for the active pass or from the last pass if allowed
266 $user_solution = "";
267 if ($active_id) {
268 $solutions = null;
269 // hey: prevPassSolutions - obsolete due to central check
270 #include_once "./Modules/Test/classes/class.ilObjTest.php";
271 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
272 #{
273 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
274 #}
275 // hey.
276 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
277 }
278
279 // generate the question output
280 include_once "./Services/UICore/classes/class.ilTemplate.php";
281 $template = new ilTemplate("tpl.il_as_qpl_textsubset_output.html", true, true, "Modules/TestQuestionPool");
282 $width = $this->object->getMaxTextboxWidth();
283 for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++) {
284 $template->setCurrentBlock("textsubset_row");
285 foreach ($solutions as $idx => $solution_value) {
286 if ($idx == $i) {
287 $template->setVariable("TEXTFIELD_VALUE", " value=\"" . ilUtil::prepareFormOutput($solution_value["value1"]) . "\"");
288 }
289 }
290 $template->setVariable("COUNTER", $i+1);
291 $template->setVariable("TEXTFIELD_ID", sprintf("%02d", $i+1));
292 $template->setVariable("TEXTFIELD_SIZE", $width);
293 $template->parseCurrentBlock();
294 }
295 $questiontext = $this->object->getQuestion();
296 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
297 $questionoutput = $template->get();
298 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
299 return $pageoutput;
300 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $i, $pass, $template, assQuestionGUI\outQuestionPage(), ilUtil\prepareFormOutput(), and sprintf.

+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assTextSubsetGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 444 of file class.assTextSubsetGUI.php.

445 {
446 // Choices
447 include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
448 $choices = new ilAnswerWizardInputGUI($this->lng->txt("answers"), "answers");
449 $choices->setRequired(true);
450 $choices->setQuestionObject($this->object);
451 $choices->setSingleline(true);
452 $choices->setAllowMove(false);
453 $choices->setMinValue(0.0);
454 if ($this->object->getAnswerCount() == 0) {
455 $this->object->addAnswer("", 0, 0);
456 }
457 $choices->setValues($this->object->getAnswers());
458 $form->addItem($choices);
459 return $form;
460 }
This class represents a single choice wizard property in a property form.

References $form.

Referenced by editQuestion().

+ Here is the caller graph for this function:

◆ populateQuestionSpecificFormPart()

assTextSubsetGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

404 {
405 // number of requested answers
406 $correctanswers = new ilNumberInputGUI($this->lng->txt("nr_of_correct_answers"), "correctanswers");
407 $correctanswers->setMinValue(1);
408 $correctanswers->setDecimals(0);
409 $correctanswers->setSize(3);
410 $correctanswers->setValue($this->object->getCorrectAnswers());
411 $correctanswers->setRequired(true);
412 $form->addItem($correctanswers);
413
414 // maximum available points
415 $points = new ilNumberInputGUI($this->lng->txt("maximum_points"), "points");
416 $points->setMinValue(0.0);
417 $points->setMinvalueShouldBeGreater(true);
418 $points->setSize(6);
419 $points->setDisabled(true);
420 $points->allowDecimals(true);
421 $points->setValue($this->object->getMaximumPoints());
422 $points->setRequired(false);
423 $form->addItem($points);
424
425 // text rating
426 $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
427 $text_options = array(
428 "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
429 "cs" => $this->lng->txt("cloze_textgap_case_sensitive")
430 );
431 if (!$this->object->getSelfAssessmentEditingMode()) {
432 $text_options["l1"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1");
433 $text_options["l2"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2");
434 $text_options["l3"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3");
435 $text_options["l4"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4");
436 $text_options["l5"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5");
437 }
438 $textrating->setOptions($text_options);
439 $textrating->setValue($this->object->getTextRating());
440 $form->addItem($textrating);
441 return $form;
442 }
This class represents a number property in a property form.
This class represents a selection list property in a property form.

References $form, and sprintf.

Referenced by editQuestion().

+ Here is the caller graph for this function:

◆ removeanswers()

assTextSubsetGUI::removeanswers ( )

Remove an answer.

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

117 {
118 $this->writePostData(true);
119 $position = key($_POST['cmd']['removeanswers']);
120 $this->object->deleteAnswer($position);
121 $this->editQuestion();
122 }

References $_POST, editQuestion(), and writePostData().

+ Here is the call graph for this function:

◆ renderAggregateView()

assTextSubsetGUI::renderAggregateView (   $aggregate)
Parameters
$aggregate
Returns
ilTemplate

Definition at line 525 of file class.assTextSubsetGUI.php.

526 {
527 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
528
529 foreach ($aggregate as $key => $value) {
530 $tpl->setCurrentBlock('aggregaterow');
531 $tpl->setVariable('OPTION', $key);
532 $tpl->setVariable('COUNT', $value);
533 $tpl->parseCurrentBlock();
534 }
535 return $tpl;
536 }
$key
Definition: croninfo.php:18

References $key, and assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ setQuestionTabs()

assTextSubsetGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

@access public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Reimplemented from assQuestionGUI.

Definition at line 309 of file class.assTextSubsetGUI.php.

310 {
311 global $rbacsystem, $ilTabs;
312
313 $ilTabs->clearTargets();
314
315 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
316 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
317 $q_type = $this->object->getQuestionType();
318
319 if (strlen($q_type)) {
320 $classname = $q_type . "GUI";
321 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
322 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
323 }
324
325 if ($_GET["q_id"]) {
326 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
327 // edit page
328 $ilTabs->addTarget(
329 "edit_page",
330 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
331 array("edit", "insert", "exec_pg"),
332 "",
333 "",
334 $force_active
335 );
336 }
337
338 $this->addTab_QuestionPreview($ilTabs);
339 }
340
341 $force_active = false;
342 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
343 $url = "";
344 if ($classname) {
345 $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
346 }
347 // edit question properties
348 $ilTabs->addTarget(
349 "edit_question",
350 $url,
351 array("editQuestion", "save", "saveEdit", "addanswers", "removeanswers", "originalSyncForm"),
352 $classname,
353 "",
354 $force_active
355 );
356 }
357
358 // add tab for question feedback within common class assQuestionGUI
359 $this->addTab_QuestionFeedback($ilTabs);
360
361 // add tab for question hint within common class assQuestionGUI
362 $this->addTab_QuestionHints($ilTabs);
363
364 // add tab for question's suggested solution within common class assQuestionGUI
365 $this->addTab_SuggestedSolution($ilTabs, $classname);
366
367 // Assessment of questions sub menu entry
368 if ($_GET["q_id"]) {
369 $ilTabs->addTarget(
370 "statistics",
371 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
372 array("assessment"),
373 $classname,
374 ""
375 );
376 }
377
378 $this->addBackTab($ilTabs);
379 }
$_GET["client_id"]
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addBackTab(ilTabsGUI $ilTabs)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
$url

References $_GET, $url, assQuestionGUI\addBackTab(), assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), assQuestionGUI\addTab_QuestionPreview(), and assQuestionGUI\addTab_SuggestedSolution().

+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

assTextSubsetGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

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

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiAnswerScoringAdjustable.

Definition at line 393 of file class.assTextSubsetGUI.php.

394 {
395 // Delete all existing answers and create new answers from the form data
396 $this->object->flushAnswers();
397 foreach ($_POST['answers']['answer'] as $index => $answer) {
398 $answertext = $answer;
399 $this->object->addAnswer($answertext, $_POST['answers']['points'][$index], $index);
400 }
401 }

References $_POST, and $index.

Referenced by writePostData().

+ Here is the caller graph for this function:

◆ writePostData()

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

Definition at line 46 of file class.assTextSubsetGUI.php.

47 {
48 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
49 if (!$hasErrors) {
50 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
55 return 0;
56 }
57 return 1;
58 }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.

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

Referenced by addanswers(), and removeanswers().

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

◆ writeQuestionSpecificPostData()

assTextSubsetGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiQuestionScoringAdjustable.

Definition at line 387 of file class.assTextSubsetGUI.php.

388 {
389 $this->object->setCorrectAnswers($_POST["correctanswers"]);
390 $this->object->setTextRating($_POST["text_rating"]);
391 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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