function getBody($groupe, $col, $el, $codeperiode, &$sumtotal = 0, &$sumcoeff = 0) { $str = ""; $sumdh = $sumdp = $summoy = 0; foreach ($groupe as $g) { if ($g['IDELEVE'] == $el['IDELEVE']) { $str .= '<tr style="text-align:center;font-weight:bold;">'; # Matiere //$g['NOM'] = preg_replace("%[^\033-\176\r\n\t]%", '', $g['NOM']); //$g['PRENOM'] = preg_replace("%[^\033-\176\r\n\t]%", '', $g['PRENOM']); $str .= '<td border="1" style="text-align:left;" ' . 'width="' . $col[1] . '%"> <b style="text-transform:uppercase">' . trim($g['BULLETIN']) . '</b><br/> <span style="font-size:7px;font-weight:normal">' . ($g['CIVILITE'] . ' ' . $g['NOM']) . '</span></td>'; # DP if ($codeperiode === "T") { if ($g['SEQ1'] != "" && $g['SEQ1'] != null) { $str .= '<td style="line-height:17px" border="1" width="' . $col[2] . '%">' . sprintf("%.2f", $g['SEQ1']) . '</td>'; } else { $str .= '<td border="1" width="' . $col[2] . '%"></td>'; } # DH if ($g['SEQ2'] != "" && $g['SEQ2'] != null) { $str .= '<td style="line-height:17px" border="1" width="' . $col[3] . '%">' . sprintf("%.2f", $g['SEQ2']) . '</td>'; } else { $str .= '<td border="1" width="' . $col[3] . '%"></td>'; } } # Moyenne DP et DH if (!empty($g['COEFF'])) { $str .= '<td style="line-height:17px" border="1" width="' . $col[4] . '%">' . sprintf("%.2f", $g['MOYENNE']) . '</td>'; } else { $str .= '<td border="1" width="' . $col[4] . '%"></td>'; } # Coeff if (!empty($g['COEFF'])) { $str .= '<td style="line-height:17px" border="1" width="' . $col[5] . '%">' . sprintf("%.0f", $g['COEFF']) . '</td>'; } else { $str .= '<td border="1" width="' . $col[5] . '%"></td>'; } # Total = coeff * moy if (!empty($g['COEFF'])) { $str .= '<td style="line-height:17px" border="1" width="' . $col[6] . '%">' . sprintf("%.2f", $g['TOTAL']) . '</td>'; } else { $str .= '<td border="1" width="' . $col[6] . '%"></td>'; } # Rang if (!empty($g['COEFF'])) { $str .= '<td style="line-height:17px" border="1" width="' . $col[7] . '%">' . $g['RANG'] . '</td>'; } else { $str .= '<td border="1" width="' . $col[7] . '%"></td>'; } #Moyenne de classe if (!empty($g['COEFF'])) { $str .= '<td style="line-height:17px" border="1" width="' . $col[8] . '%">' . sprintf("%.2f", $g['MOYCL']) . '</td>'; } else { $str .= '<td border="1" width="' . $col[8] . '%"></td>'; } #Min / Max if (!empty($g['COEFF'])) { $str .= '<td style="line-height:17px" border="1" width="' . $col[9] . '%">' . sprintf("%.2f", $g['NOTEMIN']) . ' / ' . sprintf("%.2f", $g['NOTEMAX']) . '</td>'; } else { $str .= '<td border="1" width="' . $col[9] . '%"></td>'; } #Appreciation if (!empty($g['COEFF'])) { $str .= '<td style="line-height:17px;text-align:left;"' . ' border="1" width="' . $col[10] . '%" > <b style="text-transform:uppercase">' . getAppreciations($g['MOYENNE']) . '</b></td>'; } else { $str .= '<td border="1" width="' . $col[10] . '%"></td>'; } # Sommes #$sumdh += $g['MOYENNE']; #$sumdp += $g['DP']; $sumcoeff += $g['COEFF']; $sumtotal += $g['TOTAL']; $summoy += $g['MOYENNE']; $str .= '</tr>'; } } if (!empty($groupe)) { $param = ["sumtotal" => $sumtotal, "sumcoeff" => $sumcoeff, "description" => $g['DESCRIPTION'], "codeperiode" => $codeperiode]; $str .= printGroupe($col, $param); } return $str; }
$pdf->WriteHTMLCell(50, 5, 165, $y + 21, $redo); $pdf->setFontSize(13); $pdf->WriteHTMLCell(0, 5, 95, $y + 33, '<div style="text-transform:uppercase">' . $sequence['LIBELLEHTML'] . "</div>"); $pdf->setFontSize(8); # Table header $nbMatieres = count($groupe1) + count($groupe2) + count($groupe3); $line_height = "11px"; if ($nbMatieres >= 14) { $line_height = "9px"; } $corps = '<table border="0.5" cellpadding="0.5" style="line-height: ' . $line_height . '"><thead>' . '<tr style="text-align:center;font-weight:bold; line-height: 15px;background-color:#444444;color:#FFF;">' . '<th border="0.5" width="' . $col[1] . '%" style="text-align:left"> Matières</th>' . '<th border="0.5" width="' . $col[2] . '%">DP</th>' . '<th border="0.5" width="' . $col[3] . '%">DH</th><th border="0.5" width="' . $col[4] . '%">Moy</th>' . '<th border="0.5" width="' . $col[5] . '%">Coef</th><th border="0.5" width="' . $col[6] . '%">Total</th>' . '<th border="0.5" width="' . $col[7] . '%">Rang</th>' . '<th border="0.5" width="' . $col[8] . '%">Moy.Cl</th>' . '<th border="0.5" width="' . $col[9] . '%">Min/Max</th>' . '<th border="0.5" width="' . $col[10] . '%">Appréciation</th></tr></thead><tbody>'; # FAIRE UNE BOUCLE SUR LES GROUPES DE MATIERES $st1 = $sc1 = $st2 = $sc2 = 0; $corps .= getBody($groupe1, $col, $eleve, $st1, $sc1); $corps .= getBody($groupe2, $col, $eleve, $st2, $sc2); $corps .= printGroupe($st1 + $st2, $sc1 + $sc2, $col, "Groupe 1 + Groupe 2"); $corps .= getBody($groupe3, $col, $eleve); $corps .= "</tbody></table>"; $pdf->WriteHTMLCell(0, 5, 14, $y + 40, $corps); # RESUME DU TRAVAIL ACCOMPLI $pdf->setFontSize(7); $corps = printTravail($rang, $travail, $eleve, $prev); $pdf->WriteHTMLCell(0, 5, 25, $y + 173, $corps); # Discripline $corps = printDiscipline($discipline); $pdf->WriteHTMLCell(0, 0, 25, $y + 188, $corps); $pdf->setFont("helvetica", '', 8); # Desinner la coube d'evolution $moyennes = getMoyennesRecapitulatives($recapitulatifs, $eleve['IDELEVE']); $moyennes[] = $rang['MOYGENERALE']; genererCourbe($moyennes, $eleve);
function getBody($groupe, $col, $el, &$sumtotal = 0, &$sumcoeff = 0) { $str = ""; $sumdh = $sumdp = $summoy = 0; foreach ($groupe as $g) { if ($g['IDELEVE'] == $el['IDELEVE']) { $str .= '<tr style="text-align:center">'; # Matiere //$g['NOM'] = preg_replace("%[^\033-\176\r\n\t]%", '', $g['NOM']); //$g['PRENOM'] = preg_replace("%[^\033-\176\r\n\t]%", '', $g['PRENOM']); $str .= '<td border="0.5" style="text-align:left" width="' . $col[1] . '%"> <b>' . strtoupper($g['BULLETIN']) . '</b><br/> <span style="font-size:7px">' . ($g['CIVILITE'] . ' ' . $g['NOM'] . ' ' . $g['PRENOM']) . '</span></td>'; # DP if ($g['DP'] != "" && $g['DP'] != null) { $str .= '<td border="0.5" width="' . $col[2] . '%">' . sprintf("%.2f", $g['DP']) . '</td>'; } else { $str .= '<td border="0.5" width="' . $col[2] . '%"></td>'; } # DH if ($g['DH'] != "" && $g['DH'] != null) { $str .= '<td border="0.5" width="' . $col[3] . '%">' . sprintf("%.2f", $g['DH']) . '</td>'; } else { $str .= '<td border="0.5" width="' . $col[3] . '%"></td>'; } # Moyenne DP et DH $str .= '<td border="0.5" width="' . $col[4] . '%">' . sprintf("%.2f", $g['MOYENNE']) . '</td>'; # Coeff $str .= '<td border="0.5" width="' . $col[5] . '%">' . $g['COEFF'] . '</td>'; # Total = coeff * moy $str .= '<td border="0.5" width="' . $col[6] . '%">' . sprintf("%.2f", $g['TOTAL']) . '</td>'; # Rang $str .= '<td border="0.5" width="' . $col[7] . '%">' . $g['RANG'] . '</td>'; #Moyenne de classe $str .= '<td border="0.5" width="' . $col[8] . '%">' . sprintf("%.2f", $g['MOYCL']) . '</td>'; #Min / Max $str .= '<td border="0.5" width="' . $col[9] . '%">' . sprintf("%.2f", $g['NOTEMIN']) . ' / ' . sprintf("%.2f", $g['NOTEMAX']) . '</td>'; #Appreciation $str .= '<td border="0.5" width="' . $col[10] . '%" style="text-align:left"> ' . getAppreciations($g['MOYENNE']) . '</td>'; # Sommes $sumdh += $g['DH']; $sumdp += $g['DP']; $sumcoeff += $g['COEFF']; $sumtotal += $g['TOTAL']; $summoy += $g['MOYENNE']; $str .= '</tr>'; } } if (!empty($groupe)) { $str .= printGroupe($sumtotal, $sumcoeff, $col, $g['DESCRIPTION']); } return $str; }