ILIAS  release_8 Revision v8.24
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 ($values)
 
 extractType ($value)
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
ILIAS BackgroundTasks 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 35 of file class.ilDownloadZipInteraction.php.

Constructor & Destructor Documentation

◆ __construct()

ilDownloadZipInteraction::__construct ( )

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

43 {
44 global $DIC;
45 $this->logger = $DIC->logger()->cal();
46 }
global $DIC
Definition: feed.php:28

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 126 of file class.ilDownloadZipInteraction.php.

126 : bool
127 {
128 return false;
129 }

◆ getInputTypes()

ilDownloadZipInteraction::getInputTypes ( )

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

Implements ILIAS\BackgroundTasks\Task.

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

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

◆ getOptions()

ilDownloadZipInteraction::getOptions ( array  $input)

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

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

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

◆ getOutputType()

ilDownloadZipInteraction::getOutputType ( )

@inheritDoc

Implements ILIAS\BackgroundTasks\Task.

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

73 : Type
74 {
75 return new SingleType(StringValue::class);
76 }

◆ getRemoveOption()

ilDownloadZipInteraction::getRemoveOption ( )

@inheritDoc

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

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

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

◆ interaction()

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

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

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

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

References $DIC, Vendor\Package\$e, 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 39 of file class.ilDownloadZipInteraction.php.

◆ OPTION_CANCEL

const ilDownloadZipInteraction::OPTION_CANCEL = 'cancel'

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

◆ OPTION_DOWNLOAD

const ilDownloadZipInteraction::OPTION_DOWNLOAD = 'download'

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


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