ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSumOfWorkspaceFileSizesTooLargeInteraction.php
Go to the documentation of this file.
1<?php
2
26
28{
29 public const OPTION_OK = 'ok';
30 public const OPTION_SKIP = 'skip';
31 protected ilLanguage $lng;
32
33 public function __construct()
34 {
35 global $DIC;
36 $this->lng = $DIC->language();
37 $this->lng->loadLanguageModule('background_tasks');
38 }
39
40 public function getInputTypes(): array
41 {
42 return [
43 new SingleType(ilWorkspaceCopyDefinition::class),
44 ];
45 }
46
47 public function getOutputType(): Type
48 {
49 return new SingleType(ilWorkspaceCopyDefinition::class);
50 }
51
52 public function getRemoveOption(): Option
53 {
54 return new UserInteractionOption('ok', self::OPTION_OK);
55 }
56
57 public function interaction(
58 array $input,
59 Option $user_selected_option,
60 Bucket $bucket
61 ): Value {
62 if ($user_selected_option->getValue() == self::OPTION_OK) {
63 // Set state to finished to stop the BackgroundTask and remove it from the popover.
64 $bucket->setState(3);
65 }
66
67 return $input[0];
68 }
69
70 public function getOptions(array $input): array
71 {
72 return array();
73 }
74
75 public function getMessage(array $input): string
76 {
77 return $this->lng->txt('ui_msg_files_violate_maxsize');
78 }
79
80 public function canBeSkipped(array $input): bool
81 {
82 $copy_definition = $input[0];
83 if ($copy_definition->getAdheresToLimit()->getValue()) {
84 // skip the user interaction if the adherence to the global limit for the sum of file sizes
85 // hasn't been violated (as this interaction is used as an error message and mustn't be
86 // shown when everything is fine))
87
88 return true;
89 } else {
90 return false;
91 }
92 }
93
94 public function getSkippedValue(array $input): Value
95 {
96 return $input[0];
97 }
98
99 public function isFinal(): bool
100 {
101 return false;
102 }
103}
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)
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:49
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26