ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDataCollectionExportOptionsXLSX Class Reference
+ Inheritance diagram for ilDataCollectionExportOptionsXLSX:
+ Collaboration diagram for ilDataCollectionExportOptionsXLSX:

Public Member Functions

 init (Container $DIC)
 
 getExportType ()
 
 getExportOptionId ()
 
 getSupportedRepositoryObjectTypes ()
 
 getLabel ()
 
 getFiles (ilExportHandlerConsumerContextInterface $context)
 
 onExportOptionSelected (ilExportHandlerConsumerContextInterface $context)
 
 onDeleteFiles (ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
 
- Public Member Functions inherited from ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicLegacyHandler
 init (Container $DIC)
 
 onDeleteFiles (ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
 
 onDownloadFiles (ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
 
 onDownloadWithLink (ReferenceId $reference_id, ilExportHandlerConsumerFileIdentifierInterface $file_identifier)
 
 getFileSelection (ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
 
 getFiles (ilExportHandlerConsumerContextInterface $context)
 
- Public Member Functions inherited from ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicHandler
 __construct ()
 
 isObjectSupported (ObjectId $object_id)
 
 isPublicAccessPossible ()
 

Protected Member Functions

 getExportFiles (string $directory)
 
 checkForAsyncEnabled (ilExportHandlerConsumerContextInterface $context)
 

Protected Attributes

ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
- Protected Attributes inherited from ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicLegacyHandler
ilCtrl $ctrl
 
ilDataFactory $data_factory
 

Detailed Description

Definition at line 28 of file class.ilDataCollectionExportOptionsXLSX.php.

Member Function Documentation

◆ checkForAsyncEnabled()

ilDataCollectionExportOptionsXLSX::checkForAsyncEnabled ( ilExportHandlerConsumerContextInterface  $context)
protected

Definition at line 162 of file class.ilDataCollectionExportOptionsXLSX.php.

164 : bool {
165 global $DIC;
166 if ($DIC->settings()->get('soap_user_administration', '0') === '1') {
167 return true;
168 }
169
170 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_no_export_async_config'), true);
171 $this->ctrl->redirect($context->exportGUIObject(), "listExportFiles");
172
173 return false;
174 }
global $DIC
Definition: shib_login.php:26
$context
Definition: webdav.php:31

◆ getExportFiles()

ilDataCollectionExportOptionsXLSX::getExportFiles ( string  $directory)
protected

Definition at line 116 of file class.ilDataCollectionExportOptionsXLSX.php.

118 : array {
119 $file = [];
120 try {
121 $h_dir = dir($directory);
122 while ($entry = $h_dir->read()) {
123 if (
124 $entry !== "." &&
125 $entry !== ".." &&
126 substr($entry, -5) === "." . $this->getExportType()
127 ) {
128 $ts = substr($entry, 0, strpos($entry, "__"));
129 $file[$entry . $this->getExportType()] = [
130 "type" => $this->getExportType(),
131 "file" => $entry,
132 "size" => (int) filesize($directory . "/" . $entry),
133 "timestamp" => (int) $ts
134 ];
135 }
136 }
137 } catch (Exception $e) {
138 }
139 return $file;
140 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getExportOptionId()

ilDataCollectionExportOptionsXLSX::getExportOptionId ( )

Definition at line 45 of file class.ilDataCollectionExportOptionsXLSX.php.

45 : string
46 {
47 return 'dcl_exp_option_xlsx';
48 }

◆ getExportType()

ilDataCollectionExportOptionsXLSX::getExportType ( )

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

40 : string
41 {
42 return 'xlsx';
43 }

◆ getFiles()

ilDataCollectionExportOptionsXLSX::getFiles ( ilExportHandlerConsumerContextInterface  $context)

Reimplemented from ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicLegacyHandler.

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

62 : ilExportHandlerFileInfoCollectionInterface {
63 $collection_builder = $context->fileCollectionBuilder();
65 $context->exportObject()->getId(),
66 $this->getExportType(),
67 $context->exportObject()->getType()
68 );
69 $file_infos = $this->getExportFiles($dir);
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"]),
74 $object_id,
75 $this
76 );
77 }
78 return $collection_builder->collection();
79 }
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

◆ getLabel()

ilDataCollectionExportOptionsXLSX::getLabel ( )

Definition at line 55 of file class.ilDataCollectionExportOptionsXLSX.php.

55 : string
56 {
57 return $this->lng->txt('dcl_xls_async_export');
58 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getSupportedRepositoryObjectTypes()

ilDataCollectionExportOptionsXLSX::getSupportedRepositoryObjectTypes ( )

Definition at line 50 of file class.ilDataCollectionExportOptionsXLSX.php.

50 : array
51 {
52 return ['dcl'];
53 }

◆ init()

ilDataCollectionExportOptionsXLSX::init ( Container  $DIC)

Reimplemented from ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicLegacyHandler.

Definition at line 33 of file class.ilDataCollectionExportOptionsXLSX.php.

33 : void
34 {
35 $this->lng = $DIC->language();
36 $this->tpl = $DIC->ui()->mainTemplate();
38 }
language()
Get interface to the i18n service.
Definition: Container.php:95

References $DIC, init(), ILIAS\DI\Container\language(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ onDeleteFiles()

ilDataCollectionExportOptionsXLSX::onDeleteFiles ( ilExportHandlerConsumerContextInterface  $context,
ilExportHandlerConsumerFileIdentifierCollectionInterface  $file_identifiers 
)

Reimplemented from ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicLegacyHandler.

Definition at line 90 of file class.ilDataCollectionExportOptionsXLSX.php.

93 : void {
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()
101 );
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)) {
105 unlink($exp_file);
106 }
107 if (
108 is_dir($exp_dir) and
109 count(scandir($exp_dir)) === 2
110 ) {
111 ilFileUtils::delDir($exp_dir);
112 }
113 }
114 }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

References $context, ilExport\_getExportDirectory(), and ilFileUtils\delDir().

+ Here is the call graph for this function:

◆ onExportOptionSelected()

ilDataCollectionExportOptionsXLSX::onExportOptionSelected ( ilExportHandlerConsumerContextInterface  $context)

Definition at line 81 of file class.ilDataCollectionExportOptionsXLSX.php.

83 : void {
84 if (!$this->checkForExportableFields($context) || !$this->checkForAsyncEnabled($context)) {
85 return;
86 }
87 $this->ctrl->redirectByClass(ilObjDataCollectionGUI::class, "handleExportAsync");
88 }
checkForAsyncEnabled(ilExportHandlerConsumerContextInterface $context)

Field Documentation

◆ $lng

ilLanguage ilDataCollectionExportOptionsXLSX::$lng
protected

Definition at line 30 of file class.ilDataCollectionExportOptionsXLSX.php.

◆ $tpl

ilGlobalTemplateInterface ilDataCollectionExportOptionsXLSX::$tpl
protected

Definition at line 31 of file class.ilDataCollectionExportOptionsXLSX.php.


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