public function executePrint(sfWebRequest $request) { $illustration = $this->getIllustration($request); if (empty($illustration)) { $image = new Image('images/' . 'no-picture.jpg'); } else { $image = convertImageToThumb::resize(sfConfig::get('app_images_upload_dir'), $illustration->getFichierSource(), 'print'); } return $this->displayImage($image); }
public function addIllustration($identification) { $this->AddPage(); $this->addPageTitle('ILLUSTRATIONS'); $this->ln(8); $i = 60; $nbr = 0; $title = ''; $illustration_array = array(); $illustrations = Doctrine_Query::create()->from('Illustration i')->leftJoin('i.BibIllustration bi')->where('i.indexbatiment = ?', array($identification->getIndexbatiment()))->orderBy('bi.ordre_illustration')->execute(); foreach ($illustrations as $illustration) { $illustration_array[] = $illustration; } for ($number = 0; isset($illustration_array[$number]); $number++) { $temp = $number % 4; if ($temp == 0) { $i = 60; } else { $i = 160; } if ($nbr == 2) { $old_y = 10; $nbr = 0; $this->AddPage(); $this->addPageTitle('ILLUSTRATIONS'); $this->ln(8); } $label1 = utf8_decode($illustration_array[$number]->getBibIllustration()->getIllustration()); $this->SetFont('Arial', 'B', 9); //$this->Cell(100, 30, utf8_decode(strtoupper($illustration_array[$number]->getBibIllustration()->getIllustration())), 0, 0, 'L', 0); if (isset($illustration_array[$number + 1])) { $label2 = utf8_decode($illustration_array[$number + 1]->getBibIllustration()->getIllustration()); //$this->Cell(100, 30, utf8_decode(strtoupper($illustration_array[$number+1]->getBibIllustration()->getIllustration())), 0, 0, 'L', 0); //$this->Ln(5); } //$this->SetFont('Arial', 'B', 9); if ($illustration_array[$number]->getBibPersonnes()) { //$this->Cell(30, 30, utf8_decode('Auteur : '), 0, 0, 'L', 0); $this->SetFont('Arial', '', 8); $label1 = $label1 . ', ' . utf8_decode($illustration_array[$number]->getBibPersonnes()->getPersonne()); //$this->Cell(70, 30, utf8_decode($illustration_array[$number]->getBibPersonnes()->getPersonne()), 0, 0, 'L', 0); if (isset($illustration_array[$number + 1]) && $illustration_array[$number + 1]->getBibPersonnes()) { //$this->SetFont('Arial', 'B', 9); //$this->Cell(30, 30, utf8_decode('Auteur : '), 0, 0, 'L', 0); $this->SetFont('Arial', '', 8); $label2 = $label2 . ', ' . utf8_decode($illustration_array[$number + 1]->getBibPersonnes()->getPersonne()); //$this->Cell(70, 30, utf8_decode($illustration_array[$number+1]->getBibPersonnes()->getPersonne()), 0, 0, 'L', 0); } } if ($illustration_array[$number]->getDateIllustration()) { //$this->SetFont('Arial', 'B', 9); //$this->Cell(30, 30, utf8_decode('Date : '), 0, 0, 'L', 0); $this->SetFont('Arial', '', 8); $label1 = $label1 . ', ' . format_date($illustration_array[$number]->getDateIllustration(), 'dd/MM/yyyy', 'fr'); if (isset($illustration_array[$number + 1])) { //$this->SetFont('Arial', 'B', 9); //$this->Cell(30, 30, utf8_decode('Date : '), 0, 0, 'L', 0); $this->SetFont('Arial', '', 8); $label2 = $label2 . ', ' . format_date($illustration_array[$number + 1]->getDateIllustration(), 'dd/MM/yyyy', 'fr'); } //$this->Ln(7); } $this->Cell(70, 30, $label1, 0, 0, 'L', 0); $this->Cell(40, 30, $this->Image(sfConfig::get('app_images_upload_dir') . convertImageToThumb::resize(sfConfig::get('app_images_upload_dir'), $illustration_array[$number]->getFichierSource(), 'pdf')->url, 10, $i, 0, 0, ''), 0, 0, 'L', 0); //$this->Cell(40, 30, $this->Image(sfConfig::get('app_images_upload_dir').$illustration_array[$number]->getFichierSource(),10,$i,0,0,''), 0, 0, 'L', 0); if (isset($illustration_array[$number + 1])) { $this->Cell(70, 30, $label2, 0, 0, 'L', 0); //$this->Cell(40, 30, $this->Image(sfConfig::get('app_images_upload_dir').$illustration_array[$number]->getFichierSource(),110,$i,0,0,''), 0, 0, 'L', 0); $this->Cell(40, 30, $this->Image(sfConfig::get('app_images_upload_dir') . convertImageToThumb::resize(sfConfig::get('app_images_upload_dir'), $illustration_array[$number + 1]->getFichierSource(), 'pdf')->url, 110, $i, 0, 0, ''), 0, 0, 'L', 0); } $this->Ln(100); $nbr++; $title = $illustration_array[$number]->getBibIllustration()->getIllustration(); $number++; } }