19 declare(strict_types=1);
    55         $question_id = $this->testrequest->getQuestionId();
    56         if ($question_id !== 0) {
    59         $this->test_access = 
new ilTestAccess($test_obj->getRefId());
    64         if (!$this->test_access->checkCorrectionsAccess()
    65             || $this->question_gui !== null
    67             ilObjTestGUI::accessViolationRedirect();
    70         if ($this->testrequest->isset(
'removeQid') && (
int) $this->testrequest->raw(
'removeQid')) {
    71             $this->confirmQuestionRemoval();
    75         $this->
ctrl->saveParameterByClass(self::class, 
'q_id');
    76         $command = $this->
ctrl->getCmd(
'showQuestionList');
    87         $this->main_tpl->setContent($form->getHTML());
    93         $form->setFormAction($this->
ctrl->getFormAction($this));
    94         $form->setId(
'tst_question_correction');
    96         $form->setTitle($this->
language->txt(
'tst_corrections_qst_form'));
   106         $scoring->setQuestionId($question_gui->
getObject()->getId());
   108         if ($scoring->getNumManualScorings()) {
   109             $form->addCommandButton(
'confirmManualScoringReset', $this->
language->txt(
'save'));
   111             $form->addCommandButton(
'saveQuestion', $this->
language->txt(
'save'));
   127         $scoring->setQuestionId($this->question_gui->getObject()->getId());
   129         $confirmation = sprintf(
   130             $this->
language->txt(
'tst_corrections_manscore_reset_warning'),
   131             $scoring->getNumManualScorings(),
   132             $this->question_gui->getObject()->getTitleForHTMLOutput(),
   133             $this->question_gui->getObject()->getId()
   137         $gui->setHeaderText($confirmation);
   138         $gui->setFormAction($this->
ctrl->getFormAction($this));
   139         $gui->setCancel($this->
language->txt(
'cancel'), 
'showQuestion');
   140         $gui->setConfirm($this->
language->txt(
'confirm'), 
'saveQuestion');
   144         $this->main_tpl->setContent($gui->getHTML());
   151         $form->setValuesByPost();
   153         if (!$form->checkInput()) {
   162         $question->setPoints($question_gui->
getObject()->getMaximumPoints());
   172         $scoring->setPreserveManualScores(
false);
   173         $scoring->setQuestionId($question_gui->
getObject()->getId());
   174         $scoring->recalculateSolutions();
   176         if ($this->
logger->isLoggingEnabled()) {
   177             $this->
logger->logQuestionAdministrationInteraction(
   178                 $question_gui->
getObject()->toQuestionAdministrationInteraction(
   179                     $this->
logger->getAdditionalInformationGenerator(),
   180                     $this->test_obj->getRefId(),
   186         $this->main_tpl->setOnScreenMessage(
'success', $this->
language->txt(
'saved_successfully'), 
true);
   187         $this->
ctrl->redirectByClass([ilObjTestGUI::class, self::class], 
'showQuestion');
   195         $page_gui->setEditPreview(
true);
   196         $page_gui->setEnabledTabs(
false);
   210         $page_gui->setQuestionHTML([$question_gui->
getObject()->getId() => $solution_html]);
   211         $page_gui->setPresentationTitle($question_gui->
getObject()->getTitleForHTMLOutput());
   213         $tpl = 
new ilTemplate(
'tpl.tst_corrections_solution_presentation.html', 
true, 
true, 
'components/ILIAS/Test');
   214         $tpl->setVariable(
'SOLUTION_PRESENTATION', $page_gui->preview());
   219         $this->main_tpl->setContent($tpl->get());
   221         $this->main_tpl->setCurrentBlock(
"ContentStyle");
   222         $this->main_tpl->setVariable(
   223             "LOCATION_CONTENT_STYLESHEET",
   226         $this->main_tpl->parseCurrentBlock();
   228         $this->main_tpl->setCurrentBlock(
"SyntaxStyle");
   229         $this->main_tpl->setVariable(
   230             "LOCATION_SYNTAX_STYLESHEET",
   233         $this->main_tpl->parseCurrentBlock();
   241         $solutions = $participant_results
   243             : $this->
getSolutions($this->question_gui->getObject());
   249         foreach ($this->question_gui->getSubQuestionsIndex() as $subQuestionIndex) {
   250             $table = $this->question_gui->getAnswerFrequencyTableGUI(
   252                 'showAnswerStatistic',
   257             $tablesHtml .= $table->getHTML() . $table->getAdditionalHtml();
   261         $this->main_tpl->setContent($tablesHtml);
   271         ))->buildAddAnswerModal(
'')
   272             ->withRequest($this->testrequest->getRequest());
   274         $data = $form->getData();
   276         $question_index = 
$data[
'question_index'];
   277         $answer_value = 
$data[
'answer_value'];
   278         $points = 
$data[
'points'];
   281             $this->main_tpl->setOnScreenMessage(
'failure', $this->
language->txt(
'err_no_numeric_value'));
   286         $question = $this->question_gui->getObject();
   287         if ($question->isAddableAnswerOptionValue($question_index, $answer_value)) {
   288             $question->addAnswerOptionValue($question_index, $answer_value, $points);
   289             $question->saveToDb();
   298         $scoring->setPreserveManualScores(
true);
   299         $scoring->setQuestionId($question_index);
   300         $participant_results = $scoring->recalculateSolutions();
   302         if ($this->
logger->isLoggingEnabled()) {
   303             $this->
logger->logQuestionAdministrationInteraction(
   304                 $question->toQuestionAdministrationInteraction(
   305                     $this->logger->getAdditionalInformationGenerator(),
   306                     $this->test_obj->getRefId(),
   312         $this->main_tpl->setOnScreenMessage(
'success', $this->
language->txt(
'saved_successfully'));
   318         foreach ($array as $name => $value) {
   319             if ($name == 
'cmd' && !count($curPath)) {
   323             if (count($curPath)) {
   327             if (is_array($value)) {
   328                 $nextPath = array_merge($curPath, [$name]);
   331                 $postVar = implode(
'', $curPath) . $name;
   339         $this->
tabs->clearTargets();
   340         $this->
tabs->clearSubTabs();
   342         $this->
help->setScreenIdComponent(
'tst');
   343         $this->
help->setScreenId(
'scoringadjust');
   344         $this->
help->setSubScreenId($active_tab_id);
   348             $this->
language->txt(
'tst_corrections_tab_question'),
   349             $this->
ctrl->getLinkTargetByClass([ilObjTestGUI::class, self::class], 
'showQuestion')
   354             $this->
language->txt(
'tst_corrections_tab_solution'),
   355             $this->
ctrl->getLinkTargetByClass([ilObjTestGUI::class, self::class], 
'showSolution')
   361                 $this->
language->txt(
'tst_corrections_tab_statistics'),
   362                 $this->
ctrl->getLinkTargetByClass([ilObjTestGUI::class, self::class], 
'showAnswerStatistic')
   366         $this->
tabs->setBackTarget(
   368             $this->
ctrl->getLinkTargetByClass(ilObjTestGUI::class, 
'showQuestions')
   371         $this->
tabs->activateTab($active_tab_id);
   376         $this->main_tpl->setTitle($question_gui->
getObject()->getTitleForHTMLOutput());
   382         if (!$this->test_obj->isTestQuestion($this->question_gui->getObject()->getId())) {
   395         return $this->test_obj->getRefId();
   400         $question_gui = assQuestion::instantiateQuestionGUI($question_id);
   401         if ($question_gui === null) {
   405         $question->setPoints($question_gui->
getObject()->getMaximumPoints());
   414         foreach (array_keys($this->test_obj->getParticipants()) as $active_id) {
   416             $passes_selector->setActiveId($active_id);
   417             $passes_selector->loadLastFinishedPass();
   419             foreach ($passes_selector->getClosedPasses() as $pass) {
   421                     $solution_rows[] = $row;
   426         return $solution_rows;
   436         foreach ($participant_results as $active_id => $result) {
   437             foreach ($result->getPasses() as $pass) {
   450         if (!$this->test_obj->getGlobalSettings()->isAdjustingQuestionsWithResultsAllowed()) {
   455             $this->test_obj->getTestQuestions(),
   456             function (array 
$c, array $v): array {
 
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
 
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it. 
 
ilTestAccess $test_access
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
showAnswerStatistic(?array $participant_results=null)
 
setObject(assQuestion $question)
 
addHiddenItem(string $a_post_var, string $a_value)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
isAnswerFrequencyStatisticSupported()
 
prepareReprintableCorrectionsForm(ilPropertyFormGUI $form)
 
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
 
TestQuestionAdministrationInteractionTypes
 
__construct(private readonly ilDBInterface $database, private readonly ilCtrlInterface $ctrl, private readonly ilLanguage $language, private readonly ilTabsGUI $tabs, private readonly ilHelpGUI $help, private readonly UIFactory $ui_factory, private readonly ilGlobalTemplateInterface $main_tpl, private readonly RefineryFactory $refinery, private readonly TestLogger $logger, private readonly RequestDataCollector $testrequest, private readonly ilObjTest $test_obj, private readonly ilObjUser $scorer,)
 
setRenderPageContainer(bool $a_val)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
assQuestionGUI $question_gui
 
getSolutions(assQuestion $question)
 
getQuestionGUI(int $question_id)
 
static getSyntaxStylePath()
 
confirmManualScoringReset()
 
setCorrectionTabsContext(assQuestionGUI $question_gui, string $active_tab_id)
 
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading) 
 
supportsAdjustment(\assQuestionGUI $question_object)
Returns if the given question object support scoring adjustment. 
 
addHiddenItemsFromArray(ilConfirmationGUI $gui, $array, $curPath=[])
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getSolutionsByParticipantResults(assQuestion $question, array $participant_results)
 
buildQuestionCorrectionForm(assQuestionGUI $question_gui)
 
language()
 description: > Example for rendring a language glyph. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
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)
 
populatePageTitleAndDescription(assQuestionGUI $question_gui)
 
showQuestion(ilPropertyFormGUI $form=null)