ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 
 executeCommand ()
 
 addFormat ()
 
 listExportFiles ()
 
 getFormats ()
 

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 ()
 
 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
 

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 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.

References ILIAS\GlobalScreen\Provider\__construct(), and null.

53  {
54  parent::__construct($parent_gui, null);
55  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ createTestArchiveExport()

ilTestExportGUI::createTestArchiveExport ( )

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

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

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

◆ createTestExportWithResults()

ilTestExportGUI::createTestExportWithResults ( )

Create test export file.

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

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

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  );
68  $element = $manager->createExport(
69  $this->il_user->getId(),
70  $export_info,
71  ''
72  );
73 
74  $file_name = $element->getIRSSInfo()->getFileName();
75  $this->temp_file_system->writeStream(
76  $file_name,
77  $this->irss->consume()->stream($element->getIRSSInfo()->getResourceId())->getStream()
78  );
79  $temp_stream = $this->temp_file_system->readStream($file_name);
80  $rid = $this->irss->manage()->stream(
81  $temp_stream,
83  $element->getIRSSInfo()->getFileName()
84  );
85 
86  $temp_stream->close();
87 
88  $this->temp_file_system->delete($file_name);
89 
90  $this->export_repository->store(
91  $this->obj->getId(),
92  ExportImportTypes::XML_WITH_RESULTS,
93  $rid
94  );
95  $this->export_options->getById('expxml')->onDeleteFiles(
96  $this->context,
97  $this->export_handler->consumer()->file()->identifier()->collection()->withElement(
98  $this->export_handler->consumer()->file()->identifier()->handler()->withIdentifier(
99  $element->getIRSSInfo()->getResourceIdSerialized()
100  )
101  )
102  );
103 
104  $this->tpl->setOnScreenMessage(
106  $this->lng->txt("exp_file_created"),
107  true
108  );
109  $this->ctrl->redirect($this, self::CMD_LIST_EXPORT_FILES);
110  }
+ Here is the call graph for this function:

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