ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 
 getOutputType ()
 
 getOptions (array $input)
 
 interaction (array $input, Option $user_selected_option, Bucket $bucket)
 
- 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...
 

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.ilCalendarDownloadZipInteraction.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarDownloadZipInteraction::__construct ( )

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

References $GLOBALS.

29  {
30  $this->logger = $GLOBALS['DIC']->logger()->cal();
31  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

Member Function Documentation

◆ getInputTypes()

ilCalendarDownloadZipInteraction::getInputTypes ( )

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

Implements ILIAS\BackgroundTasks\Task.

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

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

◆ getOptions()

ilCalendarDownloadZipInteraction::getOptions ( array  $input)

◆ getOutputType()

ilCalendarDownloadZipInteraction::getOutputType ( )

Implements ILIAS\BackgroundTasks\Task.

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

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

◆ getRemoveOption()

ilCalendarDownloadZipInteraction::getRemoveOption ( )

◆ interaction()

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

Implements ILIAS\BackgroundTasks\Task\UserInteraction.

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

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

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  }
global $DIC
Definition: saml.php:7
static deliverFileAttached($path_to_file, $download_file_name='', $mime_type='', $delete_file=false)
void
+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilCalendarDownloadZipInteraction::$logger = null
private

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

◆ OPTION_CANCEL

const ilCalendarDownloadZipInteraction::OPTION_CANCEL = 'cancel'

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

◆ OPTION_DOWNLOAD

const ilCalendarDownloadZipInteraction::OPTION_DOWNLOAD = 'download'

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


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