232 lines
6.8 KiB
PHP
232 lines
6.8 KiB
PHP
<?php require_once '../vendor/autoload.php';
|
|
|
|
|
|
/* (1) Initialize PDF
|
|
---------------------------------------------------------*/
|
|
/* (1) Get Font default directory */
|
|
$defaultConfig = (new Mpdf\Config\ConfigVariables())->getDefaults();
|
|
$fontDirs = $defaultConfig['fontDir'];
|
|
|
|
/* (2) Get Font data */
|
|
$defaultFontConfig = (new Mpdf\Config\FontVariables())->getDefaults();
|
|
$fontData = $defaultFontConfig['fontdata'];
|
|
|
|
/* (3) Create PDF file */
|
|
$pdf = new \Mpdf\Mpdf([
|
|
'mode' => 'utf-8',
|
|
'defaultCssFile' => __PUBLIC__.'/css/pdf.css',
|
|
'tempDir' => __ROOT__.'/tmp',
|
|
'fontDir' => array_merge($fontDirs, [ __PUBLIC__.'/font/' ]),
|
|
'fontdata' => $fontData + [
|
|
'Fira Sans' => [
|
|
'R' => 'FiraSans-Regular.ttf'
|
|
]
|
|
],
|
|
'default_font' => 'Fira Sans'
|
|
]);
|
|
|
|
/* (4) Set PDF title */
|
|
$pdf->SetTitle('Some PDF title');
|
|
|
|
/* (5) Store SVG */
|
|
$svg_warning = '<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" height="10" width="10" viewBox="0 0 1792 1792">
|
|
<path d="m 1024,1375 v -190 q 0,-14 -9.5,-23.5 Q 1005,1152 992,1152 H 800 q -13,0 -22.5,9.5 -9.5,9.5 -9.5,23.5 v 190 q 0,14 9.5,23.5 9.5,9.5 22.5,9.5 h 192 q 13,0 22.5,-9.5 9.5,-9.5 9.5,-23.5 z m -2,-374 18,-459 q 0,-12 -10,-19 -13,-11 -24,-11 H 786 q -11,0 -24,11 -10,7 -10,21 l 17,457 q 0,10 10,16.5 10,6.5 24,6.5 h 185 q 14,0 23.5,-6.5 9.5,-6.5 10.5,-16.5 z m -14,-934 768,1408 q 35,63 -2,126 -17,29 -46.5,46 -29.5,17 -63.5,17 H 128 Q 94,1664 64.5,1647 35,1630 18,1601 -19,1538 16,1475 L 784,67 q 17,-31 47,-49 30,-18 65,-18 35,0 65,18 30,18 47,49 z" style="fill: #ea4b35" />
|
|
</svg>';
|
|
|
|
|
|
|
|
|
|
/* (2) Set Header|Footer
|
|
---------------------------------------------------------*/
|
|
/* (1) Set Header content (Left, Right) */
|
|
$header_content = [
|
|
'C' => [ 'color' => '#aaa', 'content' => 'Fiche enseignant Sophie Gouardères (sgouarde)' ],
|
|
'line' => 1
|
|
];
|
|
|
|
/* (2) Apply Header */
|
|
$pdf->setHeader([
|
|
'odd' => $header_content,
|
|
'even' => $header_content
|
|
]);
|
|
|
|
/* (1) Set Footer content (Left, Right) */
|
|
$footer_content = [
|
|
'L' => [ 'color' => '#aaa', 'content' => 'Généré le @date_création' ],
|
|
'R' => [ 'color' => '#aaa', 'content' => 'Page {PAGENO} sur {nbpg}' ],
|
|
'line' => 1
|
|
];
|
|
|
|
/* (2) Apply Footer */
|
|
$pdf->setFooter([
|
|
'odd' => $footer_content,
|
|
'even' => $footer_content
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
/* (3) Page 1 - Récapitulatif
|
|
---------------------------------------------------------*/
|
|
/* (1) Initialize page */
|
|
$pdf->AddPage();
|
|
|
|
/* (2) Write content */
|
|
$pdf->WriteHTML('<br>
|
|
<h3>1. Récapitulatif</h3>
|
|
<hr>
|
|
|
|
<article>
|
|
<p>
|
|
Mollitia quo ullam voluptas quia delectus nihil ab. (<a href="https://git.xdrm.io">cliquer ici</a>) Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
|
|
</p>
|
|
|
|
<blockquote>
|
|
Mollitia quo ullam voluptas quia delectus nihil ab. Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
|
|
</blockquote>
|
|
|
|
<p class="warning">
|
|
Mollitia quo ullam voluptas quia delectus nihil ab. (<a href="https://git.xdrm.io">cliquer ici</a>) Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
|
|
</p>
|
|
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<td class="color ac">Donnée</td>
|
|
<td class="color ac">Valeur</td>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<tr>
|
|
<td class="ar">Heures à faire</td>
|
|
<td>192 h</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="ar">Equivalents TD</td>
|
|
<td>241.41 h</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="ar">Heures programmées</td>
|
|
<td>217.5 h</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="ar">Heures manquantes</td>
|
|
<td>'.$svg_warning.' 10 h </td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="ar">Heures sup.</td>
|
|
<td>0</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</article>
|
|
|
|
');
|
|
|
|
|
|
|
|
/* (4) Page 2 - Enseignements
|
|
---------------------------------------------------------*/
|
|
/* (1) Initialize page */
|
|
$pdf->AddPage();
|
|
|
|
/* (2) Write content */
|
|
$pdf->WriteHTML('<br>
|
|
<h3>2. Enseignements</h3>
|
|
<hr>
|
|
|
|
<article>
|
|
<p>
|
|
Mollitia quo ullam voluptas quia delectus nihil ab. (<a href="https://git.xdrm.io">cliquer ici</a>) Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
|
|
</p>
|
|
|
|
<blockquote>
|
|
Mollitia quo ullam voluptas quia delectus nihil ab. Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
|
|
</blockquote>
|
|
|
|
<p>
|
|
Mollitia quo ullam voluptas quia delectus nihil ab. (<a href="https://git.xdrm.io">cliquer ici</a>) Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
|
|
</p>
|
|
|
|
<br><br><br>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th colspan="5" class="ac">Liste des enseignements programmés</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="color ac">Code UE</td>
|
|
<td class="color ac">Nom UE</td>
|
|
<td class="color ac">Prestation</td>
|
|
<td class="color ac">volume horaire</td>
|
|
<td class="color ac">formations</td>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<tr>
|
|
<td>T0XALA2V</td>
|
|
<td>Algorithmique avancée</td>
|
|
<td>Cours</td>
|
|
<td>13.5 heures</td>
|
|
<td><ul>
|
|
<li>MIASHS</li>
|
|
<li>L1 INFO (S2)</li>
|
|
</ul></td>
|
|
</tr>
|
|
<tr>
|
|
<td>T0XALA2V</td>
|
|
<td>Algorithmique avancée</td>
|
|
<td>TD</td>
|
|
<td>22 heures</td>
|
|
<td><ul>
|
|
<li>L1 INFO (S2)</li>
|
|
</ul></td>
|
|
</tr>
|
|
<tr>
|
|
<td>T0XALA2V</td>
|
|
<td>Algorithmique avancée</td>
|
|
<td>TP</td>
|
|
<td>5 heures</td>
|
|
<td><ul>
|
|
<li>MIASHS</li>
|
|
<li>L1 INFO (S2)</li>
|
|
<li>L2 INFO (S2)</li>
|
|
</ul></td>
|
|
</tr>
|
|
<tr>
|
|
<td>T0MSAP3U</td>
|
|
<td>Algorithmique et programmation avancée</td>
|
|
<td>TP</td>
|
|
<td>12 heures</td>
|
|
<td><ul>
|
|
<li>MIASHS</li>
|
|
<li>L1 INFO (S2)</li>
|
|
<li>L2 INFO (S2)</li>
|
|
</ul></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</article>
|
|
|
|
|
|
');
|
|
|
|
|
|
|
|
|
|
/* (N) Print out PDF file
|
|
---------------------------------------------------------*/
|
|
|
|
$pdf->Output();
|
|
|
|
|