ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
assErrorTextGUI Class Reference

The assErrorTextGUI class encapsulates the GUI representation for error text questions. More...

+ Inheritance diagram for assErrorTextGUI:
+ Collaboration diagram for assErrorTextGUI:

Public Member Functions

 __construct ($id=-1)
 assErrorTextGUI constructor More...
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 editQuestion ($checkonly=FALSE)
 Creates an output of the edit form for the question. More...
 
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 
 analyze ()
 Parse the error text. 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, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 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...
 
- 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)
 
 getOutputMode ()
 
 setOutputMode ($outputMode)
 
 isPdfOutputMode ()
 
 isContentEditingOutputMode ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_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...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 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 ()
 
 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...
 
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
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 OUTPUT_MODE_SCREEN = 'outModeScreen'
 
const OUTPUT_MODE_PDF = 'outModePdf'
 
const OUTPUT_MODE_CONTENT_EDITING = 'outModeUsrSol'
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 getPreviousSolutionProvidedMessage ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 isLastSolutionSubmitAuthorized ($active_id, $pass)
 fetches solutions from database and prefers intermediate solutions, but falls back to authorized solutions. More...
 
 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)
 
 getTestOutputSolutions ($activeId, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

Detailed Description

The assErrorTextGUI class encapsulates the GUI representation for error text questions.

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

@ilctrl_iscalledby assErrorTextGUI: ilObjQuestionPoolGUI

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

Constructor & Destructor Documentation

◆ __construct()

assErrorTextGUI::__construct (   $id = -1)

assErrorTextGUI constructor

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

Parameters
integer$idThe database id of a single choice question object @access public

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

35 {
36 parent::__construct();
37 include_once "./Modules/TestQuestionPool/classes/class.assErrorText.php";
38 $this->object = new assErrorText();
39 $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
40 if ($id >= 0)
41 {
42 $this->object->loadFromDb($id);
43 }
44 }
Class for error text questions.
setErrorMessage($errormessage)

References assQuestionGUI\setErrorMessage().

+ Here is the call graph for this function:

Member Function Documentation

◆ analyze()

assErrorTextGUI::analyze ( )

Parse the error text.

Definition at line 208 of file class.assErrorTextGUI.php.

209 {
210 $this->writePostData(true);
211 $this->object->setErrorData($this->object->getErrorsFromText($_POST['errortext']));
212 $this->editQuestion();
213 }
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
writePostData()
Evaluates a posted edit form and writes the form data in the question object.
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ editQuestion()

assErrorTextGUI::editQuestion (   $checkonly = FALSE)

Creates an output of the edit form for the question.

Parameters
bool$checkonly
Returns
bool

Definition at line 107 of file class.assErrorTextGUI.php.

108 {
109 $save = $this->isSaveCommand();
110 $this->getQuestionTemplate();
111
112 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
113 $form = new ilPropertyFormGUI();
114 $form->setFormAction($this->ctrl->getFormAction($this));
115 $form->setTitle($this->outQuestionType());
116 $form->setMultipart(FALSE);
117 $form->setTableWidth("100%");
118 $form->setId("orderinghorizontal");
119
120 $this->addBasicQuestionFormProperties( $form );
121
122 $this->populateQuestionSpecificFormPart( $form );
123
124 if (count($this->object->getErrorData()) || $checkonly)
125 {
126 $this->populateAnswerSpecificFormPart( $form );
127 }
128
129 $this->populateTaxonomyFormSection($form);
130
131 $form->addCommandButton("analyze", $this->lng->txt('analyze_errortext'));
132 $this->addQuestionFormCommandButtons($form);
133
134 $errors = false;
135
136 if ($save)
137 {
138 $form->setValuesByPost();
139 $errors = !$form->checkInput();
140 $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
141 if ($errors) $checkonly = false;
142 }
143
144 if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
145 return $errors;
146 }
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
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,...
This class represents a property form user interface.
$errors

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

Referenced by analyze(), and writePostData().

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

◆ getAfterParticipationSuppressionAnswerPostVars()

assErrorTextGUI::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 536 of file class.assErrorTextGUI.php.

537 {
538 return array();
539 }

◆ getAfterParticipationSuppressionQuestionPostVars()

assErrorTextGUI::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 550 of file class.assErrorTextGUI.php.

551 {
552 return array();
553 }

◆ getAggregatedAnswersView()

assErrorTextGUI::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 563 of file class.assErrorTextGUI.php.

564 {
565 $errortext = $this->object->getErrorText();
566
567 $passdata = array(); // Regroup answers into units of passes.
568 foreach($relevant_answers as $answer_chosen)
569 {
570 $passdata[$answer_chosen['active_fi'].'-'. $answer_chosen['pass']][$answer_chosen['value2']][] = $answer_chosen['value1'];
571 }
572
573 $html = '';
574 foreach($passdata as $key => $pass)
575 {
576 $passdata[$key] = $this->object->createErrorTextOutput($pass);
577 $html .= $passdata[$key] . '<hr /><br />';
578 }
579
580 return $html;
581 }
$html
Definition: example_001.php:87

References $html, and $pass.

◆ getPreview()

assErrorTextGUI::getPreview (   $show_question_only = FALSE,
  $showInlineFeedback = false 
)

Reimplemented from assQuestionGUI.

Definition at line 316 of file class.assErrorTextGUI.php.

317 {
318 $selections = is_object($this->getPreviewSession()) ? (array)$this->getPreviewSession()->getParticipantsSolution() : array();
319
320 $template = new ilTemplate("tpl.il_as_qpl_errortext_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
321 if ($this->object->getTextSize() >= 10) $template->setVariable("STYLE", " style=\"font-size: " . $this->object->getTextSize() . "%;\"");
322 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
323 $errortext = $this->object->createErrorTextOutput($selections);
324 $template->setVariable("ERRORTEXT", $errortext);
325 $template->setVariable("ERRORTEXT_ID", "qst_" . $this->object->getId());
326 $questionoutput = $template->get();
327 if (!$show_question_only)
328 {
329 // get page object output
330 $questionoutput = $this->getILIASPage($questionoutput);
331 }
332 $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/errortext.js");
333 return $questionoutput;
334 }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR

References assQuestionGUI\getILIASPage(), and assQuestionGUI\getPreviewSession().

+ Here is the call graph for this function:

◆ getSolutionOutput()

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

The getSolutionOutput() method is used to print either the user's pass' solution or the best possible solution for the current errorText question object.

Parameters
integer$active_idThe active test id
integer$passThe test pass counter
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
string HTML solution output

Reimplemented from assQuestionGUI.

Definition at line 233 of file class.assErrorTextGUI.php.

243 {
244 // get the solution of the user for the active pass or from the last pass if allowed
245 $template = new ilTemplate("tpl.il_as_qpl_errortext_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
246
247 $selections = array();
248 if (($active_id > 0) && (!$show_correct_solution)) {
249
250 /* Retrieve tst_solutions entries. */
251 $reached_points = $this->object->getReachedPoints($active_id, $pass);
252 $solutions =& $this->object->getSolutionValues($active_id, $pass);
253 if (is_array($solutions)) {
254 foreach ($solutions as $solution) {
255 array_push($selections, (int) $solution['value1']);
256 }
257 $errortext_value = join(",", $selections);
258 }
259 }
260 else {
261 $selections = $this->object->getBestSelection();
262 $reached_points = $this->object->getPoints();
263 }
264
265 if ($result_output) {
266 $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
267 $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
268 }
269
270 if ($this->object->getTextSize() >= 10)
271 $template->setVariable("STYLE", " style=\"font-size: " . $this->object->getTextSize() . "%;\"");
272
273 if ($show_question_text==true)
274 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
275
276 $errortext = $this->object->createErrorTextOutput($selections, $graphicalOutput, $show_correct_solution, false);
277
278 $template->setVariable("ERRORTEXT", $errortext);
279 $questionoutput = $template->get();
280
281 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
282
283 $feedback = '';
284 if($show_feedback)
285 {
286 if( !$this->isTestPresentationContext() )
287 {
288 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
289 $feedback .= strlen($fb) ? $fb : '';
290 }
291
292 $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
293 $feedback .= strlen($fb) ? $fb : '';
294 }
295 if (strlen($feedback))
296 {
297 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
299 );
300
301 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
302 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
303 }
304
305 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
306
307 $solutionoutput = $solutiontemplate->get();
308 if (!$show_question_only)
309 {
310 // get page object output
311 $solutionoutput = $this->getILIASPage($solutionoutput);
312 }
313 return $solutionoutput;
314 }
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
hasCorrectSolution($activeId, $passIndex)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.

References $pass, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), getSpecificFeedbackOutput(), assQuestionGUI\hasCorrectSolution(), and assQuestionGUI\isTestPresentationContext().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assErrorTextGUI::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 461 of file class.assErrorTextGUI.php.

462 {
463 $selection = $this->object->getBestSelection(false);
464
465 if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists(array_keys($selection)) )
466 {
467 return '';
468 }
469
470 $feedback = '<table class="test_specific_feedback"><tbody>';
471
472 $elements = array();
473 foreach(preg_split("/[\n\r]+/", $this->object->errortext) as $line)
474 {
475 $elements = array_merge( $elements, preg_split("/\s+/", $line));
476 }
477
478 $matchedIndexes = array();
479
480 $i = 0;
481 foreach ($selection as $index => $answer)
482 {
483 $element = array();
484 foreach($answer as $answerPartIndex)
485 {
486 $element[] = $elements[$answerPartIndex];
487 }
488
489 $element = implode(' ', $element);
490 $element = str_replace(array('((', '))', '#'), array('', '', ''), $element);
491
492 $ordinal = $index + 1;
493
494 $feedback .= '<tr>';
495
496 $feedback .= '<td class="text-nowrap">' . $ordinal . '. ' . $element . ':</td>';
497
498 foreach ($this->object->getErrorData() as $idx => $ans)
499 {
500 if( isset($matchedIndexes[$idx]) )
501 {
502 continue;
503 }
504
505 if ( preg_match('/'.preg_quote($ans->text_wrong, '/').'/', $element) )
506 {
507 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
508 $this->object->getId(), $idx
509 );
510
511 $feedback .= '<td>'. $fb . '</td>';
512
513 $matchedIndexes[$idx] = $idx;
514
515 break;
516 }
517 }
518
519 $feedback .= '</tr>';
520 }
521
522 $feedback .= '</tbody></table>';
523
524 return $this->object->prepareTextareaOutput($feedback, TRUE);
525 }

Referenced by getSolutionOutput().

+ Here is the caller graph for this function:

◆ getTestOutput()

assErrorTextGUI::getTestOutput (   $active_id,
  $pass,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE,
  $show_feedback = FALSE 
)

Reimplemented from assQuestionGUI.

Definition at line 336 of file class.assErrorTextGUI.php.

345 {
346 // generate the question output
347 $template = new ilTemplate("tpl.il_as_qpl_errortext_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
348 if ($active_id)
349 {
350 // hey: prevPassSolutions - obsolete due to central check
351 #$solutions = NULL;
352 #include_once "./Modules/Test/classes/class.ilObjTest.php";
353 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
354 #{
355 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
356 #}
357 $solutions = $this->getTestOutputSolutions($active_id, $pass);
358 // hey.
359 }
360 $errortext_value = "";
361 $selections = array();
362 if (is_array($solutions))
363 {
364 foreach ($solutions as $solution)
365 {
366 array_push($selections, $solution['value1']);
367 }
368 $errortext_value = join(",", $selections);
369 }
370 if ($this->object->getTextSize() >= 10) $template->setVariable("STYLE", " style=\"font-size: " . $this->object->getTextSize() . "%;\"");
371 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
372 $errortext = $this->object->createErrorTextOutput($selections);
373 $this->ctrl->setParameterByClass($this->getTargetGuiClass(), 'errorvalue', '');
374 $template->setVariable("ERRORTEXT", $errortext);
375 $template->setVariable("ERRORTEXT_ID", "qst_" . $this->object->getId());
376 $template->setVariable("ERRORTEXT_VALUE", $errortext_value);
377
378 $questionoutput = $template->get();
379 if (!$show_question_only)
380 {
381 // get page object output
382 $questionoutput = $this->getILIASPage($questionoutput);
383 }
384 $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/errortext.js");
385 $questionoutput = $template->get();
386 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
387 return $pageoutput;
388 }
getTestOutputSolutions($activeId, $pass)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page

References $pass, assQuestionGUI\getILIASPage(), assQuestionGUI\getTargetGuiClass(), assQuestionGUI\getTestOutputSolutions(), and assQuestionGUI\outQuestionPage().

+ Here is the call graph for this function:

◆ populateAnswerSpecificFormPart()

assErrorTextGUI::populateAnswerSpecificFormPart ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form
Returns
\ilPropertyFormGUI|void

Implements ilGuiAnswerScoringAdjustable.

Definition at line 152 of file class.assErrorTextGUI.php.

153 {
155 $header->setTitle( $this->lng->txt( "errors_section" ) );
156 $form->addItem( $header );
157
158 include_once "./Modules/TestQuestionPool/classes/class.ilErrorTextWizardInputGUI.php";
159 $errordata = new ilErrorTextWizardInputGUI($this->lng->txt( "errors" ), "errordata");
160 $errordata->setKeyName( $this->lng->txt( 'text_wrong' ) );
161 $errordata->setValueName( $this->lng->txt( 'text_correct' ) );
162 $errordata->setValues( $this->object->getErrorData() );
163 $form->addItem( $errordata );
164
165 // points for wrong selection
166 $points_wrong = new ilNumberInputGUI($this->lng->txt( "points_wrong" ), "points_wrong");
167 $points_wrong->allowDecimals(true);
168 $points_wrong->setValue( $this->object->getPointsWrong() );
169 $points_wrong->setInfo( $this->lng->txt( "points_wrong_info" ) );
170 $points_wrong->setSize( 6 );
171 $points_wrong->setRequired( true );
172 $form->addItem( $points_wrong );
173 return $form;
174 }
This class represents a key value pair wizard property in a property form.
This class represents a section header in a property form.
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
$header

References $header, and ilPropertyFormGUI\addItem().

Referenced by editQuestion().

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

◆ populateQuestionSpecificFormPart()

assErrorTextGUI::populateQuestionSpecificFormPart ( ilPropertyFormGUI  $form)
Parameters
$formilPropertyFormGUI
Returns
\ilPropertyFormGUI|void

Implements ilGuiQuestionScoringAdjustable.

Definition at line 180 of file class.assErrorTextGUI.php.

181 {
182 // errortext
183 $errortext = new ilTextAreaInputGUI($this->lng->txt( "errortext" ), "errortext");
184 $errortext->setValue( $this->object->getErrorText() );
185 $errortext->setRequired( TRUE );
186 $errortext->setInfo( $this->lng->txt( "errortext_info" ) );
187 $errortext->setRows( 10 );
188 $errortext->setCols( 80 );
189 $form->addItem( $errortext );
190
191 if (!$this->object->getSelfAssessmentEditingMode())
192 {
193 // textsize
194 $textsize = new ilNumberInputGUI($this->lng->txt( "textsize" ), "textsize");
195 $textsize->setValue( strlen( $this->object->getTextSize() ) ? $this->object->getTextSize() : 100.0 );
196 $textsize->setInfo( $this->lng->txt( "textsize_errortext_info" ) );
197 $textsize->setSize( 6 );
198 $textsize->setSuffix( "%" );
199 $textsize->setMinValue( 10 );
200 $textsize->setRequired( true );
201 $form->addItem( $textsize );
202 }
203 }
This class represents a text area property in a property form.

References ilPropertyFormGUI\addItem().

Referenced by editQuestion().

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

◆ setQuestionTabs()

assErrorTextGUI::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 397 of file class.assErrorTextGUI.php.

398 {
399 global $rbacsystem, $ilTabs;
400
401 $ilTabs->clearTargets();
402
403 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
404 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
405 $q_type = $this->object->getQuestionType();
406
407 if (strlen($q_type))
408 {
409 $classname = $q_type . "GUI";
410 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
411 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
412 }
413
414 if ($_GET["q_id"])
415 {
416 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
417 {
418 // edit page
419 $ilTabs->addTarget("edit_page",
420 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
421 array("edit", "insert", "exec_pg"),
422 "", "", $force_active);
423 }
424
425 $this->addTab_QuestionPreview($ilTabs);
426 }
427
428 $force_active = false;
429 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
430 {
431 $url = "";
432 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
433 // edit question properties
434 $ilTabs->addTarget("edit_question",
435 $url,
436 array("editQuestion", "save", "saveEdit", "analyze", "originalSyncForm"),
437 $classname, "", $force_active);
438 }
439
440 // add tab for question feedback within common class assQuestionGUI
441 $this->addTab_QuestionFeedback($ilTabs);
442
443 // add tab for question hint within common class assQuestionGUI
444 $this->addTab_QuestionHints($ilTabs);
445
446 // add tab for question's suggested solution within common class assQuestionGUI
447 $this->addTab_SuggestedSolution($ilTabs, $classname);
448
449 // Assessment of questions sub menu entry
450 if ($_GET["q_id"])
451 {
452 $ilTabs->addTarget("statistics",
453 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
454 array("assessment"),
455 $classname, "");
456 }
457
458 $this->addBackTab($ilTabs);
459 }
$_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
Definition: shib_logout.php:72

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

assErrorTextGUI::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 69 of file class.assErrorTextGUI.php.

70 {
71 if (is_array( $_POST['errordata']['key'] ))
72 {
73 $this->object->flushErrorData();
74 foreach ($_POST['errordata']['key'] as $idx => $val)
75 {
76 $this->object->addErrorData( $val,
77 $_POST['errordata']['value'][$idx],
78 $_POST['errordata']['points'][$idx]
79 );
80 }
81 }
82 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

◆ writePostData()

assErrorTextGUI::writePostData (   $always = false)

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

Parameters
bool$always
Returns
integer A positive value, if one of the required fields wasn't set, else 0 @access private

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

55 {
56 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
57 if (!$hasErrors)
58 {
59 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
64 return 0;
65 }
66 return 1;
67 }
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.

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

+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assErrorTextGUI::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 84 of file class.assErrorTextGUI.php.

85 {
86 $questiontext = $_POST["question"];
87 $this->object->setQuestion( $questiontext );
88 $this->object->setErrorText( $_POST["errortext"] );
89 $points_wrong = str_replace( ",", ".", $_POST["points_wrong"] );
90 if (strlen( $points_wrong ) == 0)
91 $points_wrong = -1.0;
92 $this->object->setPointsWrong( $points_wrong );
93
94 if (!$this->object->getSelfAssessmentEditingMode())
95 {
96 $this->object->setTextSize( $_POST["textsize"] );
97 }
98 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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