ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWebDAVMountInstructionsModalGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24
26{
27 private const MOUNT_INSTRUCTIONS_CONTENT_ID = 'webdav_mount_instructions_content';
29
30 private function __construct(
31 protected ilWebDAVMountInstructionsRepositoryImpl $repository,
32 protected Factory $ui_factory,
33 protected Renderer $ui_renderer,
34 protected ilLanguage $lng
35 ) {
36 try {
37 $document = $this->repository->getMountInstructionsByLanguage($this->lng->getUserLanguage());
38 $title = $document->getTitle();
39 } catch (InvalidArgumentException) {
40 $title = $this->lng->txt('webfolder_instructions_titletext');
41 }
42
43 $content_div = '<div id="' . self::MOUNT_INSTRUCTIONS_CONTENT_ID . '"></div>';
44 $page = $this->ui_factory->modal()->lightboxTextPage($content_div, $title);
45 $this->modal = $this->ui_factory->modal()->lightbox($page);
46 }
47
48 private function getRenderedModal(): string
49 {
50 return $this->ui_renderer->render($this->modal);
51 }
52
53 private function getModalShowSignalId(): string
54 {
55 return $this->modal->getShowSignal()->getId();
56 }
57
58 private static bool $modal_already_rendered = false;
59
60 public static function maybeRenderWebDAVModalInGlobalTpl(): void
61 {
62 if (self::$modal_already_rendered) {
63 return;
64 }
65
66 global $DIC;
67 $repository = new ilWebDAVMountInstructionsRepositoryImpl($DIC->database());
69 $repository,
70 $DIC->ui()->factory(),
71 $DIC->ui()->renderer(),
72 $DIC->language()
73 );
74
75 self::$modal_already_rendered = true;
76 $js_function = '<script>function triggerWebDAVModal(api_url){ $.ajax(api_url).done(function(data){ $(document).trigger("' . $instance->getModalShowSignalId(
77 ) . '", "{}"); $("#' . self::MOUNT_INSTRUCTIONS_CONTENT_ID . '").html(data);}) }</script>';
78
79 $webdav_modal_html = $instance->getRenderedModal() . $js_function;
80
81 $tpl = $DIC->ui()->mainTemplate();
82 $tpl->setVariable('WEBDAV_MODAL', $webdav_modal_html);
83 }
84}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
language handling
__construct(protected ilWebDAVMountInstructionsRepositoryImpl $repository, protected Factory $ui_factory, protected Renderer $ui_renderer, protected ilLanguage $lng)
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
modal(string $title="", string $cancel_label="")
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26