ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 = []
 
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 (array $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 36 of file class.ilCalendarDownloadZipInteraction.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarDownloadZipInteraction::__construct ( )

Definition at line 43 of file class.ilCalendarDownloadZipInteraction.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

◆ getInputTypes()

ilCalendarDownloadZipInteraction::getInputTypes ( )

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

Implements ILIAS\BackgroundTasks\Task.

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

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

◆ getOptions()

ilCalendarDownloadZipInteraction::getOptions ( array  $input)

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

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

79 : array
80 {
81 return [
82 new UserInteractionOption('download', self::OPTION_DOWNLOAD),
83 ];
84 }

◆ getOutputType()

ilCalendarDownloadZipInteraction::getOutputType ( )

@inheritDoc

Implements ILIAS\BackgroundTasks\Task.

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

71 : Type
72 {
73 return new SingleType(StringValue::class);
74 }

◆ getRemoveOption()

ilCalendarDownloadZipInteraction::getRemoveOption ( )

@inheritDoc

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

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

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

◆ interaction()

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

@inheritDoc

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

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

89 : Value
90 {
91 global $DIC;
92 $zip_name = $input[1];
93 $download_name = $input[0];
94
95 $this->logger->debug('User interaction download zip ' . $input[0]->getValue() . ' as '
96 . $input[1]->getValue());
97
98 if ($user_selected_option->getValue() != self::OPTION_DOWNLOAD) {
99 $this->logger->info('Download canceled');
100 // delete zip file
101 $filesystem = $DIC->filesystem()->temp();
102
103 try {
104 $path = LegacyPathHelper::createRelativePath($zip_name->getValue());
105 } catch (InvalidArgumentException $e) {
106 $path = null;
107 }
108 if (!is_null($path) && $filesystem->has($path)) {
109 $filesystem->deleteDir(dirname($path));
110 }
111
112 // @todo what kind of value is desired
113 return $download_name;
114 }
115
116 $this->logger->info("Delivering File.");
117
119 $download_name->getValue(),
120 $zip_name->getValue(),
121 MimeType::APPLICATION__ZIP
122 );
123
124 // @todo what kind of value is desired
125 return $download_name;
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, 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 41 of file class.ilCalendarDownloadZipInteraction.php.

◆ OPTION_CANCEL

const ilCalendarDownloadZipInteraction::OPTION_CANCEL = 'cancel'
protected

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

◆ OPTION_DOWNLOAD

const ilCalendarDownloadZipInteraction::OPTION_DOWNLOAD = 'download'
protected

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


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