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

Class ilHtmlToPdfTransformerFactory. More...

+ Collaboration diagram for ilHtmlToPdfTransformerFactory:

Public Member Functions

 __construct ($component='')
 ilHtmlToPdfTransformerFactory constructor. More...
 

Data Fields

const PDF_OUTPUT_DOWNLOAD = 'D'
 
const PDF_OUTPUT_INLINE = 'I'
 
const PDF_OUTPUT_FILE = 'F'
 

Protected Member Functions

 generateTempPath ($output)
 
 deliverPDF ($file, $delivery_type)
 
 createOneFileFromArray (array $src)
 

Protected Attributes

 $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilHtmlToPdfTransformerFactory::__construct (   $component = '')

ilHtmlToPdfTransformerFactory constructor.

Parameters
$component

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

27 {
28 global $lng;
29 $this->lng = $lng;
30 }

References $lng.

Member Function Documentation

◆ createOneFileFromArray()

ilHtmlToPdfTransformerFactory::createOneFileFromArray ( array  $src)
protected
Parameters
array$src
Returns
string

Definition at line 100 of file class.ilHtmlToPdfTransformerFactory.php.

101 {
102 $tmp_file = dirname(reset($src)) . '/complete_pages_overview.html';
103 $html_content = '';
104 foreach ($src as $filename) {
105 if (file_exists($filename)) {
106 $html_content .= file_get_contents($filename);
107 }
108 }
109 file_put_contents($tmp_file, $html_content);
110 return $tmp_file;
111 }
$filename
Definition: buildRTE.php:89

References $filename.

◆ deliverPDF()

ilHtmlToPdfTransformerFactory::deliverPDF (   $file,
  $delivery_type 
)
protected
Parameters
$file
$delivery_type
Returns
mixed

Definition at line 82 of file class.ilHtmlToPdfTransformerFactory.php.

83 {
84 if (file_exists($file)) {
85 if (strtoupper($delivery_type) === self::PDF_OUTPUT_DOWNLOAD) {
86 ilUtil::deliverFile($file, basename($file), '', false, true);
87 } elseif (strtoupper($delivery_type) === self::PDF_OUTPUT_INLINE) {
88 ilUtil::deliverFile($file, basename($file), '', true, true);
89 } elseif (strtoupper($delivery_type) === self::PDF_OUTPUT_FILE) {
90 return $file;
91 }
92 return $file;
93 }
94 return false;
95 }
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.

References ilUtil\deliverFile().

+ Here is the call graph for this function:

◆ generateTempPath()

ilHtmlToPdfTransformerFactory::generateTempPath (   $output)
protected
Parameters
$output
Returns
string

Definition at line 36 of file class.ilHtmlToPdfTransformerFactory.php.

37 {
38 $dir = ilUtil::ilTempnam();
39 if (!is_dir($dir)) {
41 }
42
43 $output = preg_replace('#[\\\\/:*?"<>|]#', '-', $output);
44 $output = $dir . '/' . $output;
45 return $output;
46 }
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static makeDirParents($a_dir)
Create a new directory and all parent directories.

References Sabre\VObject\$output, ilUtil\ilTempnam(), and ilUtil\makeDirParents().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilHtmlToPdfTransformerFactory::$lng
protected

Definition at line 20 of file class.ilHtmlToPdfTransformerFactory.php.

Referenced by __construct().

◆ PDF_OUTPUT_DOWNLOAD

const ilHtmlToPdfTransformerFactory::PDF_OUTPUT_DOWNLOAD = 'D'

◆ PDF_OUTPUT_FILE

const ilHtmlToPdfTransformerFactory::PDF_OUTPUT_FILE = 'F'

Definition at line 14 of file class.ilHtmlToPdfTransformerFactory.php.

◆ PDF_OUTPUT_INLINE

const ilHtmlToPdfTransformerFactory::PDF_OUTPUT_INLINE = 'I'

Definition at line 13 of file class.ilHtmlToPdfTransformerFactory.php.


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