ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
RoundTrip.php
Go to the documentation of this file.
1 <?php
3 
7 
11 class RoundTrip extends Modal implements Component\Modal\RoundTrip
12 {
13 
17  protected $action_buttons = array();
18 
22  protected $title;
23 
27  protected $content;
28 
32  protected $cancel_button_label = 'cancel';
33 
34  protected $ajax_content_url;
35  protected $replace_signal;
36 
37 
44  {
45  parent::__construct($signal_generator);
46  $this->checkStringArg('title', $title);
47  $content = $this->toArray($content);
48  $types = array(Component\Component::class);
49  $this->checkArgListElements('content', $content, $types);
50  $this->title = $title;
51  $this->content = $content;
52  }
53 
54 
58  public function getTitle()
59  {
60  return $this->title;
61  }
62 
63 
67  public function getContent()
68  {
69  return $this->content;
70  }
71 
72 
76  public function getActionButtons()
77  {
78  return $this->action_buttons;
79  }
80 
81 
85  public function withActionButtons(array $buttons)
86  {
87  $types = array(Button\Button::class);
88  $this->checkArgListElements('buttons', $buttons, $types);
89  $clone = clone $this;
90  $clone->action_buttons = $buttons;
91  return $clone;
92  }
93 
94 
98  public function getCancelButtonLabel()
99  {
101  }
102 
107  public function withCancelButtonLabel($label)
108  {
109  $clone = clone $this;
110  $clone->cancel_button_label = $label;
111  return $clone;
112  }
113 
117  public function getReplaceSignal()
118  {
119  return $this->replace_signal;
120  }
121 
125  public function initSignals()
126  {
127  parent::initSignals();
128  //signal generator from parent class
129  $this->replace_signal = $this->signal_generator->create("ILIAS\\UI\\Implementation\\Component\\ReplaceSignal");
130  }
131 
135  public function withContent($content)
136  {
137  $clone = clone $this;
138  $clone->content = $content;
139 
140  return $clone;
141  }
142 }
withContent($content)
Get Modal like this with the provided components representing the content of the modal.
Definition: RoundTrip.php:135
getCancelButtonLabel()
Get the label of the cancel button in the footer, as language key.string
Definition: RoundTrip.php:98
getTitle()
Get the title of the modal.string
Definition: RoundTrip.php:58
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
initSignals()
Set the show/close/replace signals for this modal.
Definition: RoundTrip.php:125
getActionButtons()
Get all action buttons in the footer of the modal.[]
Definition: RoundTrip.php:76
getReplaceSignal()
Get the signal to replace the content of this modal.
Definition: RoundTrip.php:117
withActionButtons(array $buttons)
Get a modal like this with the provided action buttons in the footer.Note that the footer always cont...
Definition: RoundTrip.php:85
checkArgListElements($which, array &$values, &$classes)
Check every element of the list if it is an instance of one of the given classes. ...
getContent()
Get the components representing the content of the modal.[]
Definition: RoundTrip.php:67
toArray($value)
Wrap the given value in an array if it is no array.
__construct($title, $content, SignalGeneratorInterface $signal_generator)
Definition: RoundTrip.php:43