ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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;
22  $this->repository = new ilWebDAVMountInstructionsRepositoryImpl($DIC->database());
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 }
Class Factory.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static maybeRenderWebDAVModalInGlobalTpl()
This is kind of a singleton pattern.
Class ChatMainBarProvider .
const MOUNT_INSTRUCTIONS_CONTENT_ID
ID of the -element, which contains the mount instructions.
repository()
Definition: repository.php:5
__construct(ILIAS\UI\Factory $a_ui_factory, ILIAS\UI\Renderer $a_ui_renderer, ilLanguage $a_lng)
ilWebDAVMountInstructionsModalGUI constructor.
$DIC
Definition: xapitoken.php:46
language handling
Class ilWebDAVMountInstructionsModalGUI.