From d80f51b44661d2d93df94dee3d72794b416a6d26 Mon Sep 17 00:00:00 2001 From: kindlm Date: Fri, 24 Jul 2015 11:38:55 +0200 Subject: [PATCH] PDF-Export prueft ob style in DB vorhanden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wenn in der DB ein style hinterlegt ist, wird dieses verwendet, ansonsten das xsl-style, welches übergeben wird. --- content/pdfExport.php | 52 +++++++++++++------ include/vorlage.class.php | 19 +++++-- .../dokumentvorlagen_verwaltung.php | 6 +++ 3 files changed, 58 insertions(+), 19 deletions(-) diff --git a/content/pdfExport.php b/content/pdfExport.php index 8d9b7220f..cd7ba1b2a 100644 --- a/content/pdfExport.php +++ b/content/pdfExport.php @@ -341,14 +341,24 @@ if (!isset($_REQUEST["archive"])) // Wenn ein Style XSL uebergeben wurde wird ein zweites XML File erstellt mit den // Styleanweisungen und ebenfalls zum Zip hinzugefuegt - if(isset($_GET['style_xsl'])) + if(isset($_GET['style_xsl']) || $vorlage->style!='') { - $style_xsl=$_GET['style_xsl']; - $style_vorlage = new vorlage(); - $style_vorlage->getAktuelleVorlage($xsl_stg_kz, $style_xsl, $version); - $style_xsl_doc = new DOMDocument; - if(!$style_xsl_doc->loadXML($style_vorlage->text)) - die('unable to load xsl'); + //Wenn die Spalte style in der DB befuellt ist, wird dieses verwendet + if($vorlage->style!='') + { + $style_xsl_doc = new DOMDocument; + if(!$style_xsl_doc->loadXML($vorlage->style)) + die('unable to load xsl from tbl_vorlagestudiengang'); + } + else + { + $style_xsl=$_GET['style_xsl']; + $style_vorlage = new vorlage(); + $style_vorlage->getAktuelleVorlage($xsl_stg_kz, $style_xsl, $version); + $style_xsl_doc = new DOMDocument; + if(!$style_xsl_doc->loadXML($style_vorlage->text)) + die('unable to load xsl'); + } // Configure the transformer $style_proc = new XSLTProcessor; @@ -380,7 +390,7 @@ if (!isset($_REQUEST["archive"])) if(copy($zipfile, $tempname_zip)) { exec("zip $tempname_zip content.xml"); - if(isset($_GET['style_xsl'])) + if(isset($_GET['style_xsl']) || $vorlage->style!='') exec("zip $tempname_zip styles.xml"); clearstatcache(); @@ -464,7 +474,7 @@ if (!isset($_REQUEST["archive"])) fclose($handle); unlink('content.xml'); - if(isset($_GET['style_xsl'])) + if(isset($_GET['style_xsl']) || $vorlage->style!='') unlink('styles.xml'); unlink($tempname_zip); if($output=='pdf' || $output=='doc') @@ -595,12 +605,22 @@ else // Styleanweisungen und ebenfalls zum Zip hinzugefuegt if(isset($_GET['style_xsl'])) { - $style_xsl=$_GET['style_xsl']; - $style_vorlage = new vorlage(); - $style_vorlage->getAktuelleVorlage($xsl_stg_kz, $style_xsl, $version); - $style_xsl_doc = new DOMDocument; - if(!$style_xsl_doc->loadXML($style_vorlage->text)) - die('unable to load xsl'); + //Wenn die Spalte style in der DB befuellt ist, wird dieses verwendet + if($vorlage->style!='') + { + $style_xsl_doc = new DOMDocument; + if(!$style_xsl_doc->loadXML($vorlage->style)) + die('unable to load xsl from tbl_vorlagestudiengang'); + } + else + { + $style_xsl=$_GET['style_xsl']; + $style_vorlage = new vorlage(); + $style_vorlage->getAktuelleVorlage($xsl_stg_kz, $style_xsl, $version); + $style_xsl_doc = new DOMDocument; + if(!$style_xsl_doc->loadXML($style_vorlage->text)) + die('unable to load xsl'); + } // Configure the transformer $style_proc = new XSLTProcessor; @@ -632,7 +652,7 @@ else if(copy($zipfile, $tempname_zip)) { exec("zip $tempname_zip content.xml"); - if(isset($_GET['style_xsl'])) + if(isset($_GET['style_xsl']) || $vorlage->style!='') exec("zip $tempname_zip styles.xml"); clearstatcache(); diff --git a/include/vorlage.class.php b/include/vorlage.class.php index ad4f7a820..5da7d1be2 100644 --- a/include/vorlage.class.php +++ b/include/vorlage.class.php @@ -240,12 +240,15 @@ class vorlage extends basis_db */ public function getOEsFromVorlage($vorlage_kurzbz=null) { - $qry ="SELECT - oe_kurzbz + $qry ="SELECT DISTINCT + tbl_organisationseinheit.* FROM public.tbl_vorlagestudiengang + JOIN + public.tbl_organisationseinheit USING (oe_kurzbz) WHERE - vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz); + vorlage_kurzbz=".$this->db_add_param($vorlage_kurzbz)." + ORDER BY oe_kurzbz"; if($result = $this->db_query($qry)) { @@ -253,6 +256,12 @@ class vorlage extends basis_db { $obj = new vorlage(); $obj->oe_kurzbz = $row->oe_kurzbz; + $obj->oe_parent_kurzbz = $row->oe_parent_kurzbz; + $obj->bezeichnung = $row->bezeichnung; + $obj->organisationseinheittyp_kurzbz = $row->organisationseinheittyp_kurzbz; + $obj->aktiv = $this->db_parse_bool($row->aktiv); + $obj->mailverteiler = $this->db_parse_bool($row->mailverteiler); + $obj->lehre = $this->db_parse_bool($row->lehre); $this->result[]= $obj; } @@ -428,6 +437,10 @@ class vorlage extends basis_db $this->text = $row->text; $this->mimetype = $row->mimetype; $this->bezeichnung = $row->bezeichnung; + $this->style = $row->style; + $this->berechtigung = $row->berechtigung; + $this->anmerkung_vorlagestudiengang = $row->anmerkung_vorlagestudiengang; + return true; } else diff --git a/vilesci/stammdaten/dokumentvorlagen_verwaltung.php b/vilesci/stammdaten/dokumentvorlagen_verwaltung.php index 0250f659a..acb05a424 100644 --- a/vilesci/stammdaten/dokumentvorlagen_verwaltung.php +++ b/vilesci/stammdaten/dokumentvorlagen_verwaltung.php @@ -195,6 +195,12 @@ echo ''; $organisationseinheit = new vorlage(); $organisationseinheit->getOEsFromVorlage($vorlage_kurzbz); +if ($organisationseinheit->result=='') +{ + $organisationseinheit = new organisationseinheit(); + $organisationseinheit->getAll(); +} + echo "