ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
EditSkillsOfQuestionTableActions.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27
29{
30 public const string ROW_ID_PARAMETER = 'a_id';
32 public const string ACTION_PARAMETER = 'action';
33 public const string ACTION_TYPE_PARAMETER = 'action_type';
34 public const string SHOW_ACTION = 'showAction';
35
39 public function __construct(
40 protected readonly \ilGlobalTemplateInterface $tpl,
41 private readonly array $actions
42 ) {
43 }
44
45 public function getEnabledActions(
46 URLBuilder $url_builder,
47 URLBuilderToken $row_id_token,
48 URLBuilderToken $action_token,
49 URLBuilderToken $action_type_token
50 ): array {
51 return array_filter(
52 array_map(
53 static function (EditSkillsOfQuestionTableAction $action) use (
54 $url_builder,
55 $row_id_token,
56 $action_token,
57 $action_type_token
58 ): ?Action {
59 return $action->isAvailable()
60 ? $action->getTableAction($url_builder, $row_id_token, $action_token, $action_type_token)
61 : null;
62 },
63 $this->actions
64 )
65 );
66 }
67
68 public function getAction(string $action_id): ?EditSkillsOfQuestionTableAction
69 {
70 return $this->actions[$action_id] ?? null;
71 }
72
73 public function setAvailabilityOnDataRow(DataRow $row, mixed $record): DataRow
74 {
75 return array_reduce(
76 array_keys($this->actions),
77 fn(DataRow $c, string $v): DataRow => $this->actions[$v]->allowActionForRecord($record)
78 ? $c
79 : $c->withDisabledAction($v),
80 $row
81 );
82 }
83}
__construct(protected readonly \ilGlobalTemplateInterface $tpl, private readonly array $actions)
getEnabledActions(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
$c
Definition: deliver.php:25
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...