ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() 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 ($userSolution)
 
 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)
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 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="", $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)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
- Public Member Functions inherited from ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 

Protected Member Functions

 writePostData ($always=false)
 {} 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
 
 $use_intermediate_solution = false
 

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$

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.

References $id.

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  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Class for TextSubset questions.

Member Function Documentation

◆ addanswers()

assTextSubsetGUI::addanswers ( )

Add a new answer.

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

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

106  {
107  $this->writePostData(true);
108  $position = key($_POST['cmd']['addanswers']);
109  $this->object->addAnswer("", 0, $position + 1);
110  $this->editQuestion();
111  }
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
writePostData($always=false)
{}
$_POST["username"]
+ Here is the call graph for this function:

◆ aggregateAnswers()

assTextSubsetGUI::aggregateAnswers (   $relevant_answers_chosen)

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

Referenced by getAggregatedAnswersView().

519  {
520  $aggregate = array();
521 
522  foreach ($relevant_answers_chosen as $relevant_answer) {
523  if (array_key_exists($relevant_answer['value1'], $aggregate)) {
524  $aggregate[$relevant_answer['value1']]++;
525  } else {
526  $aggregate[$relevant_answer['value1']] = 1;
527  }
528  }
529  return $aggregate;
530  }
+ 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.

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

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

64  {
65  $save = $this->isSaveCommand();
66  $this->getQuestionTemplate();
67 
68  require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
69  $form = new ilPropertyFormGUI();
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  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
getQuestionTemplate()
get question template
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
if(isset($_POST['submit'])) $form
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
$errors
Definition: index.php:6
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
+ 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 484 of file class.assTextSubsetGUI.php.

485  {
486  return array();
487  }

◆ 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 498 of file class.assTextSubsetGUI.php.

499  {
500  return array();
501  }

◆ 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 511 of file class.assTextSubsetGUI.php.

References aggregateAnswers(), and renderAggregateView().

512  {
513  return $this->renderAggregateView(
514  $this->aggregateAnswers($relevant_answers)
515  )->get();
516  }
aggregateAnswers($relevant_answers_chosen)
+ Here is the call graph for this function:

◆ getAnswersFrequency()

assTextSubsetGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

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

551  {
552  $answers = array();
553 
554  foreach ($relevantAnswers as $ans) {
555  if (!isset($answers[$ans['value1']])) {
556  $answers[$ans['value1']] = array(
557  'answer' => $ans['value1'], 'frequency' => 0
558  );
559  }
560 
561  $answers[$ans['value1']]['frequency']++;
562  }
563 
564  return $answers;
565  }

◆ getPreview()

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

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

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

245  {
246  $solutions = is_object($this->getPreviewSession()) ? (array) $this->getPreviewSession()->getParticipantsSolution() : array();
247  // generate the question output
248  include_once "./Services/UICore/classes/class.ilTemplate.php";
249  $template = new ilTemplate("tpl.il_as_qpl_textsubset_output.html", true, true, "Modules/TestQuestionPool");
250  $width = $this->object->getMaxTextboxWidth();
251  for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++) {
252  $template->setCurrentBlock("textsubset_row");
253  foreach ($solutions as $idx => $solution_value) {
254  if ($idx == $i) {
255  $template->setVariable("TEXTFIELD_VALUE", " value=\"" . $solution_value . "\"");
256  }
257  }
258  $template->setVariable("COUNTER", $i + 1);
259  $template->setVariable("TEXTFIELD_ID", sprintf("%02d", $i + 1));
260  $template->setVariable("TEXTFIELD_SIZE", $width);
261  $template->parseCurrentBlock();
262  }
263  $questiontext = $this->object->getQuestion();
264  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
265  $questionoutput = $template->get();
266  if (!$show_question_only) {
267  // get page object output
268  $questionoutput = $this->getILIASPage($questionoutput);
269  }
270  return $questionoutput;
271  }
$template
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
$i
Definition: disco.tpl.php:19
+ 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

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

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

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

◆ getSpecificFeedbackOutput()

assTextSubsetGUI::getSpecificFeedbackOutput (   $userSolution)

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

References Sabre\VObject\$output.

394  {
395  $output = "";
396  return $this->object->prepareTextareaOutput($output, true);
397  }

◆ getTestOutput()

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

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

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

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

◆ populateAnswerSpecificFormPart()

assTextSubsetGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

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

References $form, ilPropertyFormGUI\addItem(), and ilFormPropertyGUI\setRequired().

Referenced by editQuestion().

457  {
458  // Choices
459  include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
460  $choices = new ilAnswerWizardInputGUI($this->lng->txt("answers"), "answers");
461  $choices->setRequired(true);
462  $choices->setQuestionObject($this->object);
463  $choices->setSingleline(true);
464  $choices->setAllowMove(false);
465  $choices->setMinValue(0.0);
466  if ($this->object->getAnswerCount() == 0) {
467  $this->object->addAnswer("", 0, 0);
468  }
469  $choices->setValues($this->object->getAnswers());
470  $form->addItem($choices);
471  return $form;
472  }
This class represents a single choice wizard property in a property form.
if(isset($_POST['submit'])) $form
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

assTextSubsetGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

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

References $form, ilPropertyFormGUI\addItem(), and ilFormPropertyGUI\setRequired().

568  {
569  // Choices
570  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssAnswerCorrectionsInputGUI.php';
571  $choices = new ilAssAnswerCorrectionsInputGUI($this->lng->txt("answers"), "answers");
572  $choices->setRequired(true);
573  $choices->setQuestionObject($this->object);
574  $choices->setValues($this->object->getAnswers());
575  $form->addItem($choices);
576 
577  return $form;
578  }
addItem($a_item)
Add Item (Property, SectionHeader).
if(isset($_POST['submit'])) $form
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assTextSubsetGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

References $form, ilPropertyFormGUI\addItem(), ilNumberInputGUI\setMinValue(), and ilSelectInputGUI\setOptions().

Referenced by editQuestion().

416  {
417  // number of requested answers
418  $correctanswers = new ilNumberInputGUI($this->lng->txt("nr_of_correct_answers"), "correctanswers");
419  $correctanswers->setMinValue(1);
420  $correctanswers->setDecimals(0);
421  $correctanswers->setSize(3);
422  $correctanswers->setValue($this->object->getCorrectAnswers());
423  $correctanswers->setRequired(true);
424  $form->addItem($correctanswers);
425 
426  // maximum available points
427  $points = new ilNumberInputGUI($this->lng->txt("maximum_points"), "points");
428  $points->setMinValue(0.0);
429  $points->setMinvalueShouldBeGreater(true);
430  $points->setSize(6);
431  $points->setDisabled(true);
432  $points->allowDecimals(true);
433  $points->setValue($this->object->getMaximumPoints());
434  $points->setRequired(false);
435  $form->addItem($points);
436 
437  // text rating
438  $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
439  $text_options = array(
440  "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
441  "cs" => $this->lng->txt("cloze_textgap_case_sensitive")
442  );
443  if (!$this->object->getSelfAssessmentEditingMode()) {
444  $text_options["l1"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1");
445  $text_options["l2"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2");
446  $text_options["l3"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3");
447  $text_options["l4"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4");
448  $text_options["l5"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5");
449  }
450  $textrating->setOptions($text_options);
451  $textrating->setValue($this->object->getTextRating());
452  $form->addItem($textrating);
453  return $form;
454  }
This class represents a selection list property in a property form.
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
if(isset($_POST['submit'])) $form
This class represents a number property in a property form.
setOptions($a_options)
Set Options.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeanswers()

assTextSubsetGUI::removeanswers ( )

Remove an answer.

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

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

117  {
118  $this->writePostData(true);
119  $position = key($_POST['cmd']['removeanswers']);
120  $this->object->deleteAnswer($position);
121  $this->editQuestion();
122  }
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
writePostData($always=false)
{}
$_POST["username"]
+ Here is the call graph for this function:

◆ renderAggregateView()

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

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

References $key, and assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

538  {
539  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
540 
541  foreach ($aggregate as $key => $value) {
542  $tpl->setCurrentBlock('aggregaterow');
543  $tpl->setVariable('OPTION', $key);
544  $tpl->setVariable('COUNT', $value);
545  $tpl->parseCurrentBlock();
546  }
547  return $tpl;
548  }
special template class to simplify handling of ITX/PEAR
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

assTextSubsetGUI::saveCorrectionsFormProperties ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

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

References $index, and ilPropertyFormGUI\getInput().

584  {
585  $points = $form->getInput('answers')['points'];
586 
587  foreach ($this->object->getAnswers() as $index => $answer) {
588  /* @var ASS_AnswerBinaryStateImage $answer */
589  $answer->setPoints((float) $points[$index]);
590  }
591  }
$index
Definition: metadata.php:60
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ setQuestionTabs()

assTextSubsetGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

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

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

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

◆ supportsIntermediateSolutionOutput()

assTextSubsetGUI::supportsIntermediateSolutionOutput ( )

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

Returns
bool

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

130  {
131  return true;
132  }

◆ 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 405 of file class.assTextSubsetGUI.php.

References $_POST, and $index.

Referenced by writePostData().

406  {
407  // Delete all existing answers and create new answers from the form data
408  $this->object->flushAnswers();
409  foreach ($_POST['answers']['answer'] as $index => $answer) {
410  $answertext = $answer;
411  $this->object->addAnswer($answertext, $_POST['answers']['points'][$index], $index);
412  }
413  }
$index
Definition: metadata.php:60
$_POST["username"]
+ Here is the caller graph for this function:

◆ writePostData()

assTextSubsetGUI::writePostData (   $always = false)
protected

{}

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

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

Referenced by addanswers(), and removeanswers().

47  {
48  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
49  if (!$hasErrors) {
50  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
54  $this->saveTaxonomyAssignments();
55  return 0;
56  }
57  return 1;
58  }
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
This class represents a property form user interface.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
+ 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 399 of file class.assTextSubsetGUI.php.

References $_POST.

Referenced by writePostData().

400  {
401  $this->object->setCorrectAnswers($_POST["correctanswers"]);
402  $this->object->setTextRating($_POST["text_rating"]);
403  }
$_POST["username"]
+ Here is the caller graph for this function:

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