X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fcarnet%2Fcontacts.pdf.inc.php;h=a981b1c7045a1e626a8e18a7487f94e72b504d40;hb=80ea68bd56df9e85011b4783dbf5aa62fd293795;hp=573d7a9e57ac23f4d5350f9222bdc4c7fcf529ed;hpb=ca3f3ae9f986af87b67d0ced54664d518fd754de;p=platal.git diff --git a/modules/carnet/contacts.pdf.inc.php b/modules/carnet/contacts.pdf.inc.php index 573d7a9..a981b1c 100644 --- a/modules/carnet/contacts.pdf.inc.php +++ b/modules/carnet/contacts.pdf.inc.php @@ -1,6 +1,6 @@ TableRow($l, utf8_decode($a->text)); foreach ($a->phones() as $phone) { - $this->TableRow(utf8_decode($phone->type), + $this->TableRow(utf8_decode($phone->displayType()), utf8_decode($phone->display), 'Mono'); } } @@ -204,7 +204,7 @@ class ContactsPDF extends FPDF $this->TableRow('adresse pro', utf8_decode($a->address()->text)); } foreach ($a->phones() as $phone) { - $this->TableRow(utf8_decode($phone->type), + $this->TableRow(utf8_decode($phone->displayType()), utf8_decode($phone->display), 'Mono'); } } @@ -244,7 +244,7 @@ class ContactsPDF extends FPDF return $count; } - public static function AddContact(ContactsPDF $self, Profile &$profile, $wp = true) + public static function AddContact(ContactsPDF $self, Profile $profile, $wp = true) { /* infamous hack : 1- we store the current state. @@ -265,23 +265,27 @@ class ContactsPDF extends FPDF if ($wp) { $photo = $profile->getPhoto(false, true); if ($photo) { - $old2 = clone $self; - $width = $photo->width() * 20 / $photo->height(); - $_x = $self->getX(); - $_y = $self->getY(); - $self->Cell(0, 20, '', '', 0, '', 1); - error_reporting(0); - $self->Image($photo->path(), $_x, $_y, $width, 20, $photo->mimeType()); - error_reporting($self->report); - - if ($self->error) { - $self = clone $old2; - } else { - $self->setX($_x); - $self->Cell($width, 20, '', "T"); - $h = 20 / $self->wordwrap($nom, 90 - $width); - $self->MultiCell(0, $h, $nom, 'T', 'C'); - $ok = true; + list(, $type) = explode('/', $photo->mimeType()); + $type = ($type == 'jpeg') ? 'jpg' : $type; + if (method_exists($self, '_parse' . $type)) { + $old2 = clone $self; + $width = $photo->width() * 20 / $photo->height(); + $_x = $self->getX(); + $_y = $self->getY(); + $self->Cell(0, 20, '', '', 0, '', 1); + error_reporting(0); + $self->Image($photo->path(), $_x, $_y, $width, 20, $type); + error_reporting($self->report); + + if ($self->error) { + $self = clone $old2; + } else { + $self->setX($_x); + $self->Cell($width, 20, '', "T"); + $h = 20 / $self->wordwrap($nom, 90 - $width); + $self->MultiCell(0, $h, $nom, 'T', 'C'); + $ok = true; + } } } }