ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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...
 
- 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

 $logger = null
 

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
 $input = []
 
 $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 18 of file class.ilDownloadZipInteraction.php.

Constructor & Destructor Documentation

◆ __construct()

ilDownloadZipInteraction::__construct ( )

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

29 {
30 $this->logger = $GLOBALS['DIC']->logger()->cal();
31 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

References $GLOBALS.

Member Function Documentation

◆ getInputTypes()

ilDownloadZipInteraction::getInputTypes ( )

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

Implements ILIAS\BackgroundTasks\Task.

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

38 {
39 return [
40 new SingleType(StringValue::class),
41 new SingleType(StringValue::class),
42 ];
43 }

◆ getOptions()

ilDownloadZipInteraction::getOptions ( array  $input)

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

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

68 {
69 return [
70 new UserInteractionOption('download', self::OPTION_DOWNLOAD),
71 ];
72 }

◆ getOutputType()

ilDownloadZipInteraction::getOutputType ( )

@inheritDoc

Implements ILIAS\BackgroundTasks\Task.

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

59 {
60 return new SingleType(StringValue::class);
61 }

◆ getRemoveOption()

ilDownloadZipInteraction::getRemoveOption ( )

@inheritDoc

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

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

50 {
51 return new UserInteractionOption('remove', self::OPTION_CANCEL);
52 }

◆ interaction()

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

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

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

79 {
80 global $DIC;
81 $zip_name = $input[1];
82 $download_name = $input[0];
83
84 $this->logger->debug('User interaction download zip ' . $input[0]->getValue() . ' as '
85 . $input[1]->getValue());
86
87 if ($user_selected_option->getValue() != self::OPTION_DOWNLOAD) {
88 $this->logger->info('Download canceled');
89 // delete zip file
90 $filesystem = $DIC->filesystem()->temp();
91
92 try {
93 $path = LegacyPathHelper::createRelativePath($zip_name->getValue());
94 } catch (InvalidArgumentException $e) {
95 $path = null;
96 }
97 if (!is_null($path) && $filesystem->has($path)) {
98 $filesystem->deleteDir(dirname($path));
99 }
100
101 return $input;
102 }
103
104 $this->logger->info("Delivering File.");
105
106 ilFileDelivery::deliverFileAttached($download_name->getValue(), $zip_name->getValue());
107
108 return $input;
109 }
static deliverFileAttached($path_to_file, $download_file_name='', $mime_type='', $delete_file=false)
void
$DIC
Definition: xapitoken.php:46

References $DIC, Vendor\Package\$e, ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask\$input, ilFileDelivery\deliverFileAttached(), and ILIAS\BackgroundTasks\Task\UserInteraction\Option\getValue().

+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilDownloadZipInteraction::$logger = null
private

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

◆ OPTION_CANCEL

const ilDownloadZipInteraction::OPTION_CANCEL = 'cancel'

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

◆ OPTION_DOWNLOAD

const ilDownloadZipInteraction::OPTION_DOWNLOAD = 'download'

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


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