ILIAS  release_8 Revision v8.24
class.ilSumOfFileSizesTooLargeInteraction.php
Go to the documentation of this file.
1<?php
2
26
33{
34 private const OPTION_OK = 'ok';
35
36 protected ilLanguage $lng;
37
38 public function __construct()
39 {
40 global $DIC;
41 $this->lng = $DIC->language();
42 $this->lng->loadLanguageModule('background_tasks');
43 }
44
48 public function getInputTypes(): array
49 {
50 return [
51 new SingleType(ilCopyDefinition::class),
52 ];
53 }
54
55 public function getOutputType(): Type
56 {
57 return new SingleType(ilCopyDefinition::class);
58 }
59
60 public function getRemoveOption(): Option
61 {
62 return new UserInteractionOption('ok', self::OPTION_OK);
63 }
64
65 public function interaction(array $input, Option $user_selected_option, Bucket $bucket): Value
66 {
67 if ($user_selected_option->getValue() == self::OPTION_OK) {
68 // Set state to finished to stop the BackgroundTask and remove it from the popover.
69 $bucket->setState(3);
70 }
71
72 return $input[0];
73 }
74
78 public function getOptions(array $input): array
79 {
80 return array();
81 }
82
83 public function getMessage(array $input): string
84 {
85 return $this->lng->txt('ui_msg_files_violate_maxsize');
86 }
87
88 public function canBeSkipped(array $input): bool
89 {
90 $copy_definition = $input[0];
91 if ($copy_definition->getAdheresToLimit()->getValue()) {
92 // skip the user interaction if the adherence to the global limit for the sum of file sizes
93 // hasn't been violated (as this interaction is used as an error message and mustn't be
94 // shown when everything is fine))
95
96 return true;
97 } else {
98 return false;
99 }
100 }
101
102 public function getSkippedValue(array $input): Value
103 {
104 return $input[0];
105 }
106
107 public function isFinal(): bool
108 {
109 return false;
110 }
111}
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: feed.php:28