Code

Updated exporter class
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Sep 2009 13:45:32 +0000 (13:45 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Sep 2009 13:45:32 +0000 (13:45 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14270 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/exporter/class_pdfExporter.inc
gosa-core/include/php_setup.inc

index 93b1127e87ae349da00b216752c4a45d6fa1177e..f1c5f8918d36f4fa62d23a7e4b360f56f5fd38c5 100644 (file)
@@ -1,12 +1,7 @@
 <?php
 
-// Try to load PDF library
-define('FPDF_FONTPATH', '/usr/share/php/fpdf/font/');
-@include('fpdf/fpdf.php');
-
 // Load supporter class only if FPDF is loaded
-$classes= get_declared_classes();
-if(in_array('FPDF', $classes)) {
+if(class_exists('FPDF')) {
   include('class_PDF.inc');
 }
 
@@ -15,6 +10,11 @@ class pdfExporter
   var $result;
 
   function pdfExporter($headline, $header, $entries, $columns= array()) {
+    // Bail out if no FPDF available
+    if(!class_exists('FPDF')) {
+      die(_("No PDF export possible: there is no FPDF library installed."));
+    }
+
     // If no preset, render all columns
     if (!count($columns)) {
       foreach ($header as $index => $dummy) {
index 920a7fe5b8cf006609a0776adefe9a92a551230a..9ba0e4dacaa1140070b794bccf403d8652e45344 100644 (file)
@@ -291,6 +291,9 @@ $smarty->template_dir = $BASE_DIR.'/ihtml/';
 $smarty->caching= false;
 $smarty->php_handling= SMARTY_PHP_REMOVE;
 
+// Try to load PDF library
+define('FPDF_FONTPATH', '/usr/share/php/fpdf/font/');
+@include('fpdf/fpdf.php');
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>