19 require_once 
'./Modules/Test/classes/inc.AssessmentConstants.php';
    44         $this->
tabs = $DIC->tabs();
    50             $this->
object->loadFromDb(
$id);
    59         $hasErrors = (!$always) ? $this->
editQuestion(
true) : 
false;
    73         $this->
object->setErrorData($errordata);
    74         $this->
object->removeErrorDataWithoutPosition();
    79         $keys = $post[
'key'] ?? [];
    80         $restructured_array = [];
    81         foreach ($keys as 
$key => $text_wrong) {
    85                 (
float) str_replace(
',', 
'.', $post[
'points'][$key])
    88         return $restructured_array;
    93         $this->
object->setQuestion(
    94             $this->request->raw(
'question')
    97         $this->
object->setErrorText(
    98             $this->request->raw(
'errortext')
   101         $this->
object->parseErrorText();
   103         $points_wrong = str_replace(
",", 
".", $this->request->raw(
'points_wrong') ?? 
'');
   104         if (mb_strlen($points_wrong) == 0) {
   105             $points_wrong = self::DEFAULT_POINTS_WRONG;
   107         $this->
object->setPointsWrong((
float) $points_wrong);
   109         if (!$this->
object->getSelfAssessmentEditingMode()) {
   110             $this->
object->setTextSize(
   111                 (
float) str_replace(
',', 
'.', $this->request->raw(
'textsize'))
   125         $this->
tabs->setTabActive(
'edit_question');
   130         $this->editForm = $form;
   132         $form->setFormAction($this->
ctrl->getFormAction($this));
   134         $form->setMultipart(
false);
   135         $form->setTableWidth(
"100%");
   136         $form->setId(
"orderinghorizontal");
   142         if (count($this->
object->getErrorData()) || $checkonly) {
   148         $form->addCommandButton(
"analyze", $this->
lng->txt(
'analyze_errortext'));
   154             $form->setValuesByPost();
   155             $errors = !$form->checkInput();
   156             $form->setValuesByPost(); 
   163             $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
   175         $header->setTitle($this->
lng->txt(
"errors_section"));
   180         $errordata->setValueName($this->
lng->txt(
'text_correct'));
   181         $errordata->setValues($this->
object->getErrorData());
   186         $points_wrong->allowDecimals(
true);
   187         $points_wrong->setMaxValue(0);
   188         $points_wrong->setMaxvalueShouldBeLess(
true);
   189         $points_wrong->setValue($this->
object->getPointsWrong());
   190         $points_wrong->setInfo($this->
lng->txt(
"points_wrong_info"));
   191         $points_wrong->setSize(6);
   192         $points_wrong->setRequired(
true);
   206         $errortext->setRequired(
true);
   207         $errortext->setInfo($this->
lng->txt(
"errortext_info"));
   208         $errortext->setRows(10);
   209         $errortext->setCols(80);
   212         if (!$this->
object->getSelfAssessmentEditingMode()) {
   215             $textsize->setValue($this->
object->getTextSize() ?? 100.0);
   216             $textsize->setInfo($this->
lng->txt(
"textsize_errortext_info"));
   217             $textsize->setSize(6);
   218             $textsize->setSuffix(
"%");
   219             $textsize->setMinValue(10);
   220             $textsize->setRequired(
true);
   233         $this->
object->setErrorsFromParsedErrorText();
   255         $graphicalOutput = 
false,
   256         $result_output = 
false,
   257         $show_question_only = 
true,
   258         $show_feedback = 
false,
   259         $show_correct_solution = 
false,
   260         $show_manual_scoring = 
false,
   261         $show_question_text = 
true   264         $show_inline_feedback = 
false;
   273             $show_correct_solution,
   274             $show_manual_scoring,
   277             $show_inline_feedback,
   282         mixed $user_solutions,
   285         bool $graphical_output = 
false,
   286         bool $result_output = 
false,
   287         bool $show_question_only = 
true,
   288         bool $show_feedback = 
false,
   289         bool $show_correct_solution = 
false,
   290         bool $show_manual_scoring = 
false,
   291         bool $show_question_text = 
true,
   292         bool $show_autosave_title = 
false,
   293         bool $show_inline_feedback = 
false,
   296         $template = 
new ilTemplate(
"tpl.il_as_qpl_errortext_output_solution.html", 
true, 
true, 
"Modules/TestQuestionPool");
   299             'user' => $user_solutions ?
   305         $selections[
'best'] = $this->
object->getBestSelection();
   307         $reached_points = $this->
object->getPoints();
   308         if ($active_id > 0 && !$show_correct_solution) {
   309             $reached_points = $this->
object->getReachedPoints($active_id, $pass);
   312         if ($result_output === 
true) {
   313             $resulttext = ($reached_points == 1) ? 
"(%s " . $this->
lng->txt(
"point") . 
")" : 
"(%s " . $this->
lng->txt(
"points") . 
")";
   314             $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $reached_points));
   317         if ($this->
object->getTextSize() >= 10) {
   318             $template->setVariable(
"STYLE", 
" style=\"font-size: " . $this->
object->getTextSize() . 
"%;\"");
   321         if ($show_question_text === 
true) {
   322             $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
   325         $correctness_icons = [
   329         $errortext = $this->
object->assembleErrorTextOutput($selections, $graphical_output, $show_correct_solution, 
false, $correctness_icons);
   331         $template->setVariable(
"ERRORTEXT", $errortext);
   332         $questionoutput = $template->get();
   334         $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html", 
true, 
true, 
"Modules/TestQuestionPool");
   337         if ($show_feedback) {
   340                 $feedback .= mb_strlen($fb) ? $fb : 
'';
   344             $feedback .= mb_strlen($fb) ? $fb : 
'';
   346         if (mb_strlen($feedback)) {
   352             $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
   356         $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
   358         $solutionoutput = $solutiontemplate->get();
   359         if (!$show_question_only) {
   363         return $solutionoutput;
   366     public function getPreview($show_question_only = 
false, $showInlineFeedback = 
false): string
   378         $is_postponed = 
false,
   379         $use_post_solutions = 
false,
   380         $show_feedback = 
false   396         $template = 
new ilTemplate(
"tpl.il_as_qpl_errortext_output.html", 
true, 
true, 
"Modules/TestQuestionPool");
   398         if ($this->
object->getTextSize() >= 10) {
   399             $template->setVariable(
"STYLE", 
" style=\"font-size: " . $this->
object->getTextSize() . 
"%;\"");
   401         $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
   402         $errortext = $this->
object->assembleErrorTextOutput($selections);
   406         $template->setVariable(
"ERRORTEXT", $errortext);
   407         $template->setVariable(
"ERRORTEXT_ID", 
"qst_" . $this->
object->getId());
   408         $template->setVariable(
"ERRORTEXT_VALUE", join(
',', $selections[
'user']));
   410         $this->tpl->addOnLoadCode(
'il.test.player.errortext.init()');
   411         $this->tpl->addJavascript(
'./Modules/TestQuestionPool/templates/default/errortext.js');
   412         $questionoutput = $template->get();
   414         if ($show_question_only) {
   415             return $questionoutput;
   427         if ($active_id > 0) {
   429             $solutions = $this->
object->getSolutionValues($active_id, $pass ?? 0, 
true);
   430             foreach ($solutions as $solution) {
   431                 $selections[] = $solution[
'value1'];
   441         if (!$this->
object->feedbackOBJ->specificAnswerFeedbackExists()) {
   445         $feedback = 
'<table class="test_specific_feedback"><tbody>';
   446         $elements = $this->
object->getErrorData();
   447         foreach ($elements as $index => $element) {
   449             $feedback .= 
'<td class="text-nowrap">' . $index . 
'. ' . $element->getTextWrong() . 
':</td>';
   450             $feedback .= 
'<td>' . $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
   456             $feedback .= 
'</tr>';
   458         $feedback .= 
'</tbody></table>';
   499         $errortext = $this->
object->getErrorText();
   502         foreach ($relevant_answers as $answer_chosen) {
   503             $passdata[$answer_chosen[
'active_fi'] . 
'-' . $answer_chosen[
'pass']][$answer_chosen[
'value2']][] = $answer_chosen[
'value1'];
   507         foreach ($passdata as 
$key => $pass) {
   508             $passdata[
$key] = $this->
object->createErrorTextOutput($pass);
   509             $html .= $passdata[
$key] . 
'<hr /><br />';
   517         $answers_by_active_and_pass = [];
   519         foreach ($relevant_answers as $row) {
   520             $key = $row[
'active_fi'] . 
':' . $row[
'pass'];
   522             if (!isset($answers_by_active_and_pass[
$key])) {
   523                 $answers_by_active_and_pass[
$key] = [
'user' => []];
   526             $answers_by_active_and_pass[
$key][
'user'][] = $row[
'value1'];
   531         foreach ($answers_by_active_and_pass as $answer) {
   532             $error_text = 
'<div class="errortext">' . $this->
object->assembleErrorTextOutput($answer) . 
'</div>';
   533             $error_text_hashed = md5($error_text);
   535             if (!isset($answers[$error_text_hashed])) {
   536                 $answers[$error_text_hashed] = [
   537                     'answer' => $error_text, 
'frequency' => 0
   541             $answers[$error_text_hashed][
'frequency']++;
   544         return array_values($answers);
   551         $errordata->setValueName($this->
lng->txt(
'text_correct'));
   552         $errordata->setValues($this->
object->getErrorData());
   557         $points_wrong->allowDecimals(
true);
   558         $points_wrong->setMaxValue(0);
   559         $points_wrong->setMaxvalueShouldBeLess(
true);
   560         $points_wrong->setValue($this->
object->getPointsWrong());
   561         $points_wrong->setInfo($this->
lng->txt(
'points_wrong_info'));
   562         $points_wrong->setSize(6);
   563         $points_wrong->setRequired(
true);
   572         $existing_errordata = $this->
object->getErrorData();
   573         $this->
object->flushErrorData();
   574         $new_errordata = $this->request->raw(
'errordata');
   576         foreach ($new_errordata[
'points'] as $index => $points) {
   577             $errordata[$index] = $existing_errordata[$index]->withPoints(
   578                 (
float) str_replace(
',', 
'.', $points)
   581         $this->
object->setErrorData($errordata);
   582         $this->
object->setPointsWrong((
float) str_replace(
',', 
'.', $form->
getInput(
'points_wrong')));
 isTestPresentationContext()
 
generateQuestionOutput($selections, $show_question_only)
 
hasCorrectSolution($activeId, $passIndex)
 
generateCorrectnessIconsForCorrectness(int $correctness)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
 
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
 
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
 
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
const DEFAULT_POINTS_WRONG
 
const CSS_CLASS_FEEDBACK_CORRECT
 
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
 
populateTaxonomyFormSection(ilPropertyFormGUI $form)
 
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object. 
 
getTestOutput( $active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
 
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
 
setValue(string $a_value)
 
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
 
setKeyName($a_name)
Set key name. 
 
setErrorMessage(string $errormessage)
 
writeQuestionGenericPostData()
 
renderSolutionOutput(mixed $user_solutions, int $active_id, ?int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
 
writePostData(bool $always=false)
{} 
 
getSpecificFeedbackOutput(array $user_solution)
 
getPreview($show_question_only=false, $showInlineFeedback=false)
 
const CSS_CLASS_FEEDBACK_WRONG
 
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Basic GUI class for assessment questions. 
 
analyze()
Parse the error text. 
 
restructurePostDataForSaving(array $post)
 
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 pa...
 
editQuestion($checkonly=false)
Creates an output of the edit form for the question. 
 
saveTaxonomyAssignments()
 
getILIASPage(string $html="")
Returns the ILIAS Page around a question. 
 
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 
This class represents a text area property in a property form. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getUsersSolutionFromPreviewOrDatabase(int $active_id=0, ?int $pass=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getAnswersFrequency($relevant_answers, $question_index)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getGenericFeedbackOutput(int $active_id, ?int $pass)
 
getAggregatedAnswersView(array $relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...