19 declare(strict_types=1);
    45         private array $selected_files,
    50         $this->
addFormat(
'xml', $this->
lng->txt(
'ass_create_export_file'));
    51         $this->
addFormat(
'xmlres', $this->
lng->txt(
'ass_create_export_file_with_results'), $this, 
'createTestExportWithResults');
    52         $this->
addFormat(
'csv', $this->
lng->txt(
'ass_create_export_test_results'), $this, 
'createTestResultsExport');
    53         $this->
addFormat(
'arc', $this->
lng->txt(
'ass_create_export_test_archive'), $this, 
'createTestArchiveExport');
    54         foreach ($active_export_plugins as 
$plugin) {
    55             $plugin->setTest($this->obj);
    58                 $plugin->getFormatLabel(),
    79         if (!$this->
access->checkAccess(
'write', 
'', $this->obj->getRefId())) {
    80             $this->tpl->setOnScreenMessage(
'info', 
'cannot_export_archive', 
true);
    81             $this->
ctrl->redirectByClass(self::class);
    84         $this->
ctrl->setParameterByClass(self::class, 
'export_results', 1);
    85         (
new ilExport())->exportObject($this->obj->getType(), $this->obj->getId());
    86         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'exp_file_created'), 
true);
    87         $this->
ctrl->redirectByClass(
'iltestexportgui');
    92         if (!$this->
access->checkAccess(
'write', 
'', $this->obj->getRefId())) {
    93             $this->tpl->setOnScreenMessage(
'info', 
'cannot_export_archive', 
true);
    94             $this->
ctrl->redirectByClass(self::class);
   102             $this->component_repository,
   105         $test_exp = $export_factory->getExporter(
'results');
   106         $test_exp->buildExportFile();
   107         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'exp_file_created'), 
true);
   108         $this->
ctrl->redirectByClass(
'iltestexportgui');
   113         if ($this->
access->checkAccess(
'write', 
'', $this->obj->getRefId())) {
   119             $participantData->setActiveIdsFilter(array_keys($allActivesPasses));
   120             $participantData->load($this->obj->getTestId());
   126                 $this->html_generator
   128             $archiveService->setParticipantData($participantData);
   129             $archiveService->archivePassesByActives($allActivesPasses);
   131             $test_id = $this->obj->getId();
   132             $test_ref = $this->obj->getRefId();
   136             $best_solution = $scoring->calculateBestSolutionForTest();
   139             if (!is_dir($tmpFileName)) {
   143             $archive_exp->handInTestBestSolution($best_solution);
   145             $archive_exp->updateTestArchive();
   146             $archive_exp->compressTestArchive();
   148             $this->tpl->setOnScreenMessage(
'info', 
'cannot_export_archive', 
true);
   150         $this->
ctrl->redirectByClass(
'iltestexportgui');
   155         $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
   159                 $options[
$f[
'key']] = $f[
'txt'];
   163             $this->
toolbar->addInputItem($si, 
true);
   164             $this->
toolbar->addFormButton($this->
lng->txt(
'exp_create_file'), 
'createExportFile');
   168                 $this->
lng->txt(
'exp_create_file')
   169                 . 
' (' . $format[
'txt'] . 
')',
   170                 'create_' . $format[
'key']
   175         $archive_dir = $archiver->getZipExportDirectory();
   178         if (file_exists($archive_dir) && is_dir($archive_dir)) {
   179             $archive_files = scandir($archive_dir);
   182         $export_dir = $this->obj->getExportDirectory();
   183         $export_files = $this->obj->getExportFiles($export_dir);
   185         if (count($export_files) > 0) {
   186             foreach ($export_files as $exp_file) {
   187                 $file_arr = explode(
'__', $exp_file);
   188                 if ($file_arr[0] == $exp_file) {
   196                         'size' => filesize($export_dir . 
'/' . $exp_file),
   197                         'timestamp' => $file_arr[0],
   204         if (count($archive_files) > 0) {
   205             foreach ($archive_files as $exp_file) {
   206                 if ($exp_file == 
'.' || $exp_file == 
'..') {
   209                 $file_arr = explode(
'_', $exp_file);
   213                     'size' => filesize($archive_dir . 
'/' . $exp_file),
   214                     'timestamp' => $file_arr[4],
   221         $table->setSelectAllCheckbox(
'file');
   223             $table->addCustomColumn($c[
'txt'], $c[
'obj'], $c[
'func']);
   227             $table->addCustomMultiCommand($c[
'txt'], 
'multi_' . $c[
'func']);
   230         $table->resetFormats();
   231         foreach ($this->formats as $format) {
   232             $table->addFormat($format[
'key']);
   235         $table->setData(
$data);
   236         $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_manual_feedback_export_info'), 
true);
   237         $this->tpl->setContent($table->getHTML());
   242         $extension = strtoupper(pathinfo($export_file, PATHINFO_EXTENSION));
   243         if (in_array($extension, [
'XLSX', 
'CSV', 
'XLS'])) {
   244             return $this->
lng->txt(
'results');
   251         if ($this->selected_files === []) {
   252             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'no_checkbox'), 
true);
   253             $this->
ctrl->redirect($this, 
'listExportFiles');
   256         if (count($this->selected_files) > 1) {
   257             $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_max_one_item'), 
true);
   258             $this->
ctrl->redirect($this, 
'listExportFiles');
   263         $filename = basename($this->selected_files[0]);
   264         $exportFile = $this->obj->getExportDirectory() . 
'/' . 
$filename;
   265         $archiveFile = $archiver->getZipExportDirectory() . 
'/' . 
$filename;
   267         if (file_exists($exportFile)) {
   271         if (file_exists($archiveFile)) {
   275         $this->
ctrl->redirect($this, 
'listExportFiles');
   278     public function delete(): 
void   281         $archiveDir = $archiver->getZipExportDirectory();
   283         $export_dir = $this->obj->getExportDirectory();
   284         foreach ($this->selected_files as $file) {
   285             $file = basename($file);
   286             $dir = substr($file, 0, strlen($file) - 4);
   288             if (!strlen($file) || !strlen($dir)) {
   292             $exp_file = $export_dir . 
'/' . $file;
   293             $arc_file = $archiveDir . 
'/' . $file;
   294             $exp_dir = $export_dir . 
'/' . $dir;
   295             if (@is_file($exp_file)) {
   298             if (@is_file($arc_file)) {
   301             if (@is_dir($exp_dir)) {
   305         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_deleted_export_files'), 
true);
   306         $this->
ctrl->redirect($this, 
'listExportFiles');
 
createTestArchiveExport()
 
Readable part of repository interface to ilComponentDataDB. 
 
Export User Interface Class. 
 
static makeDirParents(string $a_dir)
Create a new directory and all parent directories. 
 
createTestResultsExport()
 
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
 
getExportTypeFromFileName(string $export_file)
 
Export User Interface Class. 
 
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively 
 
addFormat(string $a_key, string $a_txt="", object $a_call_obj=null, string $a_call_func="")
 
__construct(ilObjTestGUI $parent_gui, private ilDBInterface $db, private ilLogger $logger, private ilObjectDataCache $obj_cache, private ilComponentRepository $component_repository, Generator $active_export_plugins, private ilTestHTMLGenerator $html_generator, private array $selected_files, private QuestionInfoService $questioninfo,)
 
createTestExportWithResults()
Create test export file. 
 
Class that handles PDF generation for test and assessment. 
 
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.