ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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: shib_login.php:26
+ 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: shib_logout.php:68
$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 $components, ILIAS\Repository\Modal\ModalAdapterGUI\form(), and null.

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="")
$components
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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(), null, 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="")
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 183 of file class.ModalAdapterGUI.php.

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

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

183  : array
184  {
185  $ui = $this->ui;
186  $modal = $ui->factory()->modal()->roundtrip("", $ui->factory()->legacy()->content(""));
187  $url .= '&replaceSignal=' . $modal->getReplaceSignal()->getId();
188  $modal = $modal->withAsyncRenderUrl($url);
189  if ($shy) {
190  $button = $ui->factory()->button()->shy($button_title, "#")
191  ->withOnClick($modal->getShowSignal());
192  } else {
193  $button = $ui->factory()->button()->standard($button_title, "#")
194  ->withOnClick($modal->getShowSignal());
195  }
196  return ["button" => $button, "modal" => $modal, "signal" => $modal->getShowSignal()->getId()];
197  }
$url
Definition: shib_logout.php:68
+ 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 $id, ILIAS\Repository\Modal\ModalAdapterGUI\form(), ILIAS\Repository\Modal\ModalAdapterGUI\getTitle(), null, 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  $modal = $this->ui->factory()->modal()->roundtrip(
143  $this->getTitle(),
144  null,
145  $this->form->getForm()->getInputs(),
146  $this->form->getForm()->getPostURL()
147  );
148  } else {
149  $modal = $this->ui->factory()->modal()->roundtrip($this->getTitle(), $this->ui_content);
150  }
151  if (count($this->action_buttons) > 0) {
152  $modal = $modal->withActionButtons($this->action_buttons);
153  }
154  if ($this->cancel_label !== "") {
155  $modal = $modal->withCancelButtonLabel($this->cancel_label);
156  }
157  $modal = $modal->withAdditionalOnLoadCode(function ($id) {
158  return "il.repository.ui.initModal('$id');";
159  });
160  return $modal;
161  }
form(\ILIAS\Repository\Form\FormAdapterGUI $form, string $on_form_submit_click="")
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$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:

◆ 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 199 of file class.ModalAdapterGUI.php.

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

199  : array
200  {
201  $ui = $this->ui;
202 
203  $modal = $this->getModalWithContent();
204  if ($shy) {
205  $button = $ui->factory()->button()->shy($button_title, "#")
206  ->withOnClick($modal->getShowSignal());
207  } else {
208  $button = $ui->factory()->button()->standard($button_title, "#")
209  ->withOnClick($modal->getShowSignal());
210  }
211  return ["button" => $button, "modal" => $modal, "signal" => $modal->getShowSignal()->getId()];
212  }
+ 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(), null, and ILIAS\Repository\ui().

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

◆ renderAsyncTriggerButton()

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

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

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

172  : string
173  {
174  $ui = $this->ui;
176  $button_title,
177  $url,
178  $shy
179  );
180  return $ui->renderer()->render($components);
181  }
$url
Definition: shib_logout.php:68
getAsyncTriggerButtonComponents(string $button_title, string $url, $shy=true)
$components
+ Here is the call graph for this function:

◆ send()

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

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

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

166  : void
167  {
168  $modal = $this->getModalWithContent();
169  $this->_send($this->ui->renderer()->renderAsync($modal));
170  }
+ 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: