ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
ParticipantTableEditBookingAction.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
31use ILIAS\UI\Factory as UIFactory;
34use ilLanguage;
36
42{
43 public const string ACTION_ID = 'edit_booking';
44
45 public const string ACTION_LABEL = 'book_deassign';
46
47 public function __construct(
48 private readonly UIFactory $ui_factory,
49 private readonly ilLanguage $lng,
50 private readonly AccessManager $access,
51 private readonly ilCtrlInterface $ctrl,
52 private readonly HttpService $http,
53 private readonly int $ref_id,
54 private readonly int $pool_id
55 ) {
56 }
57
58 public function getActionId(): string
59 {
60 return self::ACTION_ID;
61 }
62
63 public function getActionLabel(): string
64 {
65 return self::ACTION_LABEL;
66 }
67
68 public function isAvailable(): bool
69 {
70 return $this->access->canManageParticipants($this->ref_id);
71 }
72
73 public function getTableAction(
74 URLBuilder $url_builder,
75 URLBuilderToken $row_id_token,
76 URLBuilderToken $action_token,
77 URLBuilderToken $action_type_token
78 ): Action {
79 return $this->ui_factory->table()->action()->single(
80 $this->lng->txt('book_deassign'),
81 $url_builder
82 ->withParameter($action_token, self::ACTION_ID)
83 ->withParameter($action_type_token, 'edit'),
84 $row_id_token
85 );
86 }
87
88 public function onExecute(
89 URLBuilder $url_builder,
90 URLBuilderToken $row_id_token,
91 URLBuilderToken $action_token,
92 URLBuilderToken $action_type_token
93 ): mixed {
94 $this->ctrl->setParameterByClass(
96 'user_id',
97 (int) $this->http->resolveRowParameter($row_id_token->getName())
98 );
99 $this->ctrl->redirectByClass(ilBookingReservationsGUI::class, 'log');
100
101 return null;
102 }
103
107 public function allowActionForRecord(mixed $record): bool
108 {
109 $obj_count = (int) ($record['obj_count'] ?? 0);
110 return $obj_count > 0;
111 }
112
113 private function getObjectCountForUser(int $user_id): int
114 {
116 $this->pool_id,
117 ['user_id' => $user_id]
118 )["{$this->pool_id}_{$user_id}"] ?? null;
119 return (int) ($user_data['obj_count'] ?? 0);
120 }
121
125 private function getObjectIdsForUser(int $user_id): array
126 {
128 $this->pool_id,
129 ['user_id' => $user_id]
130 )["{$this->pool_id}_{$user_id}"] ?? null;
131 return $user_data['object_ids'] ?? [];
132 }
133}
@phpstan-type ParticipantRecord array{user_id: int, name: string, object_title: array<string>,...
__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, private readonly int $pool_id)
getTableAction(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
onExecute(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 ilBookingParticipantGUI: ilRepositorySearchGUI
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getList(int $a_booking_pool, ?array $a_filter=null, ?int $a_object_id=null)
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
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...
static http()
Fetches the global http state from ILIAS.
global $lng
Definition: privfeed.php:26