ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDownloadZipInteraction Class Reference

Description of class class. More...

+ Inheritance diagram for ilDownloadZipInteraction:
+ Collaboration diagram for ilDownloadZipInteraction:

Public Member Functions

 __construct ()
 
 getInputTypes ()
 
Returns
Type[] A list of types that are taken as input.
More...
 
 getRemoveOption ()
 @inheritDoc More...
 
 getOutputType ()
 @inheritDoc More...
 
 getOptions (array $input)
 @inheritDoc More...
 
 interaction (array $input, Option $user_selected_option, Bucket $bucket)
 @inheritDoc More...
 
 canBeSkipped (array $input)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractUserInteraction
 getMessage (array $input)
 @inheritDoc More...
 
 canBeSkipped (array $input)
 @inheritDoc More...
 
 getSkippedValue (array $input)
 
 isFinal ()
 
- Public Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
 setInput (array $values)
 
 getOutput ()
 
 getInput ()
 
 getType ()
 
 unfoldTask ()
 Unfold the task. More...
 
 getRemoveOption ()
 
Returns
Option An Option to remove the current task and do some cleanup if possible. This Option is displayed if the Bucket is completed. You do not have to provide an additional Option to remove in your UserInteraction, the remove-Option is added to the list of Options (last position)
See also
self::getAbortOption();
More...
 
 getAbortOption ()
 
Returns
Option In case a Job is failed or did not respond for some time, an Abort-Option is displayed. There is already a Standard-Abort-Option registered, you can override with your own and do some cleanup if possible.
More...
 
 getType ()
 
 getInputTypes ()
 
 getOutputType ()
 
 getOutput ()
 
 setInput (array $values)
 
 getInput ()
 
 unfoldTask ()
 
 getRemoveOption ()
 
 getAbortOption ()
 
 getOptions (array $input)
 
 canBeSkipped (array $input)
 Decide whether the UserInteraction is presented to the user and he has to decide or user UserInteraction is skipped by the TaskManager. More...
 
 getSkippedValue (array $input)
 
 isFinal ()
 
 interaction (array $input, Option $user_selected_option, Bucket $bucket)
 
 getMessage (array $input)
 

Data Fields

const OPTION_DOWNLOAD = 'download'
 
const OPTION_CANCEL = 'cancel'
 
- Data Fields inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
const MAIN_REMOVE = 'bt_main_remove'
 
const MAIN_ABORT = 'bt_main_abort'
 

Private Attributes

ilLogger $logger
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
 checkTypes (array $values)
 
 extractType ($value)
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
Value $output
 

Detailed Description

Description of class class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 36 of file class.ilDownloadZipInteraction.php.

Constructor & Destructor Documentation

◆ __construct()

ilDownloadZipInteraction::__construct ( )

Definition at line 43 of file class.ilDownloadZipInteraction.php.

44 {
45 global $DIC;
46 $this->logger = $DIC->logger()->cal();
47 }
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ canBeSkipped()

ilDownloadZipInteraction::canBeSkipped ( array  $input)

@inheritDoc

Reimplemented from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractUserInteraction.

Definition at line 129 of file class.ilDownloadZipInteraction.php.

129 : bool
130 {
131 return false;
132 }

◆ getInputTypes()

ilDownloadZipInteraction::getInputTypes ( )

Returns
Type[] A list of types that are taken as input.

Implements ILIAS\BackgroundTasks\Task.

Definition at line 53 of file class.ilDownloadZipInteraction.php.

53 : array
54 {
55 return [
56 new SingleType(StringValue::class),
57 new SingleType(StringValue::class),
58 ];
59 }

◆ getOptions()

ilDownloadZipInteraction::getOptions ( array  $input)

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

Definition at line 84 of file class.ilDownloadZipInteraction.php.

84 : array
85 {
86 return [
87 new UserInteractionOption('download', self::OPTION_DOWNLOAD),
88 ];
89 }

◆ getOutputType()

ilDownloadZipInteraction::getOutputType ( )

@inheritDoc

Implements ILIAS\BackgroundTasks\Task.

Definition at line 75 of file class.ilDownloadZipInteraction.php.

75 : Type
76 {
77 return new SingleType(StringValue::class);
78 }

◆ getRemoveOption()

ilDownloadZipInteraction::getRemoveOption ( )

@inheritDoc

Reimplemented from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask.

Definition at line 66 of file class.ilDownloadZipInteraction.php.

66 : Option
67 {
68 return new UserInteractionOption('remove', self::OPTION_CANCEL);
69 }

◆ interaction()

ilDownloadZipInteraction::interaction ( array  $input,
Option  $user_selected_option,
Bucket  $bucket 
)

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

Definition at line 95 of file class.ilDownloadZipInteraction.php.

95 : Value
96 {
97 global $DIC;
98 $zip_name = $input[1];
99 $download_name = $input[0];
100
101 $this->logger->debug('User interaction download zip ' . $input[0]->getValue() . ' as '
102 . $input[1]->getValue());
103
104 if ($user_selected_option->getValue() !== self::OPTION_DOWNLOAD) {
105 $this->logger->info('Download canceled');
106 // delete zip file
107 $filesystem = $DIC->filesystem()->temp();
108
109 try {
110 $path = LegacyPathHelper::createRelativePath($zip_name->getValue());
111 } catch (InvalidArgumentException) {
112 $path = null;
113 }
114 if (!is_null($path) && $filesystem->has($path)) {
115 $filesystem->deleteDir(dirname($path));
116 }
117
118 return new ThunkValue();
119 }
120
121 $this->logger->info("Delivering File.");
122
123 ilFileDelivery::deliverFileAttached($download_name->getValue(), $zip_name->getValue());
124
125 return new ThunkValue();
126 }
static deliverFileAttached(string $path_to_file, ?string $download_file_name=null, ?string $mime_type=null, bool $delete_file=false)
$path
Definition: ltiservices.php:30
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:49

References $DIC, ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask\$input, $path, ilFileDelivery\deliverFileAttached(), ILIAS\BackgroundTasks\Task\UserInteraction\Option\getValue(), ILIAS\UI\Implementation\Component\Input\getValue(), and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilLogger ilDownloadZipInteraction::$logger
private

Definition at line 40 of file class.ilDownloadZipInteraction.php.

◆ OPTION_CANCEL

const ilDownloadZipInteraction::OPTION_CANCEL = 'cancel'

Definition at line 39 of file class.ilDownloadZipInteraction.php.

◆ OPTION_DOWNLOAD

const ilDownloadZipInteraction::OPTION_DOWNLOAD = 'download'

Definition at line 38 of file class.ilDownloadZipInteraction.php.


The documentation for this class was generated from the following file: