ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ExportHelperGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
6
12{
16 protected $lng;
17
21 protected $ui;
22
26 public function __construct()
27 {
28 global $DIC;
29 $this->lng = $DIC->language();
30 $this->ui = $DIC->ui();
31 }
32
39 public function getCommentIncludeModalDialog($title, $message, $export_cmd, $export_with_comments_cmd, $js = false)
40 {
41 $ui = $this->ui;
42 $factory = $ui->factory();
43
44 $mess = $factory->messageBox()->confirmation($message);
45 $modal = $factory->modal()->roundtrip($title, [$mess]);
46
47 $b1 = $factory->button()->standard($this->lng->txt("no"), "")
48 ->withAdditionalOnLoadCode(function ($id) use ($export_cmd, $js) {
49 $cmd_js = ($js)
50 ? $export_cmd
51 : "window.location.href='$export_cmd'";
52 return "document.querySelector('#$id').addEventListener('click', (e) => {
53 $('#$id').closest('.modal-content').find('button.close').click();
54 $cmd_js
55 });";
56 });
57 $b2 = $factory->button()->standard($this->lng->txt("yes"), "")
58 ->withAdditionalOnLoadCode(function ($id) use ($export_with_comments_cmd, $js) {
59 $cmd_js = ($js)
60 ? $export_with_comments_cmd
61 : "window.location.href='$export_with_comments_cmd'";
62 return "document.querySelector('#$id').addEventListener('click', (e) => {
63 $('#$id').closest('.modal-content').find('button.close').click();
64 $cmd_js
65 });";
66 });
67
68 $modal = $modal->withActionButtons([$b1, $b2]);
69
70 return $modal;
71 }
72}
An exception for terminatinating execution or to throw for unit testing.
Helper UI class for notes/comments handling in (HTML) exports.
getCommentIncludeModalDialog($title, $message, $export_cmd, $export_with_comments_cmd, $js=false)
global $DIC
Definition: goto.php:24
$factory
Definition: metadata.php:58
ui()
Definition: ui.php:5
$message
Definition: xapiexit.php:14