42         $this->
tabs = $DIC->tabs();
    48             $this->
object->loadFromDb(
$id);
    57         $hasErrors = (!$always) ? $this->
editQuestion(
true) : 
false;
    71         $this->
object->setErrorData(
$data);
    72         $this->
object->removeErrorDataWithoutPosition();
    77         $keys = $post[
'key'] ?? [];
    78         $restructured_array = [];
    79         foreach ($keys as $key => $text_wrong) {
    83                 (
float) str_replace(
',', 
'.', $post[
'points'][$key])
    86         return $restructured_array;
    91         $this->
object->setQuestion(
    92             $this->request_data_collector->string(
'question')
    95         $this->
object->setErrorText(
    96             $this->request_data_collector->raw(
'errortext')
    99         $this->
object->parseErrorText();
   101         $this->
object->setPointsWrong(
   102             $this->request_data_collector->float(
'points_wrong') ?? self::DEFAULT_POINTS_WRONG
   105         if (!$this->
object->getSelfAssessmentEditingMode()) {
   106             $this->
object->setTextSize(
   107                 $this->request_data_collector->float(
'textsize')
   113         bool $checkonly = 
false,
   114         ?
bool $is_save_cmd = null
   119         $this->editForm = $form;
   121         $form->setFormAction($this->
ctrl->getFormAction($this));
   123         $form->setMultipart(
false);
   124         $form->setTableWidth(
"100%");
   125         $form->setId(
"orderinghorizontal");
   131         if (count($this->
object->getErrorData()) || $checkonly) {
   137         $form->addCommandButton(
"analyze", $this->
lng->txt(
'analyze_errortext'));
   143             $form->setValuesByPost();
   144             $errors = !$form->checkInput();
   145             $form->setValuesByPost(); 
   164         $header->setTitle($this->
lng->txt(
"errors_section"));
   169         $errordata->setValueName($this->
lng->txt(
'text_correct'));
   170         $errordata->setValues($this->
object->getErrorData());
   175         $points_wrong->allowDecimals(
true);
   176         $points_wrong->setMaxValue(0);
   177         $points_wrong->setMaxvalueShouldBeLess(
true);
   178         $points_wrong->setValue($this->
object->getPointsWrong());
   179         $points_wrong->setInfo($this->
lng->txt(
"points_wrong_info"));
   180         $points_wrong->setSize(6);
   181         $points_wrong->setRequired(
true);
   195         $errortext->setRequired(
true);
   196         $errortext->setInfo($this->
lng->txt(
"errortext_info"));
   197         $errortext->setRows(10);
   198         $errortext->setCols(80);
   201         if (!$this->
object->getSelfAssessmentEditingMode()) {
   204             $textsize->setValue($this->
object->getTextSize() ?? 100.0);
   205             $textsize->setInfo($this->
lng->txt(
"textsize_errortext_info"));
   206             $textsize->setSize(6);
   207             $textsize->setSuffix(
"%");
   208             $textsize->setMinValue(10);
   209             $textsize->setRequired(
true);
   223         $this->
object->setErrorsFromParsedErrorText();
   224         $this->
tabs->activateTab(
'edit_question');
   231         bool $graphical_output = 
false,
   232         bool $result_output = 
false,
   233         bool $show_question_only = 
true,
   234         bool $show_feedback = 
false,
   235         bool $show_correct_solution = 
false,
   236         bool $show_manual_scoring = 
false,
   237         bool $show_question_text = 
true,
   238         bool $show_inline_feedback = 
true   249             $show_correct_solution,
   250             $show_manual_scoring,
   253             $show_inline_feedback,
   258         mixed $user_solutions,
   261         bool $graphical_output = 
false,
   262         bool $result_output = 
false,
   263         bool $show_question_only = 
true,
   264         bool $show_feedback = 
false,
   265         bool $show_correct_solution = 
false,
   266         bool $show_manual_scoring = 
false,
   267         bool $show_question_text = 
true,
   268         bool $show_autosave_title = 
false,
   269         bool $show_inline_feedback = 
false,
   271         $template = 
new ilTemplate(
"tpl.il_as_qpl_errortext_output_solution.html", 
true, 
true, 
"components/ILIAS/TestQuestionPool");
   274             'user' => $user_solutions ?
   278         $selections[
'best'] = $this->
object->getBestSelection();
   280         $reached_points = $this->
object->getPoints();
   281         if ($active_id > 0 && !$show_correct_solution) {
   282             $reached_points = $this->
object->getReachedPoints($active_id, $pass);
   285         if ($result_output === 
true) {
   286             $resulttext = ($reached_points == 1) ? 
"(%s " . $this->
lng->txt(
"point") . 
")" : 
"(%s " . $this->
lng->txt(
"points") . 
")";
   287             $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $reached_points));
   290         if ($this->
object->getTextSize() >= 10) {
   291             $template->setVariable(
"STYLE", 
" style=\"font-size: " . $this->
object->getTextSize() . 
"%;\"");
   294         if ($show_question_text === 
true) {
   295             $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
   298         $correctness_icons = [
   302         $errortext = $this->
object->assembleErrorTextOutput($selections, $graphical_output, $show_correct_solution, 
false, $correctness_icons);
   304         $template->setVariable(
"ERRORTEXT", $errortext);
   305         $questionoutput = $template->get();
   307         $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html", 
true, 
true, 
"components/ILIAS/TestQuestionPool");
   310         if ($show_feedback) {
   313                 $feedback .= mb_strlen($fb) ? $fb : 
'';
   317             $feedback .= mb_strlen($fb) ? $fb : 
'';
   319         if (mb_strlen($feedback)) {
   325             $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
   329         $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
   331         $solutionoutput = $solutiontemplate->get();
   332         if (!$show_question_only) {
   336         return $solutionoutput;
   340         bool $show_question_only = 
false,
   341         bool $show_inline_feedback = 
false   353         bool $is_question_postponed = 
false,
   354         array|
bool $user_post_solutions = 
false,
   355         bool $show_specific_inline_feedback = 
false   363             $is_question_postponed,
   371         $template = 
new ilTemplate(
"tpl.il_as_qpl_errortext_output.html", 
true, 
true, 
"components/ILIAS/TestQuestionPool");
   373         if ($this->
object->getTextSize() >= 10) {
   374             $template->setVariable(
"STYLE", 
" style=\"font-size: " . $this->
object->getTextSize() . 
"%;\"");
   376         $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
   377         $errortext = $this->
object->assembleErrorTextOutput($selections);
   381         $template->setVariable(
"ERRORTEXT", $errortext);
   382         $template->setVariable(
"ERRORTEXT_ID", 
"qst_" . $this->
object->getId());
   383         $template->setVariable(
"ERRORTEXT_VALUE", join(
',', $selections[
'user']));
   385         $this->tpl->addOnLoadCode(
'il.test.player.errortext.init()');
   386         $this->tpl->addJavascript(
'assets/js/errortext.js');
   387         $questionoutput = $template->get();
   389         if ($show_question_only) {
   390             return $questionoutput;
   402         if ($active_id > 0) {
   404             $solutions = $this->
object->getSolutionValues($active_id, $pass ?? 0, 
true);
   405             foreach ($solutions as $solution) {
   406                 $selections[] = $solution[
'value1'];
   416         if (!$this->
object->feedbackOBJ->specificAnswerFeedbackExists()) {
   420         $feedback = 
'<table class="test_specific_feedback"><tbody>';
   421         $elements = $this->
object->getErrorData();
   422         foreach ($elements as $index => $element) {
   424             $feedback .= 
'<td class="text-nowrap">' . $index . 
'. ' . $element->getTextWrong() . 
':</td>';
   425             $feedback .= 
'<td>' . $this->
object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
   431             $feedback .= 
'</tr>';
   433         $feedback .= 
'</tbody></table>';
   474         $errortext = $this->
object->getErrorText();
   477         foreach ($relevant_answers as $answer_chosen) {
   478             $passdata[$answer_chosen[
'active_fi'] . 
'-' . $answer_chosen[
'pass']][$answer_chosen[
'value2']][] = $answer_chosen[
'value1'];
   482         foreach ($passdata as $key => $pass) {
   483             $passdata[$key] = $this->
object->createErrorTextOutput($pass);
   484             $html .= $passdata[$key] . 
'<hr /><br />';
   492         $answers_by_active_and_pass = [];
   494         foreach ($relevant_answers as $row) {
   495             $key = $row[
'active_fi'] . 
':' . $row[
'pass'];
   497             if (!isset($answers_by_active_and_pass[$key])) {
   498                 $answers_by_active_and_pass[$key] = [
'user' => []];
   501             $answers_by_active_and_pass[$key][
'user'][] = $row[
'value1'];
   506         foreach ($answers_by_active_and_pass as $answer) {
   507             $error_text = 
'<div class="errortext">' . $this->
object->assembleErrorTextOutput($answer) . 
'</div>';
   508             $error_text_hashed = md5($error_text);
   510             if (!isset($answers[$error_text_hashed])) {
   511                 $answers[$error_text_hashed] = [
   512                     'answer' => $error_text, 
'frequency' => 0
   516             $answers[$error_text_hashed][
'frequency']++;
   519         return array_values($answers);
   526         $errordata->setValueName($this->
lng->txt(
'text_correct'));
   527         $errordata->setValues($this->
object->getErrorData());
   532         $points_wrong->allowDecimals(
true);
   533         $points_wrong->setMaxValue(0);
   534         $points_wrong->setMaxvalueShouldBeLess(
true);
   535         $points_wrong->setValue($this->
object->getPointsWrong());
   536         $points_wrong->setInfo($this->
lng->txt(
'points_wrong_info'));
   537         $points_wrong->setSize(6);
   538         $points_wrong->setRequired(
true);
   547         $existing_errordata = $this->
object->getErrorData();
   548         $this->
object->flushErrorData();
   549         $new_errordata = $this->request_data_collector->raw(
'errordata');
   551         foreach ($new_errordata[
'points'] as $index => $points) {
   552             $errordata[$index] = $existing_errordata[$index]->withPoints(
   553                 (
float) str_replace(
',', 
'.', $points)
   556         $this->
object->setErrorData($errordata);
   557         $this->
object->setPointsWrong((
float) str_replace(
',', 
'.', $form->
getInput(
'points_wrong')));
 isTestPresentationContext()
 
generateQuestionOutput($selections, $show_question_only)
 
setAdditionalContentEditingModeFromPost()
 
hasCorrectSolution($activeId, $passIndex)
 
getTestOutput(int $active_id, int $pass, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
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 the request and applies them to the data object...
 
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
 
editQuestion(bool $checkonly=false, ?bool $is_save_cmd=null)
 
setValue(string $a_value)
 
getSolutionOutput(int $active_id, ?int $pass=null, 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_inline_feedback=true)
 
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,)
 
Class for error text questions. 
 
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
 
writePostData(bool $always=false)
{} 
 
getSpecificFeedbackOutput(array $user_solution)
 
getPreview(bool $show_question_only=false, bool $show_inline_feedback=false)
 
const CSS_CLASS_FEEDBACK_WRONG
 
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from the request 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...
 
analyze()
Parse the error text. 
 
restructurePostDataForSaving(array $post)
 
saveTaxonomyAssignments()
 
getILIASPage(string $html="")
Returns the ILIAS Page around a question. 
 
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
__construct(Container $dic, ilPlugin $plugin)
 
This class represents a text area property in a property form. 
 
This class represents a key value pair wizard property in a property form. 
 
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...
 
renderEditForm(ilPropertyFormGUI $form)
 
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...