ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Repository\Modal\ModalAdapterGUI Class Reference
+ Collaboration diagram for ILIAS\Repository\Modal\ModalAdapterGUI:

Public Member Functions

 __construct (string $title, string $cancel_label, HTTPUtil $http_util)
 
 getTitle ()
 
 legacy (string $content)
 
 content (array $components)
 
 button (string $text, string $url, bool $replace_modal=true, $onclick="")
 
 form (\ILIAS\Repository\Form\FormAdapterGUI $form, string $on_form_submit_click="")
 
 send ()
 
 renderAsyncTriggerButton (string $button_title, string $url, $shy=true)
 
 getAsyncTriggerButtonComponents (string $button_title, string $url, $shy=true)
 
 getTriggerButtonComponents (string $button_title, $shy=true)
 

Protected Member Functions

 _send (string $output)
 
 getModalWithContent ()
 

Protected Attributes

HTTPUtil $http_util
 
string $cancel_label
 
ILIAS Repository Form FormAdapterGUI $form = null
 
ILIAS Refinery Factory $refinery
 
string $title = ""
 
ILIAS HTTP Services $http
 
ilCtrlInterface $ctrl
 
ILIAS DI UIServices $ui
 
array $ui_content = null
 
array $action_buttons = []
 

Detailed Description

Definition at line 27 of file class.ModalAdapterGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Repository\Modal\ModalAdapterGUI::__construct ( string  $title,
string  $cancel_label,
HTTPUtil  $http_util 
)
Parameters
string | array$class_path

Definition at line 43 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\$cancel_label, $DIC, ILIAS\Repository\Modal\ModalAdapterGUI\$http_util, ILIAS\Repository\Modal\ModalAdapterGUI\$title, ILIAS\Repository\ctrl(), ILIAS\Repository\http(), ILIAS\Repository\refinery(), and ILIAS\Repository\ui().

47  {
48  global $DIC;
49  $this->ui = $DIC->ui();
50  $this->ctrl = $DIC->ctrl();
51  $this->http = $DIC->http();
52  $this->refinery = $DIC->refinery();
53  $this->title = $title;
54  $this->cancel_label = $cancel_label;
55  $this->http_util = $http_util;
56  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ _send()

ILIAS\Repository\Modal\ModalAdapterGUI::_send ( string  $output)
protected
Exceptions

Definition at line 61 of file class.ModalAdapterGUI.php.

Referenced by ILIAS\Repository\Modal\ModalAdapterGUI\send().

61  : void
62  {
63  $this->http_util->sendString($output);
64  }
+ Here is the caller graph for this function:

◆ button()

ILIAS\Repository\Modal\ModalAdapterGUI::button ( string  $text,
string  $url,
bool  $replace_modal = true,
  $onclick = "" 
)

Definition at line 85 of file class.ModalAdapterGUI.php.

References $id, $url, and ILIAS\Repository\ui().

85  : self
86  {
87  $target = $replace_modal
88  ? "#"
89  : $url;
90 
91  $button = $this->ui->factory()->button()->standard(
92  $text,
93  $target
94  );
95 
96  if ($replace_modal) {
97  $button = $button->withOnLoadCode(function ($id) use ($url, $onclick) {
98  return
99  "$('#$id').click(function(event) { $onclick; il.repository.ui.redirect('$url'); return false;});";
100  });
101  } elseif ($onclick !== "") {
102  $button = $button->withOnLoadCode(function ($id) use ($url, $onclick) {
103  return "$('#$id').click(function(event) { $onclick });";
104  });
105  }
106  $this->action_buttons[] = $button;
107  return $this;
108  }
$url
Definition: ltiregstart.php:35
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ content()

ILIAS\Repository\Modal\ModalAdapterGUI::content ( array  $components)

Definition at line 78 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\form().

78  : self
79  {
80  $this->ui_content = $components;
81  $this->form = null;
82  return $this;
83  }
form(\ILIAS\Repository\Form\FormAdapterGUI $form, string $on_form_submit_click="")
+ Here is the call graph for this function:

◆ form()

ILIAS\Repository\Modal\ModalAdapterGUI::form ( \ILIAS\Repository\Form\FormAdapterGUI  $form,
string  $on_form_submit_click = "" 
)

Definition at line 110 of file class.ModalAdapterGUI.php.

References $id, ILIAS\Repository\ctrl(), ILIAS\Repository\ui(), and ILIAS\UI\Implementation\Component\withOnLoadCode().

Referenced by ILIAS\Repository\Modal\ModalAdapterGUI\content(), ILIAS\Repository\Modal\ModalAdapterGUI\getModalWithContent(), and ILIAS\Repository\Modal\ModalAdapterGUI\legacy().

113  : self {
114  if ($this->ctrl->isAsynch()) {
115  $this->form = $form->asyncModal();
116  } else {
117  $this->form = $form->syncModal();
118  }
119 
120  $async = $this->form->isSentAsync()
121  ? "true"
122  : "false";
123  if ($on_form_submit_click === "") {
124  $on_form_submit_click = "il.repository.ui.submitModalForm(event,$async); return false;";
125  }
126  $button = $this->ui->factory()->button()->standard(
127  $this->form->getSubmitLabel(),
128  "#"
129  )->withOnLoadCode(function ($id) use ($on_form_submit_click) {
130  return
131  "$('#$id').click(function(event) {" . $on_form_submit_click . "});";
132  });
133  $this->action_buttons[] = $button;
134  $this->ui_content = null;
135  return $this;
136  }
form(\ILIAS\Repository\Form\FormAdapterGUI $form, string $on_form_submit_click="")
ILIAS Repository Form FormAdapterGUI $form
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAsyncTriggerButtonComponents()

ILIAS\Repository\Modal\ModalAdapterGUI::getAsyncTriggerButtonComponents ( string  $button_title,
string  $url,
  $shy = true 
)

Definition at line 174 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\$ui.

Referenced by ILIAS\Repository\Modal\ModalAdapterGUI\renderAsyncTriggerButton().

174  : array
175  {
176  $ui = $this->ui;
177  $modal = $ui->factory()->modal()->roundtrip("", $ui->factory()->legacy(""));
178  $url .= '&replaceSignal=' . $modal->getReplaceSignal()->getId();
179  $modal = $modal->withAsyncRenderUrl($url);
180  if ($shy) {
181  $button = $ui->factory()->button()->shy($button_title, "#")
182  ->withOnClick($modal->getShowSignal());
183  } else {
184  $button = $ui->factory()->button()->standard($button_title, "#")
185  ->withOnClick($modal->getShowSignal());
186  }
187  return ["button" => $button, "modal" => $modal, "signal" => $modal->getShowSignal()->getId()];
188  }
$url
Definition: ltiregstart.php:35
+ Here is the caller graph for this function:

◆ getModalWithContent()

ILIAS\Repository\Modal\ModalAdapterGUI::getModalWithContent ( )
protected

Definition at line 138 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\form(), ILIAS\Repository\Modal\ModalAdapterGUI\getTitle(), and ILIAS\Repository\ui().

Referenced by ILIAS\Repository\Modal\ModalAdapterGUI\getTriggerButtonComponents(), and ILIAS\Repository\Modal\ModalAdapterGUI\send().

138  : Modal\RoundTrip
139  {
140  $modal = [];
141  if (!is_null($this->form)) {
142  $this->ui_content = [$this->ui->factory()->legacy($this->form->render())];
143  }
144  $modal = $this->ui->factory()->modal()->roundtrip($this->getTitle(), $this->ui_content);
145  if (count($this->action_buttons) > 0) {
146  $modal = $modal->withActionButtons($this->action_buttons);
147  }
148  if ($this->cancel_label !== "") {
149  $modal = $modal->withCancelButtonLabel($this->cancel_label);
150  }
151  return $modal;
152  }
form(\ILIAS\Repository\Form\FormAdapterGUI $form, string $on_form_submit_click="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ILIAS\Repository\Modal\ModalAdapterGUI::getTitle ( )

Definition at line 66 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\$title.

Referenced by ILIAS\Repository\Modal\ModalAdapterGUI\getModalWithContent().

66  : string
67  {
68  return $this->title;
69  }
+ Here is the caller graph for this function:

◆ getTriggerButtonComponents()

ILIAS\Repository\Modal\ModalAdapterGUI::getTriggerButtonComponents ( string  $button_title,
  $shy = true 
)

Definition at line 190 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\$ui, and ILIAS\Repository\Modal\ModalAdapterGUI\getModalWithContent().

190  : array
191  {
192  $ui = $this->ui;
193 
194  $modal = $this->getModalWithContent();
195  if ($shy) {
196  $button = $ui->factory()->button()->shy($button_title, "#")
197  ->withOnClick($modal->getShowSignal());
198  } else {
199  $button = $ui->factory()->button()->standard($button_title, "#")
200  ->withOnClick($modal->getShowSignal());
201  }
202  return ["button" => $button, "modal" => $modal, "signal" => $modal->getShowSignal()->getId()];
203  }
+ Here is the call graph for this function:

◆ legacy()

ILIAS\Repository\Modal\ModalAdapterGUI::legacy ( string  $content)

Definition at line 71 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\form(), and ILIAS\Repository\ui().

71  : self
72  {
73  $this->ui_content = [$this->ui->factory()->legacy($content)];
74  $this->form = null;
75  return $this;
76  }
form(\ILIAS\Repository\Form\FormAdapterGUI $form, string $on_form_submit_click="")
+ Here is the call graph for this function:

◆ renderAsyncTriggerButton()

ILIAS\Repository\Modal\ModalAdapterGUI::renderAsyncTriggerButton ( string  $button_title,
string  $url,
  $shy = true 
)

Definition at line 163 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\$ui, and ILIAS\Repository\Modal\ModalAdapterGUI\getAsyncTriggerButtonComponents().

163  : string
164  {
165  $ui = $this->ui;
166  $components = $this->getAsyncTriggerButtonComponents(
167  $button_title,
168  $url,
169  $shy
170  );
171  return $ui->renderer()->render($components);
172  }
getAsyncTriggerButtonComponents(string $button_title, string $url, $shy=true)
$url
Definition: ltiregstart.php:35
+ Here is the call graph for this function:

◆ send()

ILIAS\Repository\Modal\ModalAdapterGUI::send ( )
Exceptions

Definition at line 157 of file class.ModalAdapterGUI.php.

References ILIAS\Repository\Modal\ModalAdapterGUI\_send(), ILIAS\Repository\Modal\ModalAdapterGUI\getModalWithContent(), and ILIAS\Repository\ui().

157  : void
158  {
159  $modal = $this->getModalWithContent();
160  $this->_send($this->ui->renderer()->renderAsync($modal));
161  }
+ Here is the call graph for this function:

Field Documentation

◆ $action_buttons

array ILIAS\Repository\Modal\ModalAdapterGUI::$action_buttons = []
protected

Definition at line 38 of file class.ModalAdapterGUI.php.

◆ $cancel_label

string ILIAS\Repository\Modal\ModalAdapterGUI::$cancel_label
protected

◆ $ctrl

ilCtrlInterface ILIAS\Repository\Modal\ModalAdapterGUI::$ctrl
protected

Definition at line 35 of file class.ModalAdapterGUI.php.

◆ $form

ILIAS Repository Form FormAdapterGUI ILIAS\Repository\Modal\ModalAdapterGUI::$form = null
protected

Definition at line 31 of file class.ModalAdapterGUI.php.

◆ $http

ILIAS HTTP Services ILIAS\Repository\Modal\ModalAdapterGUI::$http
protected

Definition at line 34 of file class.ModalAdapterGUI.php.

◆ $http_util

HTTPUtil ILIAS\Repository\Modal\ModalAdapterGUI::$http_util
protected

◆ $refinery

ILIAS Refinery Factory ILIAS\Repository\Modal\ModalAdapterGUI::$refinery
protected

Definition at line 32 of file class.ModalAdapterGUI.php.

◆ $title

string ILIAS\Repository\Modal\ModalAdapterGUI::$title = ""
protected

◆ $ui

◆ $ui_content

array ILIAS\Repository\Modal\ModalAdapterGUI::$ui_content = null
protected

Definition at line 37 of file class.ModalAdapterGUI.php.


The documentation for this class was generated from the following file: