19 declare(strict_types=1);
41 private readonly \
ilCtrl $ctrl,
52 array $print_view_types,
53 ?
Types $selected_print_view_type,
56 $this->tabs_manager->resetTabsAndAddBacklink(
61 $this->ui_factory->viewControl()->mode(
63 $this->
lng->txt(
'show_hide_best_solution')
64 )->withActive($selected_print_view_type->getLabel($this->lng))
70 $template = new \ilTemplate(
'tpl.il_as_tst_print_questions_preview.html',
true,
true,
'components/ILIAS/Test');
76 $this->question_header_builder->setHeaderMode($this->test_obj->getTitleOutput());
78 foreach ($question_ids as $question_id) {
79 $template->setCurrentBlock(
'question');
80 $question_gui = $this->test_obj->createQuestionGUI(
'', $question_id);
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());
88 if ($selected_print_view_type === Types::RESULTS_VIEW_TYPE_HIDE) {
89 $template->setVariable(
'SOLUTION_OUTPUT', $question_gui->getPreview(
false));
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));
96 $template->parseCurrentBlock(
'question');
98 $max_points += $question_gui->getObject()->getMaximumPoints();
101 $template->setVariable(
103 $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
104 $this->test_obj->getTitle()
107 $template->setVariable(
'PRINT_TEST', $this->
lng->txt(
'tst_print'));
108 $template->setVariable(
'TXT_PRINT_DATE', $this->
lng->txt(
'date'));
109 $template->setVariable(
113 ->format($this->
user->getDateTimeFormat()->toString())
115 $template->setVariable(
116 'TXT_MAXIMUM_POINTS',
117 $this->
lng->txt(
'tst_maximum_points')
119 $template->setVariable(
'VALUE_MAXIMUM_POINTS', $max_points);
120 $this->tpl->setVariable(
'PRINT_CONTENT', $template->get());
125 $this->tabs_manager->resetTabsAndAddBacklink(
131 $template = new \ilTemplate(
'tpl.il_as_tst_print_questions_answers.html',
true,
true,
'components/ILIAS/Test');
134 $question_gui = $this->test_obj->createQuestionGUI(
'', $question_id);
136 $template->setVariable(
'TITLE', $question_gui->getObject()->getTitleForHTMLOutput());
137 $template->setVariable(
'TXT_PRINT_DATE', $this->
lng->txt(
'date'));
138 $template->setVariable(
142 ->format($this->
user->getDateTimeFormat()->toString())
145 $this->tpl->setVariable(
150 $this->test_obj->getTestId()
160 $this->test_obj->setAccessFilteredParticipantList(
161 $this->test_obj->buildStatisticsAccessFilteredParticipantList()
164 $foundusers = $this->test_obj->getParticipantsForTestAndQuestion(
169 foreach ($foundusers as $active_id => $passes) {
174 for ($i = 0; $i < count($passes); $i++) {
175 if ($passes[$i][
'pass'] !== $resultpass) {
207 $user_id = $this->test_obj->_getUserIdFromActiveId($active_id);
211 $user = new \ilObjUser();
212 $user->setLastname($this->
lng->txt(
'deleted_user'));
214 if ($user->getMatriculation() !==
'' 215 && $this->test_obj->getAnonymity() ===
false) {
217 $template->
setVariable(
'TXT_USR_MATRIC', $this->
lng->txt(
'matriculation'));
218 $template->
setVariable(
'VALUE_USR_MATRIC', $user->getMatriculation());
223 $uname = $this->test_obj->userLookupFullName(
$user_id,
false);
225 $template->
setVariable(
'TXT_PASS', $this->
lng->txt(
'scored_pass'));
233 $this->ui_factory->button()->standard($this->
lng->txt(
'print'),
'')
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
addQuestionResultForTestUsersToTemplate(\ilTemplate $template, \assQuestionGUI $question_gui, int $test_id)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
printSelectedQuestions(array $print_view_types, ?Types $selected_print_view_type, array $question_ids)
addPrintButtonToToolbar()
withOnLoadCode(Closure $binder)
addResultUserInfoToTemplate(\ilTemplate $template, int $active_id, int $pass)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
printAnswers(int $question_id)
setVariable($variable, $value='')
Sets a variable value.
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(private readonly UIFactory $ui_factory, private \ilGlobalTemplateInterface $tpl, private TabsManager $tabs_manager, private \ilToolbarGUI $toolbar, private readonly Refinery $refinery, private readonly Language $lng, private readonly \ilCtrl $ctrl, private readonly \ilObjUser $user, private readonly \ilTestQuestionHeaderBlockBuilder $question_header_builder, private readonly \ilObjTest $test_obj,)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
const RENDER_PURPOSE_PREVIEW
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)
static _lookupLogin(int $a_user_id)