ILIAS  release_8 Revision v8.24
ilCalendarDownloadZipInteraction Class Reference

Description of class class. More...

+ Inheritance diagram for ilCalendarDownloadZipInteraction:
+ Collaboration diagram for ilCalendarDownloadZipInteraction:

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)
 

Protected Attributes

const OPTION_DOWNLOAD = 'download'
 
const OPTION_CANCEL = 'cancel'
 
- Protected Attributes inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
array $input = []
 
ILIAS BackgroundTasks Value $output
 

Private Attributes

ilLogger $logger
 

Additional Inherited Members

- Data Fields inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
const MAIN_REMOVE = 'bt_main_remove'
 
const MAIN_ABORT = 'bt_main_abort'
 
- Protected Member Functions inherited from ILIAS\BackgroundTasks\Implementation\Tasks\AbstractTask
 checkTypes ($values)
 
 extractType ($value)
 

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 22 of file class.ilCalendarDownloadZipInteraction.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarDownloadZipInteraction::__construct ( )

Definition at line 29 of file class.ilCalendarDownloadZipInteraction.php.

30 {
31 global $DIC;
32 $this->logger = $DIC->logger()->cal();
33 }
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getInputTypes()

ilCalendarDownloadZipInteraction::getInputTypes ( )

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

Implements ILIAS\BackgroundTasks\Task.

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

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

◆ getOptions()

ilCalendarDownloadZipInteraction::getOptions ( array  $input)

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

Definition at line 65 of file class.ilCalendarDownloadZipInteraction.php.

65 : array
66 {
67 return [
68 new UserInteractionOption('download', self::OPTION_DOWNLOAD),
69 ];
70 }

◆ getOutputType()

ilCalendarDownloadZipInteraction::getOutputType ( )

@inheritDoc

Implements ILIAS\BackgroundTasks\Task.

Definition at line 57 of file class.ilCalendarDownloadZipInteraction.php.

57 : Type
58 {
59 return new SingleType(StringValue::class);
60 }

◆ getRemoveOption()

ilCalendarDownloadZipInteraction::getRemoveOption ( )

@inheritDoc

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

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

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

◆ interaction()

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

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

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

75 : Value
76 {
77 global $DIC;
78 $zip_name = $input[1];
79 $download_name = $input[0];
80
81 $this->logger->debug('User interaction download zip ' . $input[0]->getValue() . ' as '
82 . $input[1]->getValue());
83
84 if ($user_selected_option->getValue() != self::OPTION_DOWNLOAD) {
85 $this->logger->info('Download canceled');
86 // delete zip file
87 $filesystem = $DIC->filesystem()->temp();
88
89 try {
90 $path = LegacyPathHelper::createRelativePath($zip_name->getValue());
91 } catch (InvalidArgumentException $e) {
92 $path = null;
93 }
94 if (!is_null($path) && $filesystem->has($path)) {
95 $filesystem->deleteDir(dirname($path));
96 }
97
98 // @todo what kind of value is desired
99 return $download_name;
100 }
101
102 $this->logger->info("Delivering File.");
103
105 $download_name->getValue(),
106 $zip_name->getValue(),
107 MimeType::APPLICATION__ZIP
108 );
109
110 // @todo what kind of value is desired
111 return $download_name;
112 }
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 ilCalendarDownloadZipInteraction::$logger
private

Definition at line 27 of file class.ilCalendarDownloadZipInteraction.php.

◆ OPTION_CANCEL

const ilCalendarDownloadZipInteraction::OPTION_CANCEL = 'cancel'
protected

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

◆ OPTION_DOWNLOAD

const ilCalendarDownloadZipInteraction::OPTION_DOWNLOAD = 'download'
protected

Definition at line 24 of file class.ilCalendarDownloadZipInteraction.php.


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