mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-06 05:19:28 +00:00
pdf konvertieren hinzgefügt
This commit is contained in:
+43
-8
@@ -124,6 +124,8 @@ if(isset($_GET['typ']))
|
||||
$params.='&typ='.$_GET['typ'];
|
||||
if(isset($_GET['all']))
|
||||
$params.='&all='.$_GET['all'];
|
||||
if(isset($_GET['preoutgoing_id']))
|
||||
$params.='&preoutgoing_id='.$_GET['preoutgoing_id'];
|
||||
if(isset($_GET["lvid"]))
|
||||
$params.='&lvid='.$_GET["lvid"];
|
||||
if(isset($_GET['projekt_kurzbz']))
|
||||
@@ -133,6 +135,8 @@ if(isset($_GET['version']) && is_numeric($_GET['version']))
|
||||
else
|
||||
$version ='';
|
||||
|
||||
$output = (isset($_GET['output'])?$_GET['output']:'odt');
|
||||
|
||||
if($xsl=='AccountInfo')
|
||||
{
|
||||
$isberechtigt = false;
|
||||
@@ -242,9 +246,21 @@ if(isset($_GET['uid']) && $_GET['uid']!='')
|
||||
$filename=$xsl.$nachname;
|
||||
|
||||
if (!isset($_REQUEST["archive"]))
|
||||
{
|
||||
{
|
||||
if(mb_strstr($vorlage->mimetype, 'application/vnd.oasis.opendocument'))
|
||||
{
|
||||
switch($vorlage->mimetype)
|
||||
{
|
||||
case 'application/vnd.oasis.opendocument.text':
|
||||
$endung = 'odt';
|
||||
break;
|
||||
case 'application/vnd.oasis.opendocument.spreadsheet':
|
||||
$endung = 'ods';
|
||||
break;
|
||||
default:
|
||||
$endung = 'pdf';
|
||||
}
|
||||
|
||||
// Load the XSL source
|
||||
$xsl_doc = new DOMDocument;
|
||||
if(!$xsl_doc->loadXML($xsl_content))
|
||||
@@ -261,28 +277,47 @@ if (!isset($_REQUEST["archive"]))
|
||||
mkdir($tempfolder);
|
||||
chdir($tempfolder);
|
||||
file_put_contents('content.xml', $buffer);
|
||||
$zipfile = DOC_ROOT.'system/vorlage_zip/'.$vorlage->vorlage_kurzbz.'.ods';
|
||||
|
||||
$zipfile = DOC_ROOT.'system/vorlage_zip/'.$vorlage->vorlage_kurzbz.'.'.$endung;
|
||||
$tempname_zip = 'out.zip';
|
||||
if(copy($zipfile, $tempname_zip))
|
||||
{
|
||||
exec("zip $tempname_zip content.xml");
|
||||
clearstatcache();
|
||||
$fsize = filesize($tempname_zip);
|
||||
$handle = fopen($tempname_zip,'r');
|
||||
header('Content-type: '.$vorlage->mimetype);
|
||||
header('Content-Disposition: attachment; filename="'.$vorlage->vorlage_kurzbz.'.ods"');
|
||||
header('Content-Length: '.$fsize);
|
||||
if($output == 'pdf')
|
||||
{
|
||||
$tempPdfName = $vorlage->vorlage_kurzbz.'.pdf';
|
||||
exec("unoconv --stdout -f pdf $tempname_zip > $tempPdfName");
|
||||
|
||||
$fsize = filesize($tempPdfName);
|
||||
$handle = fopen($tempPdfName,'r');
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: attachment; filename="'.$tempPdfName.'"');
|
||||
header('Content-Length: '.$fsize);
|
||||
}
|
||||
else if($output =='odt')
|
||||
{
|
||||
$fsize = filesize($tempname_zip);
|
||||
$handle = fopen($tempname_zip,'r');
|
||||
header('Content-type: '.$vorlage->mimetype);
|
||||
header('Content-Disposition: attachment; filename="'.$vorlage->vorlage_kurzbz.'.'.$endung.'"');
|
||||
header('Content-Length: '.$fsize);
|
||||
}
|
||||
|
||||
while (!feof($handle))
|
||||
{
|
||||
echo fread($handle, 8192);
|
||||
}
|
||||
fclose($handle);
|
||||
|
||||
unlink('content.xml');
|
||||
unlink($tempname_zip);
|
||||
if($output=='pdf')
|
||||
unlink($tempPdfName);
|
||||
rmdir($tempfolder);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if(PDF_CREATE_FUNCTION=='FOP')
|
||||
{
|
||||
|
||||
@@ -4245,8 +4245,8 @@ function StudentCreateDiplSupplement()
|
||||
return false;
|
||||
}
|
||||
|
||||
//PDF erzeugen
|
||||
window.open('<?php echo APP_ROOT; ?>content/pdfExport.php?xml=diplomasupplement.xml.php&xsl=DiplSupplement&xsl_stg_kz='+stg_kz+'&uid='+paramList,'DiplomaSupplement', 'height=200,width=350,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=yes,toolbar=no,location=no,menubar=no,dependent=yes');
|
||||
//PDF erzeugen
|
||||
window.open('<?php echo APP_ROOT; ?>content/pdfExport.php?xml=diplomasupplement.xml.php&output=pdf&xsl=DiplSupplement&xsl_stg_kz='+stg_kz+'&uid='+paramList,'DiplomaSupplement', 'height=200,width=350,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=yes,toolbar=no,location=no,menubar=no,dependent=yes');
|
||||
}
|
||||
|
||||
// ****
|
||||
|
||||
Reference in New Issue
Block a user