ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 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 38 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 ilTestHTMLGenerator  $html_generator 
)

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

53 {
55 }
__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 113 of file class.ilTestExportGUI.php.

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

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

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: