ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ExportHelperGUI.php
Go to the documentation of this file.
1<?php
2
20
26{
27 protected \ilLanguage $lng;
28 protected \ILIAS\DI\UIServices $ui;
29
30 public function __construct()
31 {
32 global $DIC;
33 $this->lng = $DIC->language();
34 $this->ui = $DIC->ui();
35 }
36
38 string $title,
39 string $message,
40 string $export_cmd,
41 string $export_with_comments_cmd,
42 bool $js = false
43 ): \ILIAS\UI\Component\Modal\RoundTrip {
44 $ui = $this->ui;
45 $factory = $ui->factory();
46
47 $mess = $factory->messageBox()->confirmation($message);
48 $modal = $factory->modal()->roundtrip($title, [$mess]);
49
50 $b1 = $factory->button()
51 ->standard($this->lng->txt("no"), "#")
52 ->withAdditionalOnLoadCode(static function ($id) use ($export_cmd, $js): string {
53 $cmd_js = ($js)
54 ? $export_cmd
55 : "window.location.href='$export_cmd'";
56 return "document.querySelector('#$id').addEventListener('click', (e) => {
57 const el = document.getElementById('$id');
58 el.closest('.modal-content').querySelector('button.close').click();
59 $cmd_js
60 });";
61 });
62 $b2 = $factory->button()
63 ->standard($this->lng->txt("yes"), "#")
64 ->withAdditionalOnLoadCode(static function ($id) use ($export_with_comments_cmd, $js): string {
65 $cmd_js = ($js)
66 ? $export_with_comments_cmd
67 : "window.location.href='$export_with_comments_cmd'";
68 return "document.querySelector('#$id').addEventListener('click', (e) => {
69 const el = document.getElementById('$id');
70 el.closest('.modal-content').querySelector('button.close').click();
71 $cmd_js
72 });";
73 });
74
75 $modal = $modal->withActionButtons([$b1, $b2]);
76
77 return $modal;
78 }
79}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Helper UI class for notes/comments handling in (HTML) exports.
getCommentIncludeModalDialog(string $title, string $message, string $export_cmd, string $export_with_comments_cmd, bool $js=false)
Definition: UI.php:24
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26
$message
Definition: xapiexit.php:31