ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSumOfFileSizesTooLargeInteraction.php
Go to the documentation of this file.
1<?php
2
26
33{
37 private const OPTION_OK = 'ok';
38
39 protected ilLanguage $lng;
40
41 public function __construct()
42 {
43 global $DIC;
44 $this->lng = $DIC->language();
45 $this->lng->loadLanguageModule('background_tasks');
46 }
47
51 public function getInputTypes(): array
52 {
53 return [
54 new SingleType(ilCopyDefinition::class),
55 ];
56 }
57
58 public function getOutputType(): Type
59 {
60 return new SingleType(ilCopyDefinition::class);
61 }
62
63 #[\Override]
64 public function getRemoveOption(): Option
65 {
66 return new UserInteractionOption('ok', self::OPTION_OK);
67 }
68
69 public function interaction(array $input, Option $user_selected_option, Bucket $bucket): Value
70 {
71 if ($user_selected_option->getValue() === self::OPTION_OK) {
72 // Set state to finished to stop the BackgroundTask and remove it from the popover.
73 $bucket->setState(3);
74 }
75
76 return $input[0];
77 }
78
82 public function getOptions(array $input): array
83 {
84 return [];
85 }
86
87 #[\Override]
88 public function getMessage(array $input): string
89 {
90 return $this->lng->txt('ui_msg_files_violate_maxsize');
91 }
92
93 #[\Override]
94 public function canBeSkipped(array $input): bool
95 {
96 $copy_definition = $input[0];
97 // skip the user interaction if the adherence to the global limit for the sum of file sizes
98 // hasn't been violated (as this interaction is used as an error message and mustn't be
99 // shown when everything is fine))
100 return (bool) $copy_definition->getAdheresToLimit()->getValue();
101 }
102
103 #[\Override]
104 public function getSkippedValue(array $input): Value
105 {
106 return $input[0];
107 }
108
109 #[\Override]
110 public function isFinal(): bool
111 {
112 return false;
113 }
114}
language handling
getRemoveOption()
Option An Option to remove the current task and do some cleanup if possible. This Option is displayed...
interaction(array $input, Option $user_selected_option, Bucket $bucket)
global $DIC
Definition: shib_login.php:26