19declare(strict_types=1);
30use Psr\Http\Message\ServerRequestInterface;
46 private readonly UIFactory $ui_factory,
47 private readonly UIRenderer $ui_renderer,
48 private readonly IRSS $irss,
49 private readonly ServerRequestInterface $request,
53 private readonly TestResultsRepository $test_results_repository,
64 $this->
ctrl->setParameterByClass(self::class,
'export_results', 1);
65 $manager = $this->export_handler->manager()->handler();
66 $export_info = $manager->getExportInfoWithObject(
69 $this->export_handler->consumer()->exportConfig()->allExportConfigs()
71 $element = $manager->createExport(
72 $this->il_user->getId(),
77 $file_name = $element->getIRSSInfo()->getFileName();
78 $this->temp_file_system->writeStream(
80 $this->irss->consume()->stream($element->getIRSSInfo()->getResourceId())->getStream()
82 $temp_stream = $this->temp_file_system->readStream($file_name);
83 $rid = $this->irss->manage()->stream(
86 $element->getIRSSInfo()->getFileName()
89 $temp_stream->close();
91 $this->temp_file_system->delete($file_name);
93 $this->export_repository->store(
95 ExportImportTypes::XML_WITH_RESULTS,
98 $this->export_options->getById(
'expxml')->onDeleteFiles(
100 $this->export_handler->consumer()->file()->identifier()->collection()->withElement(
101 $this->export_handler->consumer()->file()->identifier()->handler()->withIdentifier(
102 $element->getIRSSInfo()->getResourceIdSerialized()
107 $this->tpl->setOnScreenMessage(
109 $this->
lng->txt(
"exp_file_created"),
112 $this->
ctrl->redirect($this, self::CMD_LIST_EXPORT_FILES);
117 if ($this->
access->checkAccess(
'write',
'', $this->obj->getRefId())) {
120 $allActivesPasses = $evaluation->getAllActivesPasses();
122 $participantData->setActiveIdsFilter(array_keys($allActivesPasses));
123 $participantData->load($this->obj->getTestId());
135 $this->participant_access_filter_factory,
136 $this->html_generator
138 $archiveService->setParticipantData($participantData);
139 $archiveService->archivePassesByActives($allActivesPasses);
141 $test_id = $this->obj->getId();
142 $test_ref = $this->obj->getRefId();
152 $this->participant_access_filter_factory,
153 $this->parent_gui->getTestObject()->getTestLogViewer(),
162 $this->test_results_repository
164 $best_solution = $scoring->calculateBestSolutionForTest();
167 if (!is_dir($tmpFileName)) {
171 $archive_exp->handInTestBestSolution($best_solution);
173 $archive_exp->updateTestArchive();
174 $archive_exp->compressTestArchive();
176 $this->tpl->setOnScreenMessage(
'info',
'cannot_export_archive',
true);
178 $this->
ctrl->redirectByClass(
'iltestexportgui');
Builds a Color from either hex- or rgb values.
Export User Interface Class.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
Export User Interface Class.
createTestArchiveExport()
__construct(ilObjTestGUI $parent_gui, private readonly ilDBInterface $db, private readonly ilObjectDataCache $obj_cache, private readonly ilObjUser $user, private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly IRSS $irss, private readonly ServerRequestInterface $request, private readonly DBRepository $export_repository, private readonly Filesystem $temp_file_system, private readonly ilTestParticipantAccessFilterFactory $participant_access_filter_factory, private readonly TestResultsRepository $test_results_repository, private readonly ilTestHTMLGenerator $html_generator)
createTestExportWithResults()
Create test export file.
Class that handles PDF generation for test and assessment.
The filesystem interface provides the public interface for the Filesystem service API consumer.
const MESSAGE_TYPE_SUCCESS
An entity that renders components to a string output.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc