// Recherche des tailles de polices optimales // Une taille sans importance, histoire de tester $pdf->SetFont($fonte, '', 12); // Recherche du plus long nom_prenom $texte_test[1] = "Edmou Dugenou"; $longueur_max_nom_prenom = 0; $largeur_col[1] = $largeur_col_nom_ele; for ($i = $ligne_supl; $i <= count($col_csv[1]); $i++) { /* // Le COL_CSV ne contient pas le nom prénom d'un élève qui n'a aucune note dans aucune matière echo "<pre>"; print_r($col_csv); echo "</pre>"; */ if (isset($col_csv[1][$i])) { $longueur_courante = $pdf->GetStringWidth($col_csv[1][$i]); if ($longueur_courante > $longueur_max_nom_prenom) { $texte_test[1] = $col_csv[1][$i]; $longueur_max_nom_prenom = $longueur_courante; } } } $taille_police_col[1] = ajuste_FontSize($texte_test[1], $largeur_col[1], 12, 'B', 3); for ($i = 2; $i <= count($ligne1_csv); $i++) { if (preg_match("/^Date de naiss/", $ligne1_csv[$i])) { $largeur_col[$i] = 15; $texte_test[$i] = "99/99/99"; } else { $largeur_col[$i] = $largeur_col_notes; $texte_test[$i] = "disp"; }
// $col_csv[1] contient la première colonne du tableau affiché et son indice commence à 0 avec le nom du premier élève ou le coefficient s'il est affiché //for($i=1;$i<=count($col_csv[1]);$i++) { //for($i=0;$i<=count($col_csv[1]);$i++) { for ($i = 0; $i <= count($col[1]); $i++) { // Si on n'affiche pas de coefficient, on ne va pas jusqu'à count($col_csv[1] $chaine_test = ""; if (isset($col_csv[1][$i])) { $chaine_test = $col_csv[1][$i]; } elseif (isset($col[1][$i])) { $chaine_test = $col[1][$i]; } if ($chaine_test != "") { //echo "\$col_csv[1][$i]=".$col_csv[1][$i]."\n"; //$longueur_courante=$pdf->GetStringWidth($col_csv[1][$i]); //$longueur_courante=$pdf->GetStringWidth($col[1][$i]); $longueur_courante = $pdf->GetStringWidth($chaine_test); if ($longueur_courante > $longueur_max_nom_prenom) { //$texte_test[1]=$col_csv[1][$i]; //$texte_test[1]=$col[1][$i]; $texte_test[1] = $chaine_test; $longueur_max_nom_prenom = $longueur_courante; } } } $taille_police_col[1] = ajuste_FontSize($texte_test[1], $largeur_col[1], 12, 'B', 3); /* echo "\n"; print_r($ligne1_csv); echo "\n"; */ // $ligne1_csv contient la première ligne du tableau affiché et son indice commence à 1 avec le Nom_prenom de l'eleve
net.type_brevet='$type_brevet' ORDER BY e.login;"; $res1=mysqli_query($GLOBALS["mysqli"], $sql); if(mysqli_num_rows($res1)>0) { // Boucle sur la liste des élèves while($lig1=mysqli_fetch_object($res1)) { $pdf->AddPage('L'); //ajout d'une page au document //================================================ // ENTETE DE PAGE //$pdf->SetFont('DejaVu'); $pdf->SetFont('DejaVu','',$fs_titre); $pdf->SetXY($marge,$marge); $texte="NOMS et PRENOMS : ".mb_strtoupper($lig1->nom)." ".ucfirst(mb_strtolower($lig1->prenom)); $pdf->Cell($pdf->GetStringWidth($texte),$pdf->FontSize*$sc_interligne, $texte,0,0,'L'); $texte1="FICHE SCOLAIRE BREVET - "; $l1=$pdf->GetStringWidth($texte1); $texte3=" SESSION : ".$fb_session; $l3=$pdf->GetStringWidth($texte3); $pdf->SetFont('DejaVu','B',$fs_titre); $texte2="SERIE ".$tab_type_brevet[$type_brevet]; $l2=$pdf->GetStringWidth($texte2); $x=$pdf->GetX()+($l_page-$pdf->GetX()-($l1+$l2+$l3))/2; $pdf->SetFont('DejaVu','',$fs_titre); $pdf->SetXY($x,$pdf->GetY()); $pdf->Cell($pdf->GetStringWidth($texte1),$pdf->FontSize*$sc_interligne, $texte1,0,0,'L');
$x_telecom = $pdf->GetX(); $y_telecom = $pdf->GetY(); //if( $entente_tel[$classe_id]==='1' ) { if ($tab_modele_pdf["entente_tel"][$classe_id] === '1') { $grandeur = ''; $text_tel = ''; //if ( $tel_image[$classe_id] != '' ) { if ($tab_modele_pdf["tel_image"][$classe_id] != '') { $a = $pdf->GetX(); $b = $pdf->GetY(); //$ima = '../images/imabulle/'.$tel_image[$classe_id].'.jpg'; $ima = '../images/imabulle/' . $tab_modele_pdf["tel_image"][$classe_id] . '.jpg'; $valeurima = redimensionne_image($ima, 15, 15); $pdf->Image($ima, $a, $b, $valeurima[0], $valeurima[1]); $text_tel = ' ' . $gepiSchoolTel; $grandeur = $pdf->GetStringWidth($text_tel); $grandeur = $grandeur + 2; } //if ( $tel_texte[$classe_id] != '' and $tel_image[$classe_id] === '' ) { if ($tab_modele_pdf["tel_texte"][$classe_id] != '' and $tab_modele_pdf["tel_image"][$classe_id] === '') { //$text_tel = $tel_texte[$classe_id].''.$gepiSchoolTel; $text_tel = $tab_modele_pdf["tel_texte"][$classe_id] . '' . $gepiSchoolTel; $grandeur = $pdf->GetStringWidth($text_tel); } $pdf->Cell($grandeur, 5, $text_tel, 0, $passealaligne, ''); } $passealaligne = '2'; // entête fax //if( $entente_fax[$classe_id]==='1' ) { if ($tab_modele_pdf["entente_fax"][$classe_id] === '1') { $text_fax = '';
if(mysqli_num_rows($res1)>0) { // Boucle sur la liste des élèves while($lig1=mysqli_fetch_object($res1)) { $pdf->AddPage('L'); //ajout d'une page au document //================================================ // ENTETE DE PAGE //$pdf->SetFont('DejaVu'); $pdf->SetFont('DejaVu','B',$fs_txt); $pdf->SetXY($marge,$marge); //$pdf->SetFontSize($fs_txt); //$pdf->Cell($larg_acad,fs_pt2mm($pdf->FontSize)*$sc_interligne, "ACADÉMIE DE ".strtoupper($fb_academie),0,0,'L'); //$texte="ACADÉMIE DE ".strtoupper($fb_academie); $texte="ACADÉMIE DE ".casse_mot($fb_academie); $pdf->Cell($pdf->GetStringWidth($texte),$pdf->FontSize*$sc_interligne, $texte,$bord_debug,0,'L'); $x_tmp=$pdf->GetX(); //$l_tmp=$pdf->GetStringWidth("FICHE SCOLAIRE DU BREVET - Série ".$tab_type_brevet[$type_brevet]); $pdf->Cell($l_page-2*$marge-$x_tmp,$pdf->FontSize*$sc_interligne, "FICHE SCOLAIRE DU BREVET - Série ".$tab_type_brevet[$type_brevet] ,$bord_debug,1,'C'); $pdf->SetFont('DejaVu','',$fs_txt); //$pdf->SetXY($marge,$pdf->GetY()+$pdf->FontSize*$r_interligne); $pdf->SetXY($marge,$pdf->GetY()); //$pdf->Cell($pdf->GetStringWidth("Département : "),$pdf->FontSize*$sc_interligne, "Département : $fb_departement",0,0,'L'); $pdf->Cell($pdf->GetStringWidth("Département : "),$pdf->FontSize*$sc_interligne, "Département : ",0,0,'L'); $pdf->SetFont('DejaVu','B',$fs_txt); $pdf->Cell($larg_acad,$pdf->FontSize*$sc_interligne,$fb_departement,0,0,'L'); $l_tmp=($l_page-2*$marge-$pdf->GetX())/2;
$pdf->SetFont('DejaVu','B',$fs_txt); $pdf->SetXY(210-$marge-$larg_session,$marge); $pdf->Cell($larg_session,$pdf->FontSize*$sc_interligne, "SESSION $fb_session",'',1,'R'); $pdf->SetFont('DejaVu','B',$fs_titre); $pdf->SetXY($marge,$y_fsb); $pdf->Cell(210-2*$marge,10, "FICHE SCOLAIRE DU BREVET",$bord_debug,1,'C'); //$pdf->SetXY($marge,$pdf->GetY()+$pdf->FontSize*$sc_interligne); //$pdf->SetXY($marge,$pdf->GetY()); $pdf->Cell(210-2*$marge,10, "Série ".$tab_type_brevet[$type_brevet],$bord_debug,1,'C'); //$pdf->SetFont('DejaVu'); $pdf->SetFont('DejaVu','B',$fs_txt); $pdf->SetXY($marge,$pdf->GetY()); //$pdf->SetFontSize($fs_txt); $pdf->Cell($pdf->GetStringWidth("ACADÉMIE : "),fs_pt2mm($pdf->FontSize)*$sc_interligne, "ACADÉMIE : ",0,0,'L'); $pdf->SetFont('DejaVu','',$fs_txt); //$pdf->Cell($larg_acad,fs_pt2mm($pdf->FontSize)*$sc_interligne, strtoupper($fb_academie),0,1,'L'); $pdf->Cell($larg_acad,fs_pt2mm($pdf->FontSize)*$sc_interligne, casse_mot($fb_academie),0,1,'L'); $pdf->SetFont('DejaVu','',$fs_txt); //$pdf->SetXY($marge,15); $pdf->SetXY($marge,$pdf->GetY()+$pdf->FontSize*$r_interligne); //$pdf->Cell($larg_acad,fs_pt2mm($pdf->FontSize)*$sc_interligne, "Département: $fb_departement ".$pdf->GetY(),0,2,''); $pdf->Cell($larg_acad,$pdf->FontSize*$sc_interligne, "Département: $fb_departement",0,1,''); // LRBT: Left Right Bottom Top //================================================ // INFOS ELEVE $pdf->SetFont('DejaVu','',$fs_txt);