19declare(strict_types=1);
50 protected URI $link_to_parent,
53 protected UIFactory $ui_factory,
54 protected UIRenderer $ui_renderer,
57 protected PresentationUtilities $presentation_utilities,
60 protected PublishingSettings $publishing_settings,
62 protected DataFactory $data_factory,
63 protected ObjectHandler $object_handler
65 $this->ref_id = $this->request_parser->fetchRefID();
66 $this->obj_id = $this->request_parser->fetchObjID();
67 $this->type = $this->request_parser->fetchType();
68 $this->state_info = $this->state_info_fetcher->getStateInfoForObjectReference(
77 $next_class = $this->
ctrl->getNextClass($this);
79 $cmd = Command::tryFrom($this->
ctrl->getCmd());
80 switch ($next_class) {
85 $cmd_value = $cmd->value;
96 if (!$this->state_info->isPublishingRelevant()) {
100 return match ($cmd) {
101 Command::VIEW =>
true,
102 Command::BLOCK => $this->state_info->isActionAvailable(Action::BLOCK),
103 Command::UNBLOCK => $this->state_info->isActionAvailable(Action::UNBLOCK),
104 Command::PUBLISH => $this->state_info->isActionAvailable(Action::PUBLISH),
105 Command::WITHDRAW, Command::CONFIRM_WITHDRAW => $this->state_info->isActionAvailable(Action::WITHDRAW),
106 Command::SUBMIT => $this->state_info->isActionAvailable(Action::SUBMIT),
107 Command::ACCEPT, Command::CONFIRM_ACCEPT => $this->state_info->isActionAvailable(Action::ACCEPT),
112 protected function view(): void
114 $content = $this->content_factory->getInfoContent($this->ref_id, $this->obj_id, $this->type, $this->state_info);
115 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->show($content));
121 $this->state_changer->block($this->obj_id);
123 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->redirect($this->link_to_parent));
129 $this->state_changer->unblock($this->obj_id);
131 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->redirect($this->link_to_parent));
137 $this->state_changer->publish($this->obj_id, $this->type);
139 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->redirect($this->link_to_parent));
145 $content = $this->content_factory->getConfirmationContent(
150 $this->object_handler->isOnlyReference($this->ref_id)
152 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->show($content));
158 $this->state_changer->withdraw($this->obj_id);
162 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->redirect($link));
168 $this->state_changer->submit($this->obj_id);
170 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->redirect($this->link_to_parent));
176 $content = $this->content_factory->getConfirmationContent(
181 $this->object_handler->isOnlyReference($this->ref_id)
183 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->show($content));
189 $this->state_changer->accept($this->obj_id, $this->type);
193 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->redirect($link));
199 $content = $this->content_factory->getConfirmationContent(
204 $this->object_handler->isOnlyReference($this->ref_id)
206 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->show($content));
212 $this->state_changer->reject($this->obj_id);
216 echo $this->ui_renderer->renderAsync($this->ui_factory->prompt()->state()->redirect($link));
222 if ($this->object_handler->doesReferenceExist($this->ref_id)) {
223 return $this->link_to_parent;
225 return $this->static_url->builder()->build(
'cat', $this->data_factory->refId($fallback_ref_id));
230 $this->tpl->setOnScreenMessage(
232 $this->content_factory->getSuccessMessage($action),
Builds a Color from either hex- or rgb values.
The scope of this class is split ilias-conform URI's into components.
const MESSAGE_TYPE_SUCCESS
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...