ILIAS  release_8 Revision v8.24
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 $('#$id').closest('.modal-content').find('button.close').click();
58 $cmd_js
59 });";
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 $('#$id').closest('.modal-content').find('button.close').click();
70 $cmd_js
71 });";
72 });
73
74 $modal = $modal->withActionButtons([$b1, $b2]);
75
76 return $modal;
77 }
78}
$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)
global $DIC
Definition: feed.php:28
$factory
Definition: metadata.php:75
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
$message
Definition: xapiexit.php:32