ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWikiExportOptionHTMLWithComments.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24use ILIAS\Export\ExportHandler\I\Consumer\Context\HandlerInterface as ilExportHandlerConsumerContextInterface;
26use ILIAS\Export\ExportHandler\I\Info\File\CollectionInterface as ilExportHandlerFileInfoCollectionInterface;
27use ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\CollectionInterface as ilExportHandlerConsumerFileIdentifierCollectionInterface;
28use ILIAS\Export\ExportHandler\I\Consumer\File\Identifier\HandlerInterface as ilExportHandlerConsumerFileIdentifierInterface;
30
31class ilWikiExportOptionHTMLWithComments extends ilBasicLegacyExportOption
32{
33 protected ilLanguage $lng;
34
35 public function init(Container $DIC): void
36 {
37 $this->lng = $DIC->language();
39 }
40
41 public function getExportType(): string
42 {
43 return 'html_comments';
44 }
45
46 public function getExportOptionId(): string
47 {
48 return 'wiki_exp_option_html_with_comments';
49 }
50
51 public function getSupportedRepositoryObjectTypes(): array
52 {
53 return ['wiki'];
54 }
55
56 public function getLabel(): string
57 {
58 $this->lng->loadLanguageModule('exp');
59 return $this->lng->txt("exp_format_dropdown-html") . " (" . $this->lng->txt("wiki_incl_comments") . ")";
60 }
61
62 public function isObjectSupported(ObjectId $object_id): bool
63 {
64 try {
65 return (
66 ilObjWiki::_exists($object_id->toInt()) and
67 (new ilObjWiki($object_id->toInt(), false))->isCommentsExportPossible()
68 );
69 } catch (ilObjectTypeMismatchException $exception) {
70 return false;
71 }
72 }
73
74 public function onExportOptionSelected(ilExportHandlerConsumerContextInterface $context): void
75 {
77 $wiki = $context->exportObject();
78 $cont_exp = new WikiHtmlExport($wiki);
79 $cont_exp->setMode(WikiHtmlExport::MODE_COMMENTS);
80 $cont_exp->buildExportFile();
81 $this->ctrl->redirectByClass(ilExportGUI::class, ilExportGUI::CMD_LIST_EXPORT_FILES);
82 }
83}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
language()
Get interface to the i18n service.
Definition: Container.php:95
Wiki HTML exporter class.
const CMD_LIST_EXPORT_FILES
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
global $DIC
Definition: shib_login.php:26
$context
Definition: webdav.php:31