19 declare(strict_types=1);
36 $this->tpl = $DIC->
ui()->mainTemplate();
47 return 'dcl_exp_option_xlsx';
57 return $this->
lng->txt(
'dcl_xls_async_export');
61 ilExportHandlerConsumerContextInterface
$context 62 ): ilExportHandlerFileInfoCollectionInterface {
63 $collection_builder = $context->fileCollectionBuilder();
65 $context->exportObject()->getId(),
67 $context->exportObject()->getType()
70 $object_id =
new ObjectId($context->exportObject()->getId());
71 foreach ($file_infos as $file_name => $file_info) {
72 $collection_builder = $collection_builder->withSPLFileInfo(
73 new SplFileInfo($dir . DIRECTORY_SEPARATOR . $file_info[
"file"]),
78 return $collection_builder->collection();
82 ilExportHandlerConsumerContextInterface
$context 84 if (!$this->checkForExportableFields($context)) {
87 $this->
ctrl->redirectByClass(ilObjDataCollectionGUI::class,
"handleExportAsync");
91 ilExportHandlerConsumerContextInterface
$context,
92 ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers
94 foreach ($file_identifiers as $file_identifier) {
95 $file = explode(
":", $file_identifier->getIdentifier());
96 $file[1] = basename($file[1]);
98 $context->exportObject()->getId(),
99 str_replace(
"..",
"", $file[0]),
100 $context->exportObject()->getType()
102 $exp_file = $export_dir .
"/" . str_replace(
"..",
"", $file[1]);
103 $exp_dir = $export_dir .
"/" . substr($file[1], 0, strlen($file[1]) - 5);
104 if (is_file($exp_file)) {
109 count(scandir($exp_dir)) === 2
121 $h_dir = dir($directory);
122 while ($entry = $h_dir->read()) {
128 $ts = substr($entry, 0, strpos($entry,
"__"));
132 "size" => (
int) filesize($directory .
"/" . $entry),
133 "timestamp" => (
int) $ts
142 protected function checkForExportableFields(
143 ilExportHandlerConsumerContextInterface
$context 145 $obj = $context->exportObject();
147 foreach ($obj->getTables() as $tbl) {
149 foreach ($tbl->getFields() as $field) {
150 if ($field->getExportable()) {
156 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_no_export_data_available'),
true);
157 $this->
ctrl->redirect($context->exportGUIObject(),
"listExportFiles");
onDeleteFiles(ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
onExportOptionSelected(ilExportHandlerConsumerContextInterface $context)
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object
Customizing of pimple-DIC for ILIAS.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
language()
Get interface to the i18n service.
getSupportedRepositoryObjectTypes()
ilGlobalTemplateInterface $tpl
getFiles(ilExportHandlerConsumerContextInterface $context)
getExportFiles(string $directory)
ui()
Get the interface to get services from UI framework.