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

Public Member Functions

 init (Container $DIC)
 
 getExportType ()
 
 getExportOptionId ()
 
 getSupportedRepositoryObjectTypes ()
 
 getLabel ()
 
 onDownloadFiles (ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
 
 onDownloadWithLink (ReferenceId $reference_id, ilExportHandlerConsumerFileIdentifierInterface $file_identifier)
 
 onDeleteFiles (ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
 
 getFiles (ilExportHandlerConsumerContextInterface $context)
 
 isObjectSupported (ObjectId $object_id)
 
 onExportOptionSelected (ilExportHandlerConsumerContextInterface $context)
 
- 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)
 

Protected Attributes

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

Detailed Description

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

Member Function Documentation

◆ getExportFiles()

ilMediaPoolExportOptionXMLMaster::getExportFiles ( string  $directory)
protected

Definition at line 170 of file class.ilMediaPoolExportOptionXMLMaster.php.

172 : array {
173 $file = [];
174 try {
175 $h_dir = dir($directory);
176 while ($entry = $h_dir->read()) {
177 if (
178 $entry !== "." &&
179 $entry !== ".." &&
180 substr($entry, - 4) === ".zip"
181 ) {
182 $ts = substr($entry, 0, strpos($entry, "__"));
183 $file[$entry . $this->getExportType()] = [
184 "type" => $this->getExportType(),
185 "file" => $entry,
186 "size" => (int) filesize($directory . "/" . $entry),
187 "timestamp" => (int) $ts
188 ];
189 }
190 }
191 } catch (Exception $e) {
192
193 }
194 return $file;
195 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getExportOptionId()

ilMediaPoolExportOptionXMLMaster::getExportOptionId ( )

Definition at line 48 of file class.ilMediaPoolExportOptionXMLMaster.php.

48 : string
49 {
50 return 'mep_exp_option_xml_master';
51 }

◆ getExportType()

ilMediaPoolExportOptionXMLMaster::getExportType ( )

Definition at line 43 of file class.ilMediaPoolExportOptionXMLMaster.php.

43 : string
44 {
45 return 'xml_master';
46 }

◆ getFiles()

ilMediaPoolExportOptionXMLMaster::getFiles ( ilExportHandlerConsumerContextInterface  $context)

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

Definition at line 131 of file class.ilMediaPoolExportOptionXMLMaster.php.

134 $collection_builder = $context->fileCollectionBuilder();
136 $context->exportObject()->getId(),
137 "",
138 $context->exportObject()->getType()
139 );
140 $dir = substr($dir, 0, strlen($dir) - 1);
141 $file_infos = $this->getExportFiles($dir);
142 $object_id = new ObjectId($context->exportObject()->getId());
143 foreach ($file_infos as $file_name => $file_info) {
144 $collection_builder = $collection_builder->withSPLFileInfo(
145 new SplFileInfo($dir . DIRECTORY_SEPARATOR . $file_info["file"]),
146 $object_id,
147 $this
148 );
149 }
150 return $collection_builder->collection();
151 }
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
$context
Definition: webdav.php:31

◆ getLabel()

ilMediaPoolExportOptionXMLMaster::getLabel ( )

Definition at line 58 of file class.ilMediaPoolExportOptionXMLMaster.php.

58 : string
59 {
60 $this->lng->loadLanguageModule('exp');
61 return $this->lng->txt("exp_format_dropdown-xml") . " (" . $this->lng->txt("mep_master_language_only") . ")";
62 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getSupportedRepositoryObjectTypes()

ilMediaPoolExportOptionXMLMaster::getSupportedRepositoryObjectTypes ( )

Definition at line 53 of file class.ilMediaPoolExportOptionXMLMaster.php.

53 : array
54 {
55 return ['mep'];
56 }

◆ init()

ilMediaPoolExportOptionXMLMaster::init ( Container  $DIC)

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

Definition at line 36 of file class.ilMediaPoolExportOptionXMLMaster.php.

36 : void
37 {
38 $this->lng = $DIC->language();
39 $this->db = $DIC->database();
41 }
language()
Get interface to the i18n service.
Definition: Container.php:95
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

◆ isObjectSupported()

ilMediaPoolExportOptionXMLMaster::isObjectSupported ( ObjectId  $object_id)

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

Definition at line 153 of file class.ilMediaPoolExportOptionXMLMaster.php.

155 : bool {
156 $ot = (new TranslationsRepository($this->db))->getFor($object_id->toInt());
157 return $ot->getContentTranslationActivated();
158 }

◆ onDeleteFiles()

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

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

Definition at line 104 of file class.ilMediaPoolExportOptionXMLMaster.php.

107 : void {
108 foreach ($file_identifiers as $file_identifier) {
109 $file = explode(":", $file_identifier->getIdentifier());
110 $file[1] = basename($file[1]);
111 $export_dir = ilExport::_getExportDirectory(
112 $context->exportObject()->getId(),
113 "",
114 $context->exportObject()->getType()
115 );
116 $export_dir = substr($export_dir, 0, strlen($export_dir) - 1);
117 $exp_file = $export_dir . "/" . str_replace("..", "", $file[1]);
118 $exp_dir = $export_dir . "/" . substr($file[1], 0, strlen($file[1]) - 4);
119 if (is_file($exp_file)) {
120 unlink($exp_file);
121 }
122 if (
123 is_dir($exp_dir) and
124 count(scandir($exp_dir)) === 2
125 ) {
126 ilFileUtils::delDir($exp_dir);
127 }
128 }
129 }
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:

◆ onDownloadFiles()

ilMediaPoolExportOptionXMLMaster::onDownloadFiles ( ilExportHandlerConsumerContextInterface  $context,
ilExportHandlerConsumerFileIdentifierCollectionInterface  $file_identifiers 
)

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

Definition at line 64 of file class.ilMediaPoolExportOptionXMLMaster.php.

67 : void {
68 foreach ($file_identifiers as $file_identifier) {
69 $file = explode(":", trim($file_identifier->getIdentifier()));
71 $context->exportObject()->getId(),
72 "",
73 $context->exportObject()->getType()
74 );
75 $export_dir = substr($export_dir, 0, strlen($export_dir) - 1);
76 $file[1] = basename($file[1]);
78 $export_dir . "/" . $file[1],
79 $file[1]
80 );
81 }
82 }
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)

References $context, ilExport\_getExportDirectory(), and ilFileDelivery\deliverFileLegacy().

+ Here is the call graph for this function:

◆ onDownloadWithLink()

ilMediaPoolExportOptionXMLMaster::onDownloadWithLink ( ReferenceId  $reference_id,
ilExportHandlerConsumerFileIdentifierInterface  $file_identifier 
)

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

Definition at line 84 of file class.ilMediaPoolExportOptionXMLMaster.php.

87 : void {
88 $object_id = $reference_id->toObjectId()->toInt();
89 $type = ilObject::_lookupType($object_id);
90 $file = explode(":", trim($file_identifier->getIdentifier()));
92 $object_id,
93 "",
94 $type
95 );
96 $export_dir = substr($export_dir, 0, strlen($export_dir) - 1);
97 $file[1] = basename($file[1]);
99 $export_dir . "/" . $file[1],
100 $file[1]
101 );
102 }
static _lookupType(int $id, bool $reference=false)

◆ onExportOptionSelected()

ilMediaPoolExportOptionXMLMaster::onExportOptionSelected ( ilExportHandlerConsumerContextInterface  $context)

Definition at line 160 of file class.ilMediaPoolExportOptionXMLMaster.php.

162 : void {
163 if ($this->isObjectSupported(new ObjectId($context->exportObject()->getId()))) {
164 $opt = ilUtil::stripSlashes("master");
165 $context->exportObject()->exportXML($opt);
166 }
167 $this->ctrl->redirectByClass(ilExportGUI::class, ilExportGUI::CMD_LIST_EXPORT_FILES);
168 }
const CMD_LIST_EXPORT_FILES
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References $context, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilMediaPoolExportOptionXMLMaster::$db
protected

Definition at line 34 of file class.ilMediaPoolExportOptionXMLMaster.php.

◆ $lng

ilLanguage ilMediaPoolExportOptionXMLMaster::$lng
protected

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


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