ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
s
t
w
+
Functions
_
a
b
c
f
g
h
i
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
DownloadConsumer.php
Go to the documentation of this file.
1
<?php declare(strict_types=1);
2
3
namespace
ILIAS\MainMenu\Storage\Consumer
;
4
5
use
ILIAS\HTTP\Response\ResponseHeader
;
6
use
ILIAS\MainMenu\Storage\StorableResource
;
7
use
ILIAS\MainMenu\Storage\StorageHandler\StorageHandler
;
8
14
class
DownloadConsumer
implements
DeliveryConsumer
15
{
16
20
private
$storage_handler
;
24
private
$resource
;
25
26
33
public
function
__construct
(
StorableResource
$resource
,
StorageHandler
$storage_handler
)
34
{
35
$this->resource =
$resource
;
36
$this->storage_handler =
$storage_handler
;
37
}
38
39
40
public
function
run
() : void
41
{
42
global
$DIC
;
43
44
$revision = $this->resource->getCurrentRevision();
45
$file_name = $revision->getInformation()->getTitle();
46
$mime_type = $revision->getInformation()->getMimeType();
47
48
$response
= $DIC->http()->response();
49
$response
=
$response
->withHeader(
ResponseHeader::CONTENT_TYPE
, $mime_type);
50
$response
=
$response
->withHeader(
ResponseHeader::CONNECTION
,
'close'
);
51
$response
=
$response
->withHeader(
ResponseHeader::ACCEPT_RANGES
,
'bytes'
);
52
$response
=
$response
->withHeader(
53
ResponseHeader::CONTENT_DISPOSITION
,
54
'attachment'
55
.
'; filename="'
56
. $file_name
57
.
'"'
58
);
59
$response
=
$response
->withBody($this->storage_handler->getStream($revision));
60
61
$DIC->http()->saveResponse(
$response
);
62
$DIC->http()->sendResponse();
63
$DIC->http()->close();
64
}
65
}
ILIAS\MainMenu\Storage\Consumer\DownloadConsumer\$storage_handler
$storage_handler
Definition:
DownloadConsumer.php:20
ILIAS\HTTP\Response\ResponseHeader\ACCEPT_RANGES
const ACCEPT_RANGES
Definition:
ResponseHeader.php:32
ILIAS\MainMenu\Storage\StorageHandler\StorageHandler
Class FileResourceHandler.
Definition:
StorageHandler.php:17
ILIAS\MainMenu\Storage\Consumer
Definition:
ConsumerFactory.php:3
StorageHandler
ILIAS\HTTP\Response\ResponseHeader\CONTENT_DISPOSITION
const CONTENT_DISPOSITION
Definition:
ResponseHeader.php:59
ILIAS\HTTP\Response\ResponseHeader\CONTENT_TYPE
const CONTENT_TYPE
Definition:
ResponseHeader.php:95
StorableResource
ILIAS\MainMenu\Storage\Consumer\DownloadConsumer\$resource
$resource
Definition:
DownloadConsumer.php:24
ILIAS\MainMenu\Storage\Consumer\DownloadConsumer\__construct
__construct(StorableResource $resource, StorageHandler $storage_handler)
DownloadConsumer constructor.
Definition:
DownloadConsumer.php:33
ILIAS\HTTP\Response\ResponseHeader\CONNECTION
const CONNECTION
Definition:
ResponseHeader.php:51
ILIAS\MainMenu\Storage\Consumer\DeliveryConsumer
Interface DeliveryConsumer.
Definition:
DeliveryConsumer.php:10
ILIAS\MainMenu\Storage\Consumer\DownloadConsumer
Definition:
DownloadConsumer.php:14
ILIAS\MainMenu\Storage\Consumer\DownloadConsumer\run
run()
This runs the actual DeliveryConsumer.
Definition:
DownloadConsumer.php:40
ResponseHeader
$DIC
$DIC
Definition:
xapitoken.php:46
$response
$response
Definition:
proxy_ylocal.php:39
ILIAS\MainMenu\Storage\StorableResource
Interface StorageResource.
Definition:
StorableResource.php:15
Services
MainMenu
classes
Storage
Consumer
DownloadConsumer.php
Generated on Fri Apr 11 2025 20:01:27 for ILIAS by
1.8.13 (using
Doxyfile
)