ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
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
10
class
ilCalendarFileHandler
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) {
30
$fh =
ilAppointmentFileHandlerFactory::getInstance
($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
}
$DIC
global $DIC
Definition:
saml.php:7
ilCalendarFileHandler\__construct
__construct()
Constructor.
Definition:
class.ilCalendarFileHandler.php:17
ilFileDelivery\DISP_ATTACHMENT
const DISP_ATTACHMENT
Definition:
class.ilFileDelivery.php:29
exit
exit
Definition:
backend.php:16
ilFileDelivery
Class ilFileDelivery.
Definition:
class.ilFileDelivery.php:21
ilCalendarFileHandler
Calendar file handler.
Definition:
class.ilCalendarFileHandler.php:10
ilAppointmentFileHandlerFactory\getInstance
static getInstance($a_appointment)
Definition:
class.ilAppointmentFileHandlerFactory.php:13
php
ilCalendarFileHandler\downloadFilesForEvents
downloadFilesForEvents($a_events)
Download files for events.
Definition:
class.ilCalendarFileHandler.php:26
Services
Calendar
classes
FileHandler
class.ilCalendarFileHandler.php
Generated on Thu Jan 16 2025 19:02:18 for ILIAS by
1.8.13 (using
Doxyfile
)