ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarFileHandler Class Reference

Calendar file handler. More...

+ Collaboration diagram for ilCalendarFileHandler:

Public Member Functions

 __construct ()
 Constructor. More...
 
 downloadFilesForEvents ($a_events)
 Download files for events. More...
 

Detailed Description

Calendar file handler.

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Version
$Id$

Definition at line 10 of file class.ilCalendarFileHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarFileHandler::__construct ( )

Constructor.

Definition at line 17 of file class.ilCalendarFileHandler.php.

18  {
19  }

Member Function Documentation

◆ downloadFilesForEvents()

ilCalendarFileHandler::downloadFilesForEvents (   $a_events)

Download files for events.

Parameters

Definition at line 26 of file class.ilCalendarFileHandler.php.

References $DIC, ilFileDelivery\DISP_ATTACHMENT, exit, and ilAppointmentFileHandlerFactory\getInstance().

27  {
28  include_once("./Services/Calendar/classes/FileHandler/class.ilAppointmentFileHandlerFactory.php");
29  foreach ($a_events as $event) {
31  foreach ($fh->getFiles() as $file) {
32  // just for demonstration we provide only the last file
33  $last_file = $file;
34 
35  // @todo: collect all files
36  }
37 
38  // @todo: copy zip all files using background
39 
40  /*
41  global $DIC;
42 
43  $factory = $DIC->backgroundTasks()->taskFactory();
44  $taskManager = $DIC->backgroundTasks()->taskManager();
45 
46  // We create a bucket that will be scheduled and set the user that should observe the bucket.
47  $bucket = new BasicBucket();
48  $bucket->setUserId($DIC->user()->getId());
49 
50  // Combine the tasks. This will create a task that looks like this: (1 + 1) + (1 + 2).
51  include_once("./Services/Calendar/FileHandler/classes/class.ilCalFileZipJob.php");
52  $a = $factory->createTask(ilCalFileZipJob::class, [$last_file]);
53  // Note the integer 1 will automatically be wrapped in a IntegerValue class. All scalars can be wrapped automatically.
54  // The above is the same as:
55  // $a = $factory->createTask(PlusJob::class, [new IntegerValue(1), new IntegerValue(1)]);
56  //$b = $factory->createTask(PlusJob::class, [1, 2]);
57  //$c = $factory->createTask(PlusJob::class, [$a, $b]);
58 
59  // The last task is a user interaction that allows the user to download the result calculated above.
60  $userInteraction = $factory->createTask(DownloadInteger::class, [$c]);
61 
62  // We put the combined task into the bucket and add some description
63  $bucket->setTask($userInteraction);
64  $bucket->setTitle("Some calculation.");
65  $bucket->setDescription("We calculate 5!");
66 
67  // We schedule the task.
68  $taskManager->run($bucket);
69 
70  // We redirect somewhere.
71  $this->ctrl->redirect($this, "showContent");
72  */
73 
74 
75 
76 
77  // just for demonstration: send last file
78  if (is_file($last_file)) {
79  require_once('./Services/FileDelivery/classes/class.ilFileDelivery.php');
80  global $DIC;
81  $ilClientIniFile = $DIC['ilClientIniFile'];
82 
83  $ilFileDelivery = new ilFileDelivery($last_file);
84  $ilFileDelivery->setDisposition(ilFileDelivery::DISP_ATTACHMENT);
85  //$ilFileDelivery->setMimeType($this->guessFileType($file));
86  $ilFileDelivery->setConvertFileNameToAsci((bool) !$ilClientIniFile->readVariable('file_access', 'disable_ascii'));
87  //$ilFileDelivery->setDownloadFileName();
88  $ilFileDelivery->deliver();
89  exit;
90  }
91  }
92  }
global $DIC
Definition: saml.php:7
exit
Definition: backend.php:16
Class ilFileDelivery.
+ Here is the call graph for this function:

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