ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilSkillExportOption Class Reference
+ Inheritance diagram for ilSkillExportOption:
+ Collaboration diagram for ilSkillExportOption:

Public Member Functions

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

Protected Attributes

ILIAS Data Factory $data_factory
 

Detailed Description

Definition at line 29 of file class.ilSkillExportOption.php.

Member Function Documentation

◆ getExportOptionId()

ilSkillExportOption::getExportOptionId ( )

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

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

◆ getExportType()

ilSkillExportOption::getExportType ( )

Definition at line 38 of file class.ilSkillExportOption.php.

38  : string
39  {
40  return 'xml';
41  }

◆ getFiles()

ilSkillExportOption::getFiles ( ilExportHandlerConsumerContextInterface  $context)

Definition at line 97 of file class.ilSkillExportOption.php.

References ilExport\_getExportDirectory().

Referenced by getFileSelection().

99  : ilExportHandlerFileInfoCollectionInterface {
100  $collection_builder = $context->fileCollectionBuilder();
101  $export_dir = ilExport::_getExportDirectory($context->exportObject()->getId(), "xml", 'skmg');
102  $file_names = file_exists($export_dir) ? scandir($export_dir) : [];
103  foreach ($file_names as $file_name) {
104  if (in_array($file_name, ['.', '..'])) {
105  continue;
106  }
107  $collection_builder = $collection_builder->withSPLFileInfo(
108  new SplFileInfo($export_dir . DIRECTORY_SEPARATOR . $file_name),
109  $this->data_factory->objId($context->exportObject()->getId()),
110  $this
111  );
112  }
113  return $collection_builder->collection();
114  }
$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:
+ Here is the caller graph for this function:

◆ getFileSelection()

ilSkillExportOption::getFileSelection ( ilExportHandlerConsumerContextInterface  $context,
ilExportHandlerConsumerFileIdentifierCollectionInterface  $file_identifiers 
)

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

References getFiles().

Referenced by onDeleteFiles(), and onDownloadFiles().

119  : ilExportHandlerFileInfoCollectionInterface {
120  $collection_builder = $context->fileCollectionBuilder();
121  foreach ($this->getFiles($context) as $file_info) {
122  if (!in_array($file_info->getFileIdentifier(), $file_identifiers->toStringArray())) {
123  continue;
124  }
125  $collection_builder = $collection_builder->withFileInfo($file_info);
126  }
127  return $collection_builder->collection();
128  }
$context
Definition: webdav.php:31
getFiles(ilExportHandlerConsumerContextInterface $context)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLabel()

ilSkillExportOption::getLabel ( )

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

53  : string
54  {
55  # Return an empty label so that the export button is not displayed in the export tab.
56  return '';
57  }

◆ getSupportedRepositoryObjectTypes()

ilSkillExportOption::getSupportedRepositoryObjectTypes ( )

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

48  : array
49  {
50  return ['skee'];
51  }

◆ init()

ilSkillExportOption::init ( Container  $DIC)

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

33  : void
34  {
35  $this->data_factory = new \ILIAS\Data\Factory();
36  }

◆ onDeleteFiles()

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

Definition at line 65 of file class.ilSkillExportOption.php.

References getFileSelection().

68  : void {
69  foreach ($this->getFileSelection($context, $file_identifiers) as $file) {
70  $exp_dir = $file->getDownloadInfo();
71  $file_path = $file->getDownloadInfo() . DIRECTORY_SEPARATOR . $file->getFileName();
72  if (is_file($file_path)) {
73  unlink($file_path);
74  }
75  }
76  }
getFileSelection(ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
$context
Definition: webdav.php:31
+ Here is the call graph for this function:

◆ onDownloadFiles()

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

Definition at line 78 of file class.ilSkillExportOption.php.

References ilFileDelivery\deliverFileLegacy(), and getFileSelection().

81  : void {
82  foreach ($this->getFileSelection($context, $file_identifiers) as $file) {
84  $file->getDownloadInfo() . DIRECTORY_SEPARATOR . $file->getFileName(),
85  $file->getFileName()
86  );
87  }
88  }
getFileSelection(ilExportHandlerConsumerContextInterface $context, ilExportHandlerConsumerFileIdentifierCollectionInterface $file_identifiers)
$context
Definition: webdav.php:31
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()

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

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

93  : void {
94 
95  }

◆ onExportOptionSelected()

ilSkillExportOption::onExportOptionSelected ( ilExportHandlerConsumerContextInterface  $context)

Definition at line 59 of file class.ilSkillExportOption.php.

61  : void {
62  # Do nothing, the export happens in another tab.
63  }

Field Documentation

◆ $data_factory

ILIAS Data Factory ilSkillExportOption::$data_factory
protected

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


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