55 : void {
56 $this->tabs_manager->resetTabsAndAddBacklink(
58 );
59
61 $this->ui_factory->viewControl()->mode(
62 $print_view_types,
63 $this->lng->txt('show_hide_best_solution')
64 )->withActive($selected_print_view_type->getLabel($this->lng))
65 );
66
69
70 $template = new \ilTemplate('tpl.il_as_tst_print_questions_preview.html', true, true, 'components/ILIAS/Test');
71
73
74 $max_points = 0;
76 $this->question_header_builder->setHeaderMode($this->test_obj->getTitleOutput());
77
78 foreach ($question_ids as $question_id) {
79 $template->setCurrentBlock('question');
80 $question_gui = $this->test_obj->createQuestionGUI('', $question_id);
82
83 $this->question_header_builder->setQuestionTitle($question_gui->getObject()->getTitleForHTMLOutput());
84 $this->question_header_builder->setQuestionPoints($question_gui->getObject()->getMaximumPoints());
85 $this->question_header_builder->setQuestionPosition(
$counter);
86 $template->setVariable('QUESTION_HEADER', $this->question_header_builder->getHTML());
87
88 if ($selected_print_view_type === Types::RESULTS_VIEW_TYPE_HIDE) {
89 $template->setVariable('SOLUTION_OUTPUT', $question_gui->getPreview(false));
90 } else {
91 $template->setVariable(
'TXT_QUESTION_ID', $this->
lng->txt(
'question_id_short'));
92 $template->setVariable('QUESTION_ID', $question_gui->getObject()->getId());
93 $template->setVariable('SOLUTION_OUTPUT', $question_gui->getSolutionOutput(0, null, false, true, false, false));
94 }
95
96 $template->parseCurrentBlock('question');
98 $max_points += $question_gui->getObject()->getMaximumPoints();
99 }
100
101 $template->setVariable(
102 'TITLE',
103 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
104 $this->test_obj->getTitle()
105 )
106 );
107 $template->setVariable(
'PRINT_TEST', $this->
lng->txt(
'tst_print'));
108 $template->setVariable(
'TXT_PRINT_DATE', $this->
lng->txt(
'date'));
109 $template->setVariable(
110 'VALUE_PRINT_DATE',
111 (new \DateTimeImmutable())
112 ->setTimezone(
new \DateTimeZone($this->
user->getTimeZone()))
113 ->format($this->user->getDateTimeFormat()->toString())
114 );
115 $template->setVariable(
116 'TXT_MAXIMUM_POINTS',
117 $this->
lng->txt(
'tst_maximum_points')
118 );
119 $template->setVariable('VALUE_MAXIMUM_POINTS', $max_points);
120 $this->tpl->setVariable('PRINT_CONTENT', $template->get());
121 }