ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSumOfWorkspaceFileSizesTooLargeInteraction.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
17{
18 const OPTION_OK = 'ok';
19 const OPTION_SKIP = 'skip';
23 private $logger = null;
27 protected $lng;
28
29
30 public function __construct()
31 {
32 global $DIC;
33 $this->logger = ilLoggerFactory::getLogger("pwsp");
34 $this->lng = $DIC->language();
35 $this->lng->loadLanguageModule('background_tasks');
36 }
37
38
42 public function getInputTypes()
43 {
44 return [
45 new SingleType(ilWorkspaceCopyDefinition::class),
46 ];
47 }
48
49
53 public function getOutputType()
54 {
55 return new SingleType(ilWorkspaceCopyDefinition::class);
56 }
57
58
62 public function getRemoveOption()
63 {
64 return new UserInteractionOption('ok', self::OPTION_OK);
65 }
66
67
71 public function interaction(array $input, Option $user_selected_option, Bucket $bucket)
72 {
73 if ($user_selected_option->getValue() == self::OPTION_OK) {
74 // Set state to finished to stop the BackgroundTask and remove it from the popover.
75 $bucket->setState(3);
76 }
77
78 return $definition = $input[0];
79 }
80
81
85 public function getOptions(array $input)
86 {
87 return array();
88 }
89
90
94 public function getMessage(array $input)
95 {
96 return $message = $this->lng->txt('ui_msg_files_violate_maxsize');
97 }
98
99
103 public function canBeSkipped(array $input) : bool
104 {
105 $copy_definition = $input[0];
106 if ($copy_definition->getAdheresToLimit()->getValue()) {
107 // skip the user interaction if the adherence to the global limit for the sum of file sizes
108 // hasn't been violated (as this interaction is used as an error message and mustn't be
109 // shown when everything is fine))
110
111 return true;
112 } else {
113 return false;
114 }
115 }
116
117
121 public function getSkippedValue(array $input) : Value
122 {
123 return $input[0];
124 }
125}
An exception for terminatinating execution or to throw for unit testing.
static getLogger($a_component_id)
Get component logger.
getOptions(array $input)
Option[] Options are buttons the user can press on this interaction.
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)
@inheritDoc
$message
Definition: xapiexit.php:14
$DIC
Definition: xapitoken.php:46