ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilFileDelivery Class Reference

Class ilFileDelivery. More...

+ Inheritance diagram for ilFileDelivery:
+ Collaboration diagram for ilFileDelivery:

Public Member Functions

 __construct ($filePath)
 ilFileDelivery constructor. More...
 
 __call ($name, array $arguments)
 Workaround because legacy components try to call methods which are moved to the Deliver class. More...
 

Static Public Member Functions

static deliverFileAttached ($path_to_file, $download_file_name='', $mime_type='', $delete_file=false)
 
Parameters
$path_to_file
string$download_file_name
string$mime_type
bool$delete_file
Returns
void
More...
 
static streamVideoInline ($path_to_file, $download_file_name='')
 
Parameters
$path_to_file
string$download_file_name
Returns
void
More...
 
static deliverFileInline ($path_to_file, $download_file_name='')
 
Parameters
$path_to_file
string$download_file_name
Returns
void
More...
 
static returnASCIIFileName ($original_filename)
 Converts a UTF-8 filename to ASCII.
Parameters
string$original_filenameUFT8-Filename
Returns
string ASCII-Filename
More...
 
static deliverFileAttached ($path_to_file, $download_file_name='', $mime_type='', $delete_file=false)
 
static streamVideoInline ($path_to_file, $download_file_name='')
 
static deliverFileInline ($path_to_file, $download_file_name='')
 
static returnASCIIFileName ($original_filename)
 Converts a UTF-8 filename to ASCII. More...
 

Data Fields

const DIRECT_PHP_OUTPUT = Delivery::DIRECT_PHP_OUTPUT
 
const DELIVERY_METHOD_XSENDFILE = DeliveryMethod::XSENDFILE
 
const DELIVERY_METHOD_XACCEL = DeliveryMethod::XACCEL
 
const DELIVERY_METHOD_PHP = DeliveryMethod::PHP
 
const DELIVERY_METHOD_PHP_CHUNKED = DeliveryMethod::PHP_CHUNKED
 
const DISP_ATTACHMENT = Delivery::DISP_ATTACHMENT
 
const DISP_INLINE = Delivery::DISP_INLINE
 

Static Private Member Functions

static isNonEmptyString ($text)
 Checks if the string is not empty. More...
 

Private Attributes

 $delivery
 

Detailed Description

Class ilFileDelivery.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

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

Constructor & Destructor Documentation

◆ __construct()

ilFileDelivery::__construct (   $filePath)

ilFileDelivery constructor.

Parameters
string$filePath

Definition at line 42 of file class.ilFileDelivery.php.

43 {
44 assert(is_string($filePath));
45 $this->delivery = new Delivery($filePath, self::http());
46 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

Member Function Documentation

◆ __call()

ilFileDelivery::__call (   $name,
array  $arguments 
)

Workaround because legacy components try to call methods which are moved to the Deliver class.

Parameters
string$nameThe function name which was not found on the current object.
array$argumentsThe function arguments passed to the function which was not existent on the current object.

Definition at line 125 of file class.ilFileDelivery.php.

126 {
127 assert(is_string($name));
128 //forward call to Deliver class
129 call_user_func_array([ $this->delivery, $name ], $arguments);
130 }
if($format !==null) $name
Definition: metadata.php:146

References $name.

◆ deliverFileAttached()

static ilFileDelivery::deliverFileAttached (   $path_to_file,
  $download_file_name = '',
  $mime_type = '',
  $delete_file = false 
)
static

Parameters
$path_to_file
string$download_file_name
string$mime_type
bool$delete_file
Returns
void

Implements ILIAS\FileDelivery\ilFileDeliveryService.

Definition at line 52 of file class.ilFileDelivery.php.

53 {
54 assert(is_string($path_to_file));
55 assert(is_string($download_file_name));
56 assert(is_string($mime_type));
57 assert(is_bool($delete_file));
58
59 $obj = new Delivery($path_to_file, self::http());
60
61 if (self::isNonEmptyString($download_file_name)) {
62 $obj->setDownloadFileName($download_file_name);
63 }
64 if (self::isNonEmptyString($mime_type)) {
65 $obj->setMimeType($mime_type);
66 }
67 $obj->setDisposition(self::DISP_ATTACHMENT);
68 $obj->setDeleteFile($delete_file);
69 $obj->deliver();
70 }

References ILIAS\FileDelivery\http().

Referenced by ilSystemStyleSkinContainer\export(), ilCalendarDownloadZipInteraction\interaction(), ilObjBibliographicGUI\sendFile(), and ilExcel\sendToClient().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverFileInline()

static ilFileDelivery::deliverFileInline (   $path_to_file,
  $download_file_name = '' 
)
static

Parameters
$path_to_file
string$download_file_name
Returns
void

Implements ILIAS\FileDelivery\ilFileDeliveryService.

Definition at line 92 of file class.ilFileDelivery.php.

93 {
94 assert(is_string($path_to_file));
95 assert(is_string($download_file_name));
96 $obj = new Delivery($path_to_file, self::http());
97
98 if (self::isNonEmptyString($download_file_name)) {
99 $obj->setDownloadFileName($download_file_name);
100 }
101 $obj->setDisposition(self::DISP_INLINE);
102 $obj->deliver();
103 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ isNonEmptyString()

static ilFileDelivery::isNonEmptyString (   $text)
staticprivate

Checks if the string is not empty.

Parameters
string$textThe text which should be checked.
Returns
bool True if the text is not empty otherwise false.

Definition at line 140 of file class.ilFileDelivery.php.

141 {
142 assert(is_string($text));
143
144 return (bool) strcmp($text, '') !== 0;
145 }
$text
Definition: errorreport.php:18

References $text.

◆ returnASCIIFileName()

static ilFileDelivery::returnASCIIFileName (   $original_filename)
static

Converts a UTF-8 filename to ASCII.

Parameters
string$original_filenameUFT8-Filename
Returns
string ASCII-Filename

Implements ILIAS\FileDelivery\ilFileDeliveryService.

Definition at line 109 of file class.ilFileDelivery.php.

110 {
111 assert(is_string($original_filename));
112
113 return Delivery::returnASCIIFileName($original_filename);
114 }

◆ streamVideoInline()

static ilFileDelivery::streamVideoInline (   $path_to_file,
  $download_file_name = '' 
)
static

Parameters
$path_to_file
string$download_file_name
Returns
void

Implements ILIAS\FileDelivery\ilFileDeliveryService.

Definition at line 76 of file class.ilFileDelivery.php.

77 {
78 assert(is_string($path_to_file));
79 assert(is_string($download_file_name));
80 $obj = new Delivery($path_to_file, self::http());
81 if (self::isNonEmptyString($download_file_name)) {
82 $obj->setDownloadFileName($download_file_name);
83 }
84 $obj->setDisposition(self::DISP_INLINE);
85 $obj->stream();
86 }

References ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

Field Documentation

◆ $delivery

Delivery ilFileDelivery::$delivery
private

Definition at line 34 of file class.ilFileDelivery.php.

◆ DELIVERY_METHOD_PHP

const ilFileDelivery::DELIVERY_METHOD_PHP = DeliveryMethod::PHP

Definition at line 27 of file class.ilFileDelivery.php.

◆ DELIVERY_METHOD_PHP_CHUNKED

const ilFileDelivery::DELIVERY_METHOD_PHP_CHUNKED = DeliveryMethod::PHP_CHUNKED

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

◆ DELIVERY_METHOD_XACCEL

const ilFileDelivery::DELIVERY_METHOD_XACCEL = DeliveryMethod::XACCEL

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

◆ DELIVERY_METHOD_XSENDFILE

const ilFileDelivery::DELIVERY_METHOD_XSENDFILE = DeliveryMethod::XSENDFILE

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

◆ DIRECT_PHP_OUTPUT

const ilFileDelivery::DIRECT_PHP_OUTPUT = Delivery::DIRECT_PHP_OUTPUT

Definition at line 24 of file class.ilFileDelivery.php.

Referenced by ilPHPOutputDelivery\start().

◆ DISP_ATTACHMENT

const ilFileDelivery::DISP_ATTACHMENT = Delivery::DISP_ATTACHMENT

◆ DISP_INLINE

const ilFileDelivery::DISP_INLINE = Delivery::DISP_INLINE

Definition at line 30 of file class.ilFileDelivery.php.

Referenced by ilUtil\deliverFile().


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