ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilCalendarFileHandler.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
12
13
17 public function __construct()
18 {
19 }
20
26 public function downloadFilesForEvents($a_events)
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 }
93}
An exception for terminatinating execution or to throw for unit testing.
downloadFilesForEvents($a_events)
Download files for events.
Class ilFileDelivery.
exit
Definition: login.php:29
$DIC
Definition: xapitoken.php:46