mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-12 01:29:28 +00:00
Ausbildungsvertrag kann über das FAS generiert werden,
createAusbildungsvertrag generiert das Dokument
This commit is contained in:
Executable
+243
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at>.
|
||||
*/
|
||||
/* Erstellt einen Lehrauftrag im PDF Format
|
||||
*
|
||||
* Erstellt ein XML File Transformiert dieses mit
|
||||
* Hilfe der XSL-FO Vorlage aus der DB und generiert
|
||||
* daraus ein PDF (xslfo2pdf)
|
||||
*/
|
||||
session_cache_limiter('none'); //muss gesetzt werden sonst funktioniert der Download mit IE8 nicht
|
||||
session_start();
|
||||
require_once('../config/vilesci.config.inc.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
require_once('../include/benutzerberechtigung.class.php');
|
||||
require_once('../include/xslfo2pdf/xslfo2pdf.php');
|
||||
require_once('../include/fop.class.php');
|
||||
require_once('../include/akte.class.php');
|
||||
require_once('../include/vorlage.class.php');
|
||||
|
||||
$user = get_uid();
|
||||
$db = new basis_db();
|
||||
loadVariables($user);
|
||||
|
||||
function clean_string($string)
|
||||
{
|
||||
$trans = array("ä" => "ae",
|
||||
"Ä" => "Ae",
|
||||
"ö" => "oe",
|
||||
"Ö" => "Oe",
|
||||
"ü" => "ue",
|
||||
"Ü" => "Ue",
|
||||
"á" => "a",
|
||||
"à" => "a",
|
||||
"é" => "e",
|
||||
"è" => "e",
|
||||
"ó" => "o",
|
||||
"ò" => "o",
|
||||
"í" => "i",
|
||||
"ì" => "i",
|
||||
"ù" => "u",
|
||||
"ú" => "u",
|
||||
"ß" => "ss");
|
||||
|
||||
$string = strtr($string, $trans);
|
||||
return mb_ereg_replace("[^a-zA-Z0-9]", "", $string);
|
||||
//[:space:]
|
||||
}
|
||||
|
||||
//Parameter holen
|
||||
if(isset($_GET['xml']))
|
||||
$xml=$_GET['xml'];
|
||||
else
|
||||
die('Fehlerhafte1 Parameteruebergabe');
|
||||
|
||||
|
||||
if(isset($_GET['xsl']))
|
||||
$xsl=$_GET['xsl'];
|
||||
else
|
||||
die('Fehlerhafte2 Parameteruebergabe');
|
||||
|
||||
$xsl_stg_kz=0;
|
||||
if(isset($_GET['xsl_stg_kz']))
|
||||
$xsl_stg_kz=$_GET['xsl_stg_kz'];
|
||||
else
|
||||
if(isset($_GET['stg_kz']))
|
||||
$xsl_stg_kz=$_GET['stg_kz'];
|
||||
else
|
||||
if(isset($_GET['uid']) && $_GET['uid']!='')
|
||||
{
|
||||
if(strstr(';',$_GET['uid']))
|
||||
$uids = explode(';',$_GET['uid']);
|
||||
else
|
||||
$uids = $_GET['uid'];
|
||||
//var_dump($uids);
|
||||
$qry = "SELECT student_uid, studiengang_kz FROM public.tbl_student WHERE student_uid='".addslashes($uids[1])."'";
|
||||
if($result_std = $db->db_query($qry))
|
||||
if($db->db_num_rows($result_std)==1)
|
||||
{
|
||||
$row_std = $db->db_fetch_object($result_std);
|
||||
$xsl_stg_kz=$row_std->studiengang_kz;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['xsl_oe_kurzbz']))
|
||||
$xsl_oe_kurzbz=$_GET['xsl_oe_kurzbz'];
|
||||
else
|
||||
$xsl_oe_kurzbz='';
|
||||
|
||||
//Parameter setzen
|
||||
$params='?xmlformat=xml';
|
||||
if(isset($_GET['uid']))
|
||||
$params.='&uid='.$_GET['uid'];
|
||||
if(isset($_GET['version']) && is_numeric($_GET['version']))
|
||||
$version = $_GET['version'];
|
||||
else
|
||||
$version ='';
|
||||
|
||||
$output = (isset($_GET['output'])?$_GET['output']:'odt');
|
||||
|
||||
//Berechtigung pruefen
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($user);
|
||||
|
||||
$xml_url=XML_ROOT.$xml.$params;
|
||||
|
||||
// Load the XML source
|
||||
$xml_doc = new DOMDocument;
|
||||
|
||||
if(!$xml_doc->load($xml_url))
|
||||
die('unable to load xml: '.$xml_url);
|
||||
|
||||
//XSL aus der DB holen
|
||||
$vorlage = new vorlage();
|
||||
if($xsl_oe_kurzbz!='')
|
||||
{
|
||||
$vorlage->getAktuelleVorlage($xsl_oe_kurzbz, $xsl, $version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($xsl_stg_kz=='')
|
||||
$xsl_stg_kz='0';
|
||||
|
||||
$vorlage->getAktuelleVorlage($xsl_stg_kz, $xsl, $version);
|
||||
}
|
||||
|
||||
$xsl_content = $vorlage->text;
|
||||
|
||||
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))
|
||||
die('unable to load xsl');
|
||||
|
||||
// Configure the transformer
|
||||
$proc = new XSLTProcessor;
|
||||
$proc->importStyleSheet($xsl_doc); // attach the xsl rules
|
||||
|
||||
$buffer = $proc->transformToXml($xml_doc);
|
||||
//echo $buffer;
|
||||
//exit;
|
||||
$tempfolder = '/tmp/'.uniqid();
|
||||
mkdir($tempfolder);
|
||||
chdir($tempfolder);
|
||||
file_put_contents('content.xml', $buffer);
|
||||
|
||||
|
||||
$vorlage->getAktuelleVorlage($xsl_stg_kz, 'AusbildStatus', $version);
|
||||
$xsl_content = $vorlage->text;
|
||||
|
||||
|
||||
$xsl_doc = new DOMDocument;
|
||||
if(!$xsl_doc->loadXML($xsl_content))
|
||||
die('unable to load xsl');
|
||||
|
||||
// Configure the transformer
|
||||
$proc = new XSLTProcessor;
|
||||
$proc->importStyleSheet($xsl_doc); // attach the xsl rules
|
||||
|
||||
$buffer1 = $proc->transformToXml($xml_doc);
|
||||
//echo $buffer;
|
||||
//exit;
|
||||
chdir($tempfolder);
|
||||
file_put_contents('styles.xml', $buffer1);
|
||||
|
||||
|
||||
|
||||
$zipfile = DOC_ROOT.'system/vorlage_zip/Ausbildungsver.'.$endung;
|
||||
$tempname_zip = 'out.zip';
|
||||
if(copy($zipfile, $tempname_zip))
|
||||
{
|
||||
exec("zip $tempname_zip content.xml");
|
||||
exec("zip $tempname_zip styles.xml");
|
||||
clearstatcache();
|
||||
|
||||
if($output == 'pdf')
|
||||
{
|
||||
$tempPdfName = 'Ausbildungsver.pdf';
|
||||
exec("unoconv -e IsSkipEmptyPages=false --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="Ausbildungsver.odt"');
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -133,6 +133,7 @@ foreach($addons as $addon)
|
||||
<command id="menu-dokumente-pruefungszeugnis_englisch:command" oncommand="StudentAbschlusspruefungPrintPruefungszeugnisMultiple('englisch');"/>
|
||||
<command id="menu-dokumente-urkunde_deutsch:command" oncommand="StudentAbschlusspruefungPrintUrkundeMultiple('deutsch')"/>
|
||||
<command id="menu-dokumente-urkunde_englisch:command" oncommand="StudentAbschlusspruefungPrintUrkundeMultiple('englisch')"/>
|
||||
<command id="menu-dokumente-ausbildungsvertrag:command" oncommand="StudentPrintAusbildungsvertrag();"/>
|
||||
<command id="menu-extras-reihungstest:command" oncommand="ExtrasShowReihungstest();"/>
|
||||
<command id="menu-extras-firma:command" oncommand="ExtrasShowFirmenverwaltung();"/>
|
||||
<command id="menu-extras-lvverwaltung:command" oncommand="ExtrasShowLVverwaltung();"/>
|
||||
@@ -667,6 +668,12 @@ foreach($addons as $addon)
|
||||
label = "&menu-dokumente-urkunde_englisch.label;"
|
||||
command = "menu-dokumente-urkunde_englisch:command"
|
||||
accesskey = "&menu-dokumente-urkunde_englisch.accesskey;"/>
|
||||
<menuitem
|
||||
id = "menu-dokumente-ausbildungsvertrag"
|
||||
key = "menu-dokumente-ausbildungsvertrag:key"
|
||||
label = "&menu-dokumente-ausbildungsvertrag.label;"
|
||||
command = "menu-dokumente-ausbildungsvertrag:command"
|
||||
accesskey = "&menu-dokumente-ausbildungsvertrag.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<!-- ***** Zusatzmenues inkludieren ***** -->
|
||||
|
||||
@@ -4253,6 +4253,43 @@ function StudentCreateDiplSupplement()
|
||||
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');
|
||||
}
|
||||
|
||||
// ****
|
||||
// * Erstellt das Diploma Supplement fuer einen oder mehrere Studenten
|
||||
// ****
|
||||
function StudentPrintAusbildungsvertrag()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
tree = document.getElementById('student-tree');
|
||||
|
||||
//Markierte Studenten holen
|
||||
var start = new Object();
|
||||
var end = new Object();
|
||||
var numRanges = tree.view.selection.getRangeCount();
|
||||
var paramList= '';
|
||||
|
||||
for (var t = 0; t < numRanges; t++)
|
||||
{
|
||||
tree.view.selection.getRangeAt(t,start,end);
|
||||
for (var v = start.value; v <= end.value; v++)
|
||||
{
|
||||
var col = tree.columns ? tree.columns["student-treecol-uid"] : "student-treecol-uid";
|
||||
var uid=tree.view.getCellText(v,col);
|
||||
paramList += ';'+uid;
|
||||
stg_kz=getTreeCellText(tree,"student-treecol-studiengang_kz", v);
|
||||
}
|
||||
}
|
||||
|
||||
if(paramList.replace(";",'')=='')
|
||||
{
|
||||
alert('Bitte einen Studenten auswaehlen');
|
||||
return false;
|
||||
}
|
||||
|
||||
//PDF erzeugen
|
||||
window.open('<?php echo APP_ROOT; ?>content/createAusbildungsvertrag.php?xml=ausbildungsvertrag.xml.php&xsl=Ausbildungsver&output=pdf&uid='+paramList,'Ausbildungsvertrag', 'height=200,width=350,left=0,top=0,hotkeys=0,resizable=yes,status=no,scrollbars=yes,toolbar=no,location=no,menubar=no,dependent=yes');
|
||||
}
|
||||
|
||||
// ****
|
||||
// * Erstellt die Studienerfolgsbestaetigung fuer einen oder mehrere Studenten
|
||||
// ****
|
||||
|
||||
Reference in New Issue
Block a user