ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilMediaPoolExportOptionXMLMasterNoMedia Class Reference
+ Inheritance diagram for ilMediaPoolExportOptionXMLMasterNoMedia:
+ Collaboration diagram for ilMediaPoolExportOptionXMLMasterNoMedia:

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 Attributes

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

Detailed Description

Member Function Documentation

◆ getExportOptionId()

ilMediaPoolExportOptionXMLMasterNoMedia::getExportOptionId ( )

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

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

◆ getExportType()

ilMediaPoolExportOptionXMLMasterNoMedia::getExportType ( )

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

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

◆ getFiles()

ilMediaPoolExportOptionXMLMasterNoMedia::getFiles ( ilExportHandlerConsumerContextInterface  $context)

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

133  : ilExportHandlerFileInfoCollectionInterface {
134  # The export files of ilMediaPoolExportOptionXMLMaster and ilMediaPoolExportOptionXMLMasterNoMedia
135  # cannot be differentiated, therefore only ilMediaPoolExportOptionXMLMaster returns files.
136  return $context->fileCollectionBuilder()->collection();
137  }
$context
Definition: webdav.php:31

◆ getLabel()

ilMediaPoolExportOptionXMLMasterNoMedia::getLabel ( )

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

References ILIAS\Repository\lng().

58  : string
59  {
60  $this->lng->loadLanguageModule('exp');
61  return "XML (" . $this->lng->txt("mep_master_language_only_no_media") . ")";
62  }
+ Here is the call graph for this function:

◆ getSupportedRepositoryObjectTypes()

ilMediaPoolExportOptionXMLMasterNoMedia::getSupportedRepositoryObjectTypes ( )

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

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

◆ init()

ilMediaPoolExportOptionXMLMasterNoMedia::init ( Container  $DIC)

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

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

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

◆ isObjectSupported()

ilMediaPoolExportOptionXMLMasterNoMedia::isObjectSupported ( ObjectId  $object_id)

Definition at line 139 of file class.ilMediaPoolExportOptionXMLMasterNoMedia.php.

References ILIAS\Data\ObjectId\toInt().

Referenced by onExportOptionSelected().

139  : bool
140  {
141  $ot = (new TranslationsRepository($this->db))->getFor($object_id->toInt());
142  return $ot->getContentTranslationActivated();
143  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onDeleteFiles()

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

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

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

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  }
$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()

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

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

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

67  : void {
68  foreach ($file_identifiers as $file_identifier) {
69  $file = explode(":", trim($file_identifier->getIdentifier()));
70  $export_dir = ilExport::_getExportDirectory(
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  }
$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()

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

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

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

87  : void {
88  $object_id = $reference_id->toObjectId()->toInt();
89  $type = ilObject::_lookupType($object_id);
90  $file = explode(":", trim($file_identifier->getIdentifier()));
91  $export_dir = ilExport::_getExportDirectory(
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 _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()

ilMediaPoolExportOptionXMLMasterNoMedia::onExportOptionSelected ( ilExportHandlerConsumerContextInterface  $context)

Definition at line 145 of file class.ilMediaPoolExportOptionXMLMasterNoMedia.php.

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

145  : void
146  {
147  if ($this->isObjectSupported(new ObjectId($context->exportObject()->getId()))) {
148  $opt = ilUtil::stripSlashes("masternomedia");
149  $context->exportObject()->exportXML($opt);
150  }
151  $this->ctrl->redirectByClass(ilExportGUI::class, ilExportGUI::CMD_LIST_EXPORT_FILES);
152  }
$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

◆ $db

ilDBInterface ilMediaPoolExportOptionXMLMasterNoMedia::$db
protected

◆ $lng

ilLanguage ilMediaPoolExportOptionXMLMasterNoMedia::$lng
protected

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