ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilTestExportGUI Class Reference

Export User Interface Class. More...

+ Inheritance diagram for ilTestExportGUI:
+ Collaboration diagram for ilTestExportGUI:

Public Member Functions

 __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. More...
 
 createTestArchiveExport ()
 
- Public Member Functions inherited from ilExportGUI
 __construct (object $a_parent_gui, ?ilObject $a_main_obj=null, bool $public_access_enabled=true, bool $default_export_option_enabled=true)
 
 isPublicAccessEnabled ()
 
 executeCommand ()
 
 addFormat ()
 @depricated More...
 
 listExportFiles ()
 
 getFormats ()
 @depricated More...
 

Additional Inherited Members

- Data Fields inherited from ilExportGUI
const CMD_LIST_EXPORT_FILES = "listExportFiles"
 
const CMD_EXPORT_XML = "createXmlExportFile"
 
- Protected Member Functions inherited from ilExportGUI
 initExportOptionsFromPost ()
 
 builtExportOptionCommand (ilExportHandlerConsumerExportOptionInterface $export_option)
 
 enableStandardXMLExport ()
 
 initExportOptions ()
 
 displayExportFiles ()
 
 createXMLExportFile ()
 
 showItemSelection ()
 Show container item selection table. More...
 
 saveItemSelection ()
 
 createXMLExport (ExportConfigCollectionInterface $export_configs)
 
 createXMLContainerExport ()
 
- Protected Attributes inherited from ilExportGUI
const CMD_SAVE_ITEM_SELECTION = "saveItemSelection"
 
const CMD_EXPORT_OPTION_PREFIX = "exportOption"
 
ilExportHandlerConsumerExportOptionCollectionInterface $export_options
 
ilUIServices $ui_services
 
ilHTTPServices $http
 
ilRefineryFactory $refinery
 
ilObjUser $il_user
 
ilLanguage $lng
 
ilObject $obj
 
ilGlobalTemplateInterface $tpl
 
ilCtrlInterface $ctrl
 
ilAccessHandler $access
 
ilErrorHandling $error
 
ilToolbarGUI $toolbar
 
ilObjectDefinition $obj_definition
 
ilTree $tree
 
ilExportHandler $export_handler
 
ilExportHandlerConsumerContextInterface $context
 
ilDataFactory $data_factory
 
object $parent_gui
 
bool $public_access_enabled
 

Detailed Description

Export User Interface Class.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de @ilCtrl_Calls ilTestExportGUI: ilExportGUI

Definition at line 39 of file class.ilTestExportGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestExportGUI::__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 
)

Definition at line 41 of file class.ilTestExportGUI.php.

55 {
57 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ilExportGUI\$parent_gui, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ createTestArchiveExport()

ilTestExportGUI::createTestArchiveExport ( )

Definition at line 115 of file class.ilTestExportGUI.php.

116 {
117 if ($this->access->checkAccess('write', '', $this->obj->getRefId())) {
118 // prepare generation before contents are processed (for mathjax)
119 $evaluation = new ilTestEvaluationFactory($this->db, $this->obj);
120 $allActivesPasses = $evaluation->getAllActivesPasses();
121 $participantData = new ilTestParticipantData($this->db, $this->lng);
122 $participantData->setActiveIdsFilter(array_keys($allActivesPasses));
123 $participantData->load($this->obj->getTestId());
124
125 $archiveService = new ilTestArchiveService(
126 $this->obj,
127 $this->lng,
128 $this->db,
129 $this->user,
130 $this->ui_factory,
131 $this->ui_renderer,
132 $this->irss,
133 $this->request,
134 $this->obj_cache,
135 $this->participant_access_filter_factory,
136 $this->html_generator
137 );
138 $archiveService->setParticipantData($participantData);
139 $archiveService->archivePassesByActives($allActivesPasses);
140
141 $test_id = $this->obj->getId();
142 $test_ref = $this->obj->getRefId();
143 $archive_exp = new ilTestArchiver(
144 $this->lng,
145 $this->db,
146 $this->user,
147 $this->ui_factory,
148 $this->ui_renderer,
149 $this->irss,
150 $this->request,
151 $this->obj_cache,
152 $this->participant_access_filter_factory,
153 $this->parent_gui->getTestObject()->getTestLogViewer(),
154 $test_id,
155 $test_ref
156 );
157
158 $scoring = new TestScoring(
159 $this->obj,
160 $this->user,
161 $this->db,
162 $this->test_results_repository
163 );
164 $best_solution = $scoring->calculateBestSolutionForTest();
165
166 $tmpFileName = ilFileUtils::ilTempnam();
167 if (!is_dir($tmpFileName)) {
168 ilFileUtils::makeDirParents($tmpFileName);
169 }
170
171 $archive_exp->handInTestBestSolution($best_solution);
172
173 $archive_exp->updateTestArchive();
174 $archive_exp->compressTestArchive();
175 } else {
176 $this->tpl->setOnScreenMessage('info', 'cannot_export_archive', true);
177 }
178 $this->ctrl->redirectByClass('iltestexportgui');
179 }
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.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilFileUtils\ilTempnam(), ILIAS\Repository\lng(), ilFileUtils\makeDirParents(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ createTestExportWithResults()

ilTestExportGUI::createTestExportWithResults ( )

Create test export file.

Definition at line 62 of file class.ilTestExportGUI.php.

63 {
64 $this->ctrl->setParameterByClass(self::class, 'export_results', 1);
65 $manager = $this->export_handler->manager()->handler();
66 $export_info = $manager->getExportInfoWithObject(
67 $this->obj,
68 time(),
69 $this->export_handler->consumer()->exportConfig()->allExportConfigs()
70 );
71 $element = $manager->createExport(
72 $this->il_user->getId(),
73 $export_info,
74 ''
75 );
76
77 $file_name = $element->getIRSSInfo()->getFileName();
78 $this->temp_file_system->writeStream(
79 $file_name,
80 $this->irss->consume()->stream($element->getIRSSInfo()->getResourceId())->getStream()
81 );
82 $temp_stream = $this->temp_file_system->readStream($file_name);
83 $rid = $this->irss->manage()->stream(
84 $temp_stream,
86 $element->getIRSSInfo()->getFileName()
87 );
88
89 $temp_stream->close();
90
91 $this->temp_file_system->delete($file_name);
92
93 $this->export_repository->store(
94 $this->obj->getId(),
95 ExportImportTypes::XML_WITH_RESULTS,
96 $rid
97 );
98 $this->export_options->getById('expxml')->onDeleteFiles(
99 $this->context,
100 $this->export_handler->consumer()->file()->identifier()->collection()->withElement(
101 $this->export_handler->consumer()->file()->identifier()->handler()->withIdentifier(
102 $element->getIRSSInfo()->getResourceIdSerialized()
103 )
104 )
105 );
106
107 $this->tpl->setOnScreenMessage(
109 $this->lng->txt("exp_file_created"),
110 true
111 );
112 $this->ctrl->redirect($this, self::CMD_LIST_EXPORT_FILES);
113 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\UICore\GlobalTemplate\MESSAGE_TYPE_SUCCESS.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: