ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilWebDAVMountInstructionsModalGUI.php
Go to the documentation of this file.
1<?php
2
7{
11 public const MOUNT_INSTRUCTIONS_CONTENT_ID = 'webdav_mount_instructions_content';
12
19 public function __construct(ILIAS\UI\Factory $a_ui_factory, ILIAS\UI\Renderer $a_ui_renderer, ilLanguage $a_lng)
20 {
21 global $DIC;
23 $this->ui_factory = $a_ui_factory;
24 $this->ui_renderer = $a_ui_renderer;
25 $this->lng = $a_lng;
26
27 try {
28 $document = $this->repository->getMountInstructionsByLanguage($this->lng->getUserLanguage());
29 $title = $document->getTitle();
30 } catch (InvalidArgumentException $e) {
31 $title = $this->lng->txt('webfolder_instructions_titletext');
32 }
33
34 $content_div = '<div id="' . self::MOUNT_INSTRUCTIONS_CONTENT_ID . '"></div>';
35 $page = $this->ui_factory->modal()->lightboxTextPage($content_div, $title);
36 $this->modal = $this->ui_factory->modal()->lightbox($page);
37 }
38
42 public function getRenderedModal()
43 {
44 return $this->ui_renderer->render($this->modal);
45 }
46
50 public function getModalShowSignalId()
51 {
52 return $this->modal->getShowSignal()->getId();
53 }
54
56 private static $instance = null;
57 private static $modal_already_rendered = false;
58
63 public static function maybeRenderWebDAVModalInGlobalTpl()
64 {
65 global $DIC;
66 if (!self::$modal_already_rendered) {
67 if (self::$instance == null) {
68 global $DIC;
69 self::$instance = new ilWebDAVMountInstructionsModalGUI($DIC->ui()->factory(), $DIC->ui()->renderer(), $DIC->language());
70 }
71
72 self::$modal_already_rendered = true;
73 $js_function = '<script>function triggerWebDAVModal(api_url){ $.ajax(api_url).done(function(data){ $(document).trigger("' . self::$instance->getModalShowSignalId() . '", "{}"); $("#' . self::MOUNT_INSTRUCTIONS_CONTENT_ID . '").html(data);}) }</script>';
74
75 $webdav_modal_html = self::$instance->getRenderedModal() . $js_function;
76
77 $tpl = $DIC->ui()->mainTemplate();
78 $tpl->setVariable('WEBDAV_MODAL', $webdav_modal_html);
79 }
80 }
81}
An exception for terminatinating execution or to throw for unit testing.
language handling
Class ilWebDAVMountInstructionsModalGUI.
__construct(ILIAS\UI\Factory $a_ui_factory, ILIAS\UI\Renderer $a_ui_renderer, ilLanguage $a_lng)
ilWebDAVMountInstructionsModalGUI constructor.
static maybeRenderWebDAVModalInGlobalTpl()
This is kind of a singleton pattern.
global $DIC
Definition: goto.php:24
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
modal()
This second example shows a scenario in which the Close Button is used in an overlay as indicated in ...
Definition: modal.php:7
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
repository()
Definition: repository.php:5