ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Modal.php
Go to the documentation of this file.
1 <?php
3 
10 
16 abstract class Modal implements Component\Modal\Modal
17 {
18  use ComponentHelper;
20  use Triggerer;
21 
25  protected $signal_generator;
26 
30  protected $show_signal;
31 
35  protected $close_signal;
39  protected $async_render_url = '';
40 
44  protected $close_with_keyboard = true;
45 
50  {
51  $this->signal_generator = $signal_generator;
52  $this->initSignals();
53  }
54 
58  public function getAsyncRenderUrl()
59  {
61  }
62 
66  public function withAsyncRenderUrl($url)
67  {
68  $this->checkStringArg('url', $url);
69  $clone = clone $this;
70  $clone->async_render_url = $url;
71  return $clone;
72  }
73 
77  public function withCloseWithKeyboard($state)
78  {
79  $clone = clone $this;
80  $clone->close_with_keyboard = (bool) $state;
81  return $clone;
82  }
83 
87  public function getCloseWithKeyboard()
88  {
90  }
91 
92 
96  public function getShowSignal()
97  {
98  return $this->show_signal;
99  }
100 
104  public function getCloseSignal()
105  {
106  return $this->close_signal;
107  }
108 
112  public function withResetSignals()
113  {
114  $clone = clone $this;
115  $clone->initSignals();
116  return $clone;
117  }
118 
122  public function withOnLoad(Signal $signal)
123  {
124  return $this->withTriggeredSignal($signal, 'ready');
125  }
126 
130  public function appendOnLoad(Signal $signal)
131  {
132  return $this->appendTriggeredSignal($signal, 'ready');
133  }
134 
135 
139  protected function initSignals()
140  {
141  $this->show_signal = $this->signal_generator->create();
142  $this->close_signal = $this->signal_generator->create();
143  }
144 }
withResetSignals()
Get a component like this but reset (regenerate) its signals.$this
Definition: Modal.php:112
getAsyncRenderUrl()
Get the url returning the rendered modal, if the modals content should be rendered via ajax...
Definition: Modal.php:58
getCloseWithKeyboard()
Returns if this modal can be closed with the keyboard (ESC key)bool
Definition: Modal.php:87
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
trait ComponentHelper
Provides common functionality for component implementations.
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
__construct(SignalGeneratorInterface $signal_generator)
Definition: Modal.php:49
getCloseSignal()
Get the signal to close this modal in the frontend.Signal
Definition: Modal.php:104
appendTriggeredSignal(Component\Signal $signal, $event)
Append a triggered signal to other signals of the same event.
Definition: Triggerer.php:31
getShowSignal()
Get the signal to show this modal in the frontend.Signal
Definition: Modal.php:96
initSignals()
Set the show and close signals for this modal.
Definition: Modal.php:139
appendOnLoad(Signal $signal)
Get a component like this, triggering a signal of another component on load.In contrast to withOnLoad...
Definition: Modal.php:130
withAsyncRenderUrl($url)
Get a modal like this who&#39;s content is rendered via ajax by the given $url before the modal is shown...
Definition: Modal.php:66
$url
withOnLoad(Signal $signal)
Trigger a signal of another component on load.A signal of another component$this
Definition: Modal.php:122
withCloseWithKeyboard($state)
Get a modal like this which can or cannot be closed by keyboard (ESC), depending on the given $state...
Definition: Modal.php:77
withTriggeredSignal(Component\Signal $signal, $event)
Add a triggered signal, replacing any other signals registered on the same event. ...
Definition: Triggerer.php:48