ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilHTLMExportOptionHTML.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23use ILIAS\Export\ExportHandler\I\Consumer\Context\HandlerInterface as ilExportHandlerConsumerContextInterface;
28
29class ilHTLMExportOptionHTML extends ilLegacyExportOption
30{
31 protected ilCtrl $ctrl;
32 protected ilLanguage $lng;
33 protected IRSS $irss;
35
36 public function init(Container $DIC): void
37 {
38 $this->ctrl = $DIC->ctrl();
39 $this->lng = $DIC->language();
40 $this->irss = $DIC->resourceStorage();
41 $this->storage = $DIC->filesystem()->storage();
43 }
44
45 public function getExportType(): string
46 {
47 return "html";
48 }
49
50 public function getExportOptionId(): string
51 {
52 return "htlm_exp_option_html";
53 }
54
55 public function getSupportedRepositoryObjectTypes(): array
56 {
57 return ["htlm"];
58 }
59
60 public function getLabel(): string
61 {
62 $this->lng->loadLanguageModule('exp');
63 return $this->lng->txt("exp_format_dropdown-html");
64 }
65
66 public function onExportOptionSelected(
67 ilExportHandlerConsumerContextInterface $context
68 ): void {
69 $object = $context->exportObject();
70
72 $object->getId(),
73 "html",
74 $object->getType()
75 );
77 $object->getId(),
78 "html",
79 $object->getType()
80 );
81
82 // write files as zip to legacy storage
83 $date = time();
84 $zip_file = LegacyPathHelper::createRelativePath(
85 $export_dir . "/" . $date . "__" . IL_INST_ID . "__" .
86 $object->getType() . "_" . $object->getId() . ".zip"
87 );
88
89 $stream = $this->irss->consume()->stream($object->getResource()->getIdentification())->getStream();
90 $this->storage->writeStream($zip_file, $stream);
91
92 $this->ctrl->redirect($context->exportGUIObject(), $context->exportGUIObject()::CMD_LIST_EXPORT_FILES);
93 }
94}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
language()
Get interface to the i18n service.
Definition: Container.php:95
ctrl()
Get the interface to the control structure.
Definition: Container.php:63
The legacy path helper provides convenient functions for the integration of the filesystem service wi...
Class ilCtrl provides processing control methods.
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
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
onExportOptionSelected(ilExportHandlerConsumerContextInterface $context)
language handling
const IL_INST_ID
Definition: constants.php:40
The filesystem interface provides the public interface for the Filesystem service API consumer.
Definition: Filesystem.php:37
global $DIC
Definition: shib_login.php:26
$context
Definition: webdav.php:31