ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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
 
- Protected Attributes inherited from ILIAS\Export\ExportHandler\Consumer\ExportOption\BasicLegacyHandler
ilCtrl $ctrl
 
ilDataFactory $data_factory
 

Detailed Description

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

Member Function Documentation

◆ getExportFiles()

ilMediaPoolExportOptionXMLMaster::getExportFiles ( string  $directory)
protected

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

References Vendor\Package\$e, getExportType(), and ILIAS\Repository\int().

Referenced by getFiles().

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

◆ getExportOptionId()

ilMediaPoolExportOptionXMLMaster::getExportOptionId ( )

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

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

◆ getExportType()

ilMediaPoolExportOptionXMLMaster::getExportType ( )

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

Referenced by getExportFiles().

40  : string
41  {
42  return 'xml_master';
43  }
+ Here is the caller graph for this function:

◆ getFiles()

ilMediaPoolExportOptionXMLMaster::getFiles ( ilExportHandlerConsumerContextInterface  $context)

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

References ilExport\_getExportDirectory(), and getExportFiles().

131  $collection_builder = $context->fileCollectionBuilder();
133  $context->exportObject()->getId(),
134  "",
135  $context->exportObject()->getType()
136  );
137  $dir = substr($dir, 0, strlen($dir) - 1);
138  $file_infos = $this->getExportFiles($dir);
139  $object_id = new ObjectId($context->exportObject()->getId());
140  foreach ($file_infos as $file_name => $file_info) {
141  $collection_builder = $collection_builder->withSPLFileInfo(
142  new SplFileInfo($dir . DIRECTORY_SEPARATOR . $file_info["file"]),
143  $object_id,
144  $this
145  );
146  }
147  return $collection_builder->collection();
148  }
$context
Definition: webdav.php:31
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object
+ Here is the call graph for this function:

◆ getLabel()

ilMediaPoolExportOptionXMLMaster::getLabel ( )

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

References ILIAS\Repository\lng().

55  : string
56  {
57  $this->lng->loadLanguageModule('exp');
58  return $this->lng->txt("exp_format_dropdown-xml") . " (" . $this->lng->txt("mep_master_language_only") . ")";
59  }
+ Here is the call graph for this function:

◆ getSupportedRepositoryObjectTypes()

ilMediaPoolExportOptionXMLMaster::getSupportedRepositoryObjectTypes ( )

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

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

◆ init()

ilMediaPoolExportOptionXMLMaster::init ( Container  $DIC)

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

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

34  : void
35  {
36  $this->lng = $DIC->language();
37  parent::init($DIC);
38  }
language()
Get interface to the i18n service.
Definition: Container.php:95
+ Here is the call graph for this function:

◆ isObjectSupported()

ilMediaPoolExportOptionXMLMaster::isObjectSupported ( ObjectId  $object_id)

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

References ilObjectTranslation\getInstance(), and ILIAS\Data\ObjectId\toInt().

Referenced by onExportOptionSelected().

152  : bool {
153  $ot = ilObjectTranslation::getInstance($object_id->toInt());
154  return $ot->getContentActivated();
155  }
static getInstance(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onDeleteFiles()

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

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

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

104  : void {
105  foreach ($file_identifiers as $file_identifier) {
106  $file = explode(":", $file_identifier->getIdentifier());
107  $file[1] = basename($file[1]);
108  $export_dir = ilExport::_getExportDirectory(
109  $context->exportObject()->getId(),
110  "",
111  $context->exportObject()->getType()
112  );
113  $export_dir = substr($export_dir, 0, strlen($export_dir) - 1);
114  $exp_file = $export_dir . "/" . str_replace("..", "", $file[1]);
115  $exp_dir = $export_dir . "/" . substr($file[1], 0, strlen($file[1]) - 4);
116  if (is_file($exp_file)) {
117  unlink($exp_file);
118  }
119  if (
120  is_dir($exp_dir) and
121  count(scandir($exp_dir)) === 2
122  ) {
123  ilFileUtils::delDir($exp_dir);
124  }
125  }
126  }
$context
Definition: webdav.php:31
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
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
+ Here is the call graph for this function:

◆ onDownloadFiles()

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

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

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

64  : void {
65  foreach ($file_identifiers as $file_identifier) {
66  $file = explode(":", trim($file_identifier->getIdentifier()));
67  $export_dir = ilExport::_getExportDirectory(
68  $context->exportObject()->getId(),
69  "",
70  $context->exportObject()->getType()
71  );
72  $export_dir = substr($export_dir, 0, strlen($export_dir) - 1);
73  $file[1] = basename($file[1]);
75  $export_dir . "/" . $file[1],
76  $file[1]
77  );
78  }
79  }
$context
Definition: webdav.php:31
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
+ Here is the call graph for this function:

◆ onDownloadWithLink()

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

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

References ilExport\_getExportDirectory(), ilObject\_lookupType(), ilFileDelivery\deliverFileLegacy(), and ILIAS\Data\ReferenceId\toObjectId().

84  : void {
85  $object_id = $reference_id->toObjectId()->toInt();
86  $type = ilObject::_lookupType($object_id);
87  $file = explode(":", trim($file_identifier->getIdentifier()));
88  $export_dir = ilExport::_getExportDirectory(
89  $object_id,
90  "",
91  $type
92  );
93  $export_dir = substr($export_dir, 0, strlen($export_dir) - 1);
94  $file[1] = basename($file[1]);
96  $export_dir . "/" . $file[1],
97  $file[1]
98  );
99  }
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ onExportOptionSelected()

ilMediaPoolExportOptionXMLMaster::onExportOptionSelected ( ilExportHandlerConsumerContextInterface  $context)

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

References ilExportGUI\CMD_LIST_EXPORT_FILES, ILIAS\Repository\ctrl(), isObjectSupported(), and ilUtil\stripSlashes().

159  : void {
160  if ($this->isObjectSupported(new ObjectId($context->exportObject()->getId()))) {
161  $opt = ilUtil::stripSlashes("master");
162  $context->exportObject()->exportXML($opt);
163  }
164  $this->ctrl->redirectByClass(ilExportGUI::class, ilExportGUI::CMD_LIST_EXPORT_FILES);
165  }
$context
Definition: webdav.php:31
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
const CMD_LIST_EXPORT_FILES
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilMediaPoolExportOptionXMLMaster::$lng
protected

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


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