ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Interruptive.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
26 class Interruptive extends Modal implements M\Interruptive
27 {
31  protected array $items = array();
32  protected string $title;
33  protected string $message;
34  protected ?string $action_button_label = null;
35  protected ?string $cancel_button_label = null;
36  protected string $form_action;
37 
38  public function __construct(
39  string $title,
40  string $message,
41  string $form_action,
43  ) {
44  parent::__construct($signal_generator);
45  $this->checkStringArg('title', $title);
46  $this->checkStringArg('message', $message);
47  $this->checkStringArg('form_action', $form_action);
48  $this->title = $title;
49  $this->message = $message;
50  $this->form_action = $form_action;
51  }
52 
56  public function getMessage(): string
57  {
58  return $this->message;
59  }
60 
64  public function getTitle(): string
65  {
66  return $this->title;
67  }
68 
72  public function withFormAction(string $form_action): M\Interruptive
73  {
74  $clone = clone $this;
75  $clone->form_action = $form_action;
76  return $clone;
77  }
78 
82  public function withAffectedItems(array $items): M\Interruptive
83  {
84  $types = array(M\InterruptiveItem\InterruptiveItem::class);
85  $this->checkArgListElements('items', $items, $types);
86  $clone = clone $this;
87  $clone->items = $items;
88  return $clone;
89  }
90 
94  public function getActionButtonLabel(): ?string
95  {
97  }
98 
99 
103  public function withActionButtonLabel(string $action_label): M\Interruptive
104  {
105  $clone = clone $this;
106  $clone->action_button_label = $action_label;
107  return $clone;
108  }
109 
113  public function getCancelButtonLabel(): ?string
114  {
116  }
117 
121  public function withCancelButtonLabel(string $cancel_label): M\Interruptive
122  {
123  $clone = clone $this;
124  $clone->cancel_button_label = $cancel_label;
125  return $clone;
126  }
127 
131  public function getAffectedItems(): array
132  {
133  return $this->items;
134  }
135 
136  public function getFormAction(): string
137  {
138  return $this->form_action;
139  }
140 }
__construct(string $title, string $message, string $form_action, SignalGeneratorInterface $signal_generator)
withCancelButtonLabel(string $cancel_label)
Get a modal like this with the cancel button labeled according to the parameter.The label will be tra...
withFormAction(string $form_action)
Get a modal like this submitting the form to the given form action.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
SignalGeneratorInterface $signal_generator
Definition: Modal.php:42
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
getCancelButtonLabel()
Get the custom label of the cancel button in the footer.
getAffectedItems()
Return the affected items listed in the content by this modal.InterruptiveItem[]
__construct(Container $dic, ilPlugin $plugin)
getMessage()
Get the message of this modal, displayed below the modals title.
getFormAction()
Get the form action where the action button is sending the IDs of the affected items.
withActionButtonLabel(string $action_label)
Get a modal like this with the action button labeled according to the parameter.
withAffectedItems(array $items)
Get a modal like this listing the given items in the content section below the message.The IDs of the interruptive items are sent via POST to the form action of this modal.$items
getActionButtonLabel()
Get the custom label of the action button in the footer.