19declare(strict_types=1);
39 public const string ACTION_ID =
'book_for_participant';
43 private readonly UIFactory $ui_factory,
51 private readonly
bool $active_management,
71 return $this->active_management && $this->
access->canManageObjects($this->ref_id);
80 return $this->ui_factory->table()->action()->single(
83 ->withParameter($action_token, self::
ACTION_ID)
84 ->withParameter($action_type_token,
'redirect'),
95 $row_ids = $this->resolveRowIds($row_id_token->getName());
96 if ($row_ids === []) {
100 $first_parts = explode(
'_', $row_ids[0]);
101 $primary_object_id = (
int) $first_parts[0];
102 if ($primary_object_id <= 0) {
107 ? ilBookingProcessWithScheduleGUI::class
108 : ilBookingProcessWithoutScheduleGUI::class;
110 $this->
ctrl->setParameterByClass($target_class,
'object_id', (
string) $primary_object_id);
112 if (isset($first_parts[1], $first_parts[2])) {
113 $this->
ctrl->setParameterByClass(
116 $first_parts[1] .
'_' . $first_parts[2]
118 $this->
ctrl->setParameterByClass($target_class,
'seed', date(
'Y-m-d', (
int) $first_parts[1]));
121 $this->
ctrl->redirectByClass($target_class,
'assignParticipants');
127 if (!is_array($record)) {
131 if ($this->pool->getOverallLimit() && (
int) $record[
'available'] <= 0) {
135 return (
bool) $record[
'is_available'];
143 $value = $this->
http->get(
145 $this->
refinery->custom()->transformation(
146 static function (mixed $raw): array {
147 if ($raw ===
null || $raw ===
'') {
151 if (is_array($raw)) {
152 return array_values(array_map(
'strval', $raw));
155 return [(string) $raw];
160 return array_values(array_filter($value,
static fn(
string $v):
bool => $v !==
''));
allowActionForRecord(mixed $record)
getTableAction(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
__construct(private readonly UIFactory $ui_factory, private readonly ilLanguage $lng, private readonly ilCtrlInterface $ctrl, private readonly HttpService $http, private readonly Refinery $refinery, private readonly AccessManager $access, private readonly ilObjBookingPool $pool, private readonly int $ref_id, private readonly bool $active_management,)
const string ACTION_LABEL
onExecute(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
resolveRowIds(string $key)
Builds a Color from either hex- or rgb values.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TYPE_NO_SCHEDULE_PREFERENCES
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readonly HttpService $http
static http()
Fetches the global http state from ILIAS.