/** * export pdf avec mpdf et liste d'index : Technique HTML to PDF */ public function actionExportPdf() { $criteria = new EMongoCriteria(); $criteria->sort('name', EMongoCriteria::SORT_ASC); $models = Biobank::model()->findAll($criteria); BiobanksPDFExporter::exporter($models); }
/** * each biobank have 2 pages * @param type $pdf * @param type $model * @return type */ public static function getPage($pdf, $model) { $pdf->AddPage(); $pdf->Bookmark($model->name, 0, 0, '', 'B', array(0, 64, 128)); $pdf->SetAutoPageBreak(TRUE, 10); //marge inferieure $pdf->Ln(4); $pdf->SetFont('timesB', '', 11); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(0, 0, $model->name, 0, false, 'L', 0, '', 0, false, 'T', 'M'); $pdf->Ln(4); $pdf->SetFont('times', '', 12); $pdf->Cell(0, 0, 'Identifiant BRIF : ' . $model->identifier, 0, false, 'L', 0, '', 0, false, 'T', 'M'); $logo = isset($model->activeLogo) && $model->activeLogo != null && $model->activeLogo != "" ? Logo::model()->findByPk(new MongoId($model->activeLogo)) : null; if ($logo != null) { $pdf->Image($logo->toSimpleImage(), '', 16, 25, 10, '', '', '', true, 300, 'R'); } $pdf->Ln(6); //affichage du cadre Coordinateur : addresse //color gold //espace vide d une ligne $pdf->Cell(0, 0, '', 0, 1, '', 0, '', 4); $pdf->SetFillColor(255, 215, 0); $pdf->SetFont('helvetica', 'B', 12); $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); $pdf->RoundedRect($x = 10, $y = 35, $w = 190, $h = 30, $r = 3.5, $round_corner = '1111', $style = 'DF'); //color red to text $pdf->SetTextColor(205, 0, 0); $pdf->MultiCell(90, 5, 'Coordinateur:', 0, 'L', 1, 0, '', '', false); $pdf->MultiCell(90, 5, 'Adresse:', 0, 'L', 1, 1, '', '', false); //color black text $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('helvetica', '', 10); $pdf->MultiCell(90, 2, $model->getShortContactInv() . "\n" . $model->getPhoneContact() . "\n" . $model->getEmailContact(), 0, 'L', 1, 0, '', ''); $website = isset($model->website) ? $model->website : ''; $pdf->MultiCell(90, 2, $model->getAddress() . "\n" . $website, 0, 'L', 1, 1, '', ''); $pdf->Ln(7); //add each paragraph with title $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Présentation : ', isset($model->presentation) ? $model->presentation : ''); $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Thématiques : ', isset($model->thematiques) ? $model->thematiques : ''); $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Projets de recherche : ', isset($model->projetRecherche) ? $model->projetRecherche : ''); $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Publications : ', isset($model->publications) ? $model->publications : ''); $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Réseaux : ', isset($model->reseaux) ? $model->reseaux : ''); $pdf = BiobanksPDFExporter::addParagraph($pdf, 'Qualité : ', isset($model->qualite) ? $model->qualite : ''); return $pdf; }