52 $this->table =
new Table($this);
53 $this->ui_factory = $DIC->ui()->factory();
54 $this->ui_renderer = $DIC->ui()->renderer();
59 $this->tab_handling->initTabs(
67 case self::CMD_CREATE:
71 case self::CMD_DUPLICATE:
74 case self::CMD_UPDATE:
76 case self::CMD_DELETE:
82 case self::CMD_CONFIRM_DELETE:
85 case self::CMD_DEFAULT:
87 return $this->
index();
93 protected function index(): string
95 $this->table =
new Table($this);
96 if ($this->
access->hasUserPermissionTo(
'write')) {
97 $btn_add_msg = $this->
ui->factory()->button()->standard(
98 $this->
lng->txt(
'common_add_msg'),
99 $this->
ctrl->getLinkTarget($this, self::CMD_ADD)
101 $this->
toolbar->addComponent($btn_add_msg);
103 return $this->table->getHTML();
106 protected function add(): string
110 $this->
ctrl->getLinkTarget($this, self::CMD_CREATE)
119 $this->
ctrl->getLinkTarget($this, self::CMD_CREATE)
122 if ($form->saveObject()) {
123 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_success_created'),
true);
124 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
126 return $form->getHTML();
131 $this->
ctrl->setParameter($this, self::IDENTIFIER, null);
132 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
135 protected function edit(): string
147 $notification->setId(0);
148 $notification->create();
149 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_success_duplicated'),
true);
158 if ($form->saveObject()) {
159 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_success_updated'),
true);
160 $this->
ctrl->redirect($this, self::CMD_DEFAULT);
162 return $form->getHTML();
165 protected function delete():
void 168 $notification->delete();
171 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_success_deleted'),
true);
178 $notification->resetForAllUsers();
181 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_success_reset'),
true);
189 $stream = Streams::ofString(
190 $this->ui_renderer->render(
191 $this->ui_factory->modal()->interruptive(
192 $this->
lng->txt(
'action_confirm_delete'),
193 $this->
lng->txt(
'action_confirm_delete_msg'),
194 $this->
ctrl->getLinkTarget($this, self::CMD_DELETE)
195 )->withAffectedItems(
203 $this->
http->saveResponse($this->
http->response()->withBody($stream));
204 $this->
http->sendResponse();
205 $this->
http->close();
219 $query_params = $this->
http->request()->getQueryParams();
220 $name = $this->table->getIdToken()->getName();
221 $field_ids = $query_params[$name] ?? [];
224 if (($field_ids[0] ?? null) ===
'ALL_OBJECTS') {
233 foreach ($field_ids as $field_id) {
238 if (($interruptive_items = $this->
http->request()->getParsedBody()[
'interruptive_items'] ??
false)) {
239 foreach ($interruptive_items as $interruptive_item) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static findOrFail($primary_key, array $add_constructor_args=[])
Tries to find the object and throws an Exception if object is not found, instead of returning null...
Interface InterruptiveItem.
getNotificationFromRequest()
PhpIncompatibleReturnTypeInspection
getNotificationsFromRequest()
static http()
Fetches the global http state from ILIAS.
This is how the factory for UI elements looks.
readonly Factory $ui_factory
ilADNTabHandling $tab_handling
__construct(ilADNTabHandling $tab_handling)
__construct(Container $dic, ilPlugin $plugin)
readonly Renderer $ui_renderer