ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
PersonalSettingsTableExportAction.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27use ILIAS\UI\Factory as UIFactory;
30use Psr\Http\Message\ServerRequestInterface;
31
33{
34 public const string ACTION_ID = 'export_template';
35
36 public function __construct(
37 private readonly Language $lng,
38 private readonly UIFactory $ui_factory,
39 private readonly PersonalSettingsExporter $exporter,
40 ) {
41 }
42
43 public function getActionId(): string
44 {
45 return self::ACTION_ID;
46 }
47
48 public function buildTableAction(
49 URLBuilder $url_builder,
50 URLBuilderToken $row_id_token,
51 URLBuilderToken $action_token,
52 URLBuilderToken $action_type_token
53 ): Action {
54 return $this->ui_factory->table()->action()->single(
55 $this->lng->txt('personal_settings_export'),
56 $url_builder
57 ->withParameter($action_token, self::ACTION_ID)
58 ->withParameter($action_type_token, ParticipantTableActions::SUBMIT_ACTION),
59 $row_id_token
60 );
61 }
62
63 public function buildModal(URLBuilder $url_builder, array $selected_templates): ?Modal
64 {
65 return null;
66 }
67
68 public function onSubmit(
69 URLBuilder $url_builder,
70 ServerRequestInterface $request,
71 array $selected_templates,
72 ): ?Modal {
73 if (count($selected_templates) !== 1) {
74 throw new \InvalidArgumentException('Expected exactly one template to be selected');
75 }
76
77 $this->exporter->setTemplateId(reset($selected_templates)->getId());
78 $this->exporter->deliver();
79
80 return null;
81 }
82}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
__construct(private readonly Language $lng, private readonly UIFactory $ui_factory, private readonly PersonalSettingsExporter $exporter,)
onSubmit(URLBuilder $url_builder, ServerRequestInterface $request, array $selected_templates,)
buildTableAction(URLBuilder $url_builder, URLBuilderToken $row_id_token, URLBuilderToken $action_token, URLBuilderToken $action_type_token)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes commonalities between the different modals.
Definition: Modal.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:31
if(!file_exists('../ilias.ini.php'))