ILIAS  trunk Revision v12.0_alpha-1613-gae4c99ebb18
ScheduleTableEditAction.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29use ILIAS\UI\Factory as UIFactory;
32use ilLanguage;
33
39{
40 public const string ACTION_ID = 'edit';
41
42 public const string ACTION_LABEL = 'edit';
43
44 public function __construct(
45 private readonly UIFactory $ui_factory,
46 private readonly ilLanguage $lng,
47 private readonly AccessManager $access,
48 private readonly ilCtrlInterface $ctrl,
49 private readonly HttpService $http,
50 private readonly int $ref_id
51 ) {
52 }
53
54 public function getActionId(): string
55 {
56 return self::ACTION_ID;
57 }
58
59 public function getActionLabel(): string
60 {
61 return self::ACTION_LABEL;
62 }
63
64 public function isAvailable(): bool
65 {
66 return $this->access->canManageSettings($this->ref_id);
67 }
68
69 public function getTableAction(
70 URLBuilder $url_builder,
71 URLBuilderToken $row_id_token,
72 URLBuilderToken $action_token,
73 URLBuilderToken $action_type_token
74 ): Action {
75 return $this->ui_factory->table()->action()->single(
76 $this->lng->txt(self::ACTION_LABEL),
77 $url_builder
78 ->withParameter($action_token, self::ACTION_ID)
79 ->withParameter($action_type_token, 'edit'), // TODO: Check for constant.
80 $row_id_token
81 );
82 }
83
84 public function onExecute(
85 URLBuilder $url_builder,
86 URLBuilderToken $row_id_token,
87 URLBuilderToken $action_token,
88 URLBuilderToken $action_type_token
89 ): mixed {
90 $this->ctrl->setParameterByClass(
92 'schedule_id',
93 $this->http->resolveRowParameter($row_id_token->getName())
94 );
95 $this->ctrl->redirectByClass(ilBookingScheduleGUI::class, 'edit');
96
97 return null;
98 }
99
103 public function allowActionForRecord(mixed $record): bool
104 {
105 return $this->access->canManageSettings($this->ref_id);
106 }
107}
@phpstan-type ScheduleRecord array{booking_schedule_id: int, title: string, object_has_schedule: ?...
onExecute(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 AccessManager $access, private readonly ilCtrlInterface $ctrl, private readonly HttpService $http, private readonly int $ref_id)
getTableAction(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
@ilCtrl_Calls ilBookingScheduleGUI:
language handling
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...
$ref_id
Definition: ltiauth.php:66
static http()
Fetches the global http state from ILIAS.
global $lng
Definition: privfeed.php:26