ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSumOfFileSizesTooLargeInteraction.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
10
18{
19 const OPTION_OK = 'ok';
20 const OPTION_SKIP = 'skip';
24 private $logger = null;
28 protected $lng;
29
30
31 public function __construct()
32 {
33 global $DIC;
34 $this->logger = $DIC->logger()->cal();
35 $this->lng = $DIC->language();
36 $this->lng->loadLanguageModule('background_tasks');
37 }
38
39
43 public function getInputTypes()
44 {
45 return [
46 new SingleType(ilCopyDefinition::class),
47 ];
48 }
49
50
54 public function getOutputType()
55 {
56 return new SingleType(ilCopyDefinition::class);
57 }
58
59
63 public function getRemoveOption()
64 {
65 return new UserInteractionOption('ok', self::OPTION_OK);
66 }
67
68
72 public function interaction(array $input, Option $user_selected_option, Bucket $bucket)
73 {
74 if ($user_selected_option->getValue() == self::OPTION_OK) {
75 // Set state to finished to stop the BackgroundTask and remove it from the popover.
76 $bucket->setState(3);
77 }
78
79 return $definition = $input[0];
80 }
81
82
86 public function getOptions(array $input)
87 {
88 return array();
89 }
90
91
95 public function getMessage(array $input)
96 {
97 return $message = $this->lng->txt('ui_msg_files_violate_maxsize');
98 }
99
100
104 public function canBeSkipped(array $input) : bool
105 {
106 $copy_definition = $input[0];
107 if ($copy_definition->getAdheresToLimit()->getValue()) {
108 // skip the user interaction if the adherence to the global limit for the sum of file sizes
109 // hasn't been violated (as this interaction is used as an error message and mustn't be
110 // shown when everything is fine))
111
112 return true;
113 } else {
114 return false;
115 }
116 }
117
118
122 public function getSkippedValue(array $input) : Value
123 {
124 return $input[0];
125 }
126
127 public function isFinal(): bool
128 {
129 return false;
130 }
131
132
133}
An exception for terminatinating execution or to throw for unit testing.
getRemoveOption()
Option An Option to remove the current task and do some cleanup if possible. This Option is displayed...
getOptions(array $input)
Option[] Options are buttons the user can press on this interaction.
interaction(array $input, Option $user_selected_option, Bucket $bucket)
@inheritDoc
getInputTypes()
Type[] A list of types that are taken as input.
global $DIC
Definition: goto.php:24
$message
Definition: xapiexit.php:14