Fix deco javascript: current grade was not properly selected
[platal.git] / modules / carnet / contacts.pdf.inc.php
index e50bf96..df02258 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
 
 define ('FPDF_FONTPATH', dirname(__FILE__).'/fonts/');
 require_once '/usr/share/fpdf/fpdf.php';
-require_once dirname(__FILE__).'/../../classes/varstream.php';
+
+VarStream::init();
 
 class ContactsPDF extends FPDF
 {
-    var $col = 0;
-    var $y0;
+    public $title  = "Mes contacts sur Polytechnique.org";
+
+    private $col = 0;
+    private $y0;
 
-    var $title  = "Mes contacts sur Polytechnique.org";
-    var $broken = false;
-    var $error  = false;
+    private $broken = false;
+    private $error  = false;
 
-    var $report = 0;
+    private $report = 0;
 
     function ContactsPDF()
     {
@@ -88,8 +90,8 @@ class ContactsPDF extends FPDF
         $this->SetFont('Vera Sans', 'B', 20);
         $this->SetTextColor(230);
         $this->Rotate(45, 55, 190);
-        $this->Text(55, 190, "informations limitées à un usage");
-        $this->Text(40, 210, "strictement personnel et non commercial");
+        $this->Text(55, 190, utf8_decode("informations limitées à un usage"));
+        $this->Text(40, 210, utf8_decode("strictement personnel et non commercial"));
         $this->Rotate(0);
 
         $this->setLeftMargin(5);
@@ -215,7 +217,7 @@ class ContactsPDF extends FPDF
         }
 
         if ($a['tel']) {
-            $this->TableRow('Téléphone', $a['tel'], 'Mono');
+            $this->TableRow(utf8_decode('Téléphone'), $a['tel'], 'Mono');
         }
         if ($a['fax']) {
             $this->TableRow('Fax', $a['fax'], 'Mono');
@@ -315,6 +317,11 @@ class ContactsPDF extends FPDF
 
         foreach ($x['adr'] as $a) {
             $self->Space();
+            foreach ($a as &$value) {
+                if (is_utf8($value)) {
+                    $value = utf8_decode($value);
+                }
+            }
             $self->Address($a);
         }
 
@@ -325,6 +332,11 @@ class ContactsPDF extends FPDF
                 {
                     continue;
                 }
+                foreach ($a as &$value) {
+                    if (is_utf8($value)) {
+                        $value = utf8_decode($value);
+                    }
+                }
                 $self->Space();
                 $self->AddressPro($a);
             }
@@ -339,7 +351,7 @@ class ContactsPDF extends FPDF
 
         return $self;
     }
-
 }
 
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>