19declare(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();
66 $this->getExportType(),
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) || !$this->checkForAsyncEnabled(
$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]);
99 str_replace(
"..",
"", $file[0]),
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()) {
126 substr($entry, -5) ===
"." . $this->getExportType()
128 $ts = substr($entry, 0, strpos($entry,
"__"));
129 $file[$entry . $this->getExportType()] = [
130 "type" => $this->getExportType(),
132 "size" => (
int) filesize($directory .
"/" . $entry),
133 "timestamp" => (
int) $ts
137 }
catch (Exception
$e) {
142 protected function checkForExportableFields(
143 ilExportHandlerConsumerContextInterface
$context
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");
163 ilExportHandlerConsumerContextInterface
$context
166 if (
$DIC->settings()->get(
'soap_user_administration',
'0') ===
'1') {
170 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_no_export_async_config'),
true);
171 $this->
ctrl->redirect($context->exportGUIObject(),
"listExportFiles");
Customizing of pimple-DIC for ILIAS.
language()
Get interface to the i18n service.
ilGlobalTemplateInterface $tpl
getSupportedRepositoryObjectTypes()
checkForAsyncEnabled(ilExportHandlerConsumerContextInterface $context)
getFiles(ilExportHandlerConsumerContextInterface $context)
onDeleteFiles(ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
getExportFiles(string $directory)
onExportOptionSelected(ilExportHandlerConsumerContextInterface $context)
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
@depricated Get export directory for an repository object
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
if(!file_exists('../ilias.ini.php'))