function creation_rappels($liste_rappel2, $texte_rappel, $filename, $info_veto, $debut, $fin, $data_mot, $choix) { $liste_rappel = json_decode($liste_rappel2, true); //$info_client = json_decode($info_client, true); if (!file_exists($filename)) { if (!mkdir($filename, 0755, true)) { die('Echec lors de la création des répertoires...'); } } if ($choix == "A4") { $pdf = new FPDF('P', 'mm', 'A4'); } elseif ($choix == "lettre") { $pdf = new FPDF('L', 'mm', array(200, 90)); } while (list($key_rappel, $value_rappel) = each($liste_rappel)) { if ($choix == "lettre") { $pdf->AddPage(); $pdf->SetFont('Times', '', 12); $pdf->SetXY(15, 20); $pdf->Cell(70, 0, requetemysql::gestion_string_maj($value_rappel['nom_a']), 0, 0, 'L'); $pdf->SetXY(120, 40); $pdf->MultiCell(70, 7, requetemysql::gestion_string_maj($value_rappel['nom_p']) . ' ' . requetemysql::gestion_string_norm($value_rappel['prenom_p']) . "\n" . requetemysql::gestion_string_norm($value_rappel['adresse_p']) . "\n" . requetemysql::gestion_string_norm($value_rappel['code_p']) . ' ' . requetemysql::gestion_string_norm($value_rappel['ville_p']), 0, 'L'); $pdf->SetXY(25, 50); $pdf->Cell(70, 0, requetemysql::gestion_string_maj($value_rappel['date_rappel']), 0, 0, 'L'); $pdf->SetXY(20, 68); $pdf->Cell(75, 0, requetemysql::gestion_string_maj($info_veto[0]['nom']) . ' ' . requetemysql::gestion_string_norm($info_veto[0]['tel']), 0, 0, 'L'); } elseif ($choix == "A4") { foreach ($texte_rappel as $key_texte => $value_texte) { if (strtolower($value_texte['nom']) == strtolower($value_rappel['type'])) { $pdf->AddPage(); $pdf->SetFont('Times', '', 12); $pdf->MultiCell(85, 5, requetemysql::gestion_string_maj($info_veto[0]['nom']) . "\n" . requetemysql::gestion_string_norm($info_veto[0]['adresse']) . "\n" . requetemysql::gestion_string_norm($info_veto[0]['code']) . ' ' . requetemysql::gestion_string_norm($info_veto[0]['commune']) . "\n" . requetemysql::gestion_string_norm($info_veto[0]['tel']), 0, 'L'); $pdf->Ln(15); $pdf->Cell(90); $pdf->MultiCell(85, 5, requetemysql::gestion_string_maj($value_rappel['nom_p']) . ' ' . requetemysql::gestion_string_norm($value_rappel['prenom_p']) . "\n" . requetemysql::gestion_string_norm($value_rappel['adresse_p']) . "\n" . requetemysql::gestion_string_norm($value_rappel['code_p']) . ' ' . requetemysql::gestion_string_norm($value_rappel['ville_p']), 0, 'C'); $pdf->Ln(25); $date2 = $ligne['date'] / 1000; $mon_texte = $value_texte['texte']; $donnee_mot = array(requetemysql::gestion_string_norm($value_rappel['espece']), requetemysql::gestion_string_maj($value_rappel['nom_a']), requetemysql::gestion_string_maj($value_rappel['date_rappel']), requetemysql::gestion_string_maj($info_veto[0]['nom'])); $str = str_replace($data_mot, $donnee_mot, $mon_texte); $pdf->MultiCell(0, 5, utf8_decode($str), 0, 'J'); $pdf->Ln(25); if ($value_rappel['commentaire'] != '') { $pdf->Cell(50, 20, utf8_decode("Commentaire :"), 'LTB', 0, false); $pdf->MultiCell(0, 20, requetemysql::gestion_string_maj($value_rappel['commentaire']), 'TRB', 'L', false); $pdf->Ln(10); } $pdf->Cell(90); $pdf->MultiCell(85, 5, "Dr " . $_SESSION['login'], 0, 'C'); $pdf->SetY(-40); $pdf->Cell(0, 10, utf8_decode('Pensez à prendre rendez-vous au ' . requetemysql::gestion_string_norm($info_veto[0]['tel']) . '. N\'oubliez pas le livret de santé.'), 0, 0, 'C'); } // fermeture if $value_texte } //fermeture seconde boucle } //fermeture if choix A4 } // fermeture premiere boucle $variable_lien = $filename . '/relance__' . $debut . '__' . $fin . '_' . uniqid() . '.pdf'; $pdf->Output($variable_lien, F); return $variable_lien; }
for ($i = 0; $i <= $case_vide; $i++) { $pdf->Cell($w[0], 6, "--", 'LRTB', 0, 'C'); } } } // Données $pdf->SetFont('Times', '', 8); $trouve = false; foreach ($value_planning['mon_tableau'] as $row) { if ($date_debut == $row[2] / 1000) { $pdf->Cell($w[0], 6, requetemysql::gestion_string_maj(date("d", $date_debut) . " " . ($row[1] == 0 ? "G" : "A") . " " . date("H:i", $row[3] / 1000) . "h-" . date("H:i", $row[4] / 1000) . "h"), 'LRTB', 0, 'C', true); $trouve = true; } } if ($trouve == false) { $pdf->Cell($w[0], 6, requetemysql::gestion_string_maj(date("d", $date_debut)), 'LRTB', 0, 'C', false); } if (date("w", $date_debut) == $header[count($header) - 1]["valeur"]) { $pdf->Ln(); } $date_debut = mktime(0, 0, 0, date("m", $date_debut), date("d", $date_debut) + 1, date("Y", $date_debut)); } } $mon_url = '../sauvegarde/clinique/planning/' . $_SESSION['login'] . '/planning_' . requetemysql::gestion_string_norm($_POST['date_debut2']) . "_" . requetemysql::gestion_string_norm($_POST['date_fin2']) . uniqid() . '.pdf'; //$pdf->Output($mon_url, F); $pdf->Output($mon_url, F); echo json_encode($mon_url); } function touvelejour($jour, $heure) { if (($jour == 0 || $jour == 5 || $jour == 6) && $heure >= 19) {
function creation_resume($animal_id, $info_analyse, $info_radio, $info_formulaire, $variable) { $filename = '../sauvegarde/animaux/' . $animal_id; if (!file_exists($filename)) { if (!mkdir($filename, 0755, true)) { die('Echec lors de la création des répertoires...'); } } $info_veto = requetemysql::info_veterinaire(array('login' => strtolower($_SESSION['login']))); if (empty($info_veto)) { throw new Exception("Erreur dans la recherche des informations sur le vétérinaire"); } else { $info_veto = json_decode($info_veto, true); } if ($_SESSION['login'] != $_SESSION['login2']) { $info_veto2 = requetemysql::info_veterinaire(array('login' => strtolower($_SESSION['login2']))); if (empty($info_veto2)) { throw new Exception("Erreur dans la recherche des informations sur le vétérinaire qui a réalisé la consultation"); } else { $info_veto2 = json_decode($info_veto2, true); } } $pdf = new FPDF(); $pdf->AddPage(); $pdf->Image('../image/logo/essai1.jpg', 10, 6, 30); $pdf->SetFont('Times', '', 18); $titre3 = utf8_decode(stripslashes(ucfirst($info_veto[0]['nom']))); $w = $pdf->GetStringWidth(stripslashes($titre3)) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, $titre3, 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['adresse']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['adresse'])), 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['code'] . " " . $info_veto[0]['commune']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['code'] . " " . $info_veto[0]['commune'])), 0, 'C'); $pdf->Ln(); $pdf->SetFont('Times', '', 12); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['tel']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['tel'])), 0, 'C'); $pdf->Ln(20); $pdf->MultiCell(85, 5, "Le " . date("d.m.y"), 0, 'L'); $pdf->SetFont('Times', 'B', 12); $pdf->MultiCell(190, 7, requetemysql::gestion_string_maj("Résumé de la consultation du " . $info_formulaire['date_consultation'] . ", concernant :" . $_POST['caracteristique']), '0', 'L'); $pdf->SetFont('Times', '', 12); if ($_SESSION['login'] != $_SESSION['login2']) { $pdf->MultiCell(190, 7, requetemysql::gestion_string_maj("Cette consultation a été réalisée par " . $info_veto2[0]['nom_vet'] . ", exerçant à :" . $info_veto2[0]['adresse'] . " " . $info_veto2[0]['code'] . " " . $info_veto2[0]['commune'] . ". Téléphone :" . $info_veto2[0]['tel']), '0', 'L'); $pdf->Ln(); } $pdf->SetFont('Times', '', 14); $pdf->SetFillColor(153, 153, 153); $pdf->SetTextColor(0, 0, 0); $pdf->SetDrawColor(153, 153, 153); $pdf->SetLineWidth(0.3); $pdf->MultiCell(190, 10, requetemysql::gestion_string_maj("Motif de consultation :" . $info_formulaire['barre_resume']), '0', 'L', true); $pdf->Ln(); $pdf->SetFont('Times', '', 12); $pdf->MultiCell(190, 5, requetemysql::gestion_string_maj("Détail :" . $info_formulaire['clinique']), 0, 'L'); $pdf->Ln(15); $pdf->Cell(50, 20, utf8_decode("signature du vétérinaire :"), 0, 0, false); if (count($info_analyse) > 0) { $pdf->AddPage(); $pdf->Image('../image/logo/essai1.jpg', 10, 6, 30); $pdf->SetFont('Times', '', 18); $titre3 = utf8_decode(stripslashes(ucfirst($info_veto[0]['nom']))); $w = $pdf->GetStringWidth(stripslashes($titre3)) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, $titre3, 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['adresse']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['adresse'])), 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['code'] . " " . $info_veto[0]['commune']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['code'] . " " . $info_veto[0]['commune'])), 0, 'C'); $pdf->Ln(); $pdf->SetFont('Times', '', 12); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['tel']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['tel'])), 0, 'C'); $pdf->Ln(20); $pdf->MultiCell(85, 5, "Le " . date("d.m.y"), 0, 'L'); $pdf->SetFont('Times', 'B', 12); $pdf->MultiCell(190, 7, requetemysql::gestion_string_maj("Résultat d'analyse du " . $info_formulaire['date_consultation'] . ", concernant :" . $_POST['caracteristique']), '0', 'L'); $pdf->SetFont('Times', '', 12); if ($_SESSION['login'] != $_SESSION['login2']) { $pdf->MultiCell(190, 7, requetemysql::gestion_string_maj("Ces analyses ont été réalisées par " . $info_veto2[0]['nom_vet'] . ", exerçant à :" . $info_veto2[0]['adresse'] . " " . $info_veto2[0]['code'] . " " . $info_veto2[0]['commune'] . ". Téléphone :" . $info_veto2[0]['tel']), '0', 'L'); } $pdf->Ln(); // Largeurs des colonnes $w = array(190 / 4, 190 / 6, 190 / 6, 190 / 4, 190 / 6); $header = array(utf8_decode('Référence'), utf8_decode('Résultat'), utf8_decode('Unité'), utf8_decode('Méthode'), utf8_decode("date d'analyse")); // En-tête for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C'); } $pdf->Ln(); // Données foreach ($info_analyse as $row) { $pdf->Cell($w[0], 6, requetemysql::gestion_string_maj($row['nom']), 'LR', 0, 'C'); $pdf->Cell($w[1], 6, requetemysql::gestion_string_norm($row['resultat']), 'LR', 0, 'R'); $pdf->Cell($w[2], 6, requetemysql::gestion_string_norm($row['unite']), 'LR', 0, 'C'); $pdf->Cell($w[3], 6, requetemysql::gestion_string_norm($row['methode']), 'LR', 0, 'C'); $pdf->Cell($w[4], 6, requetemysql::gestion_string_norm($row['ma_date']), 'LR', 0, 'C'); $pdf->Ln(); } // Trait de terminaison $pdf->Cell(array_sum($w), 0, '', 'T'); $pdf->Ln(8); $pdf->Cell(50, 20, utf8_decode("Commentaire :"), 'LTB', 0, false); $pdf->MultiCell(0, 20, requetemysql::gestion_string_maj($info_formulaire['commentaire']), 'TRB', 'L', false); } if (count($info_radio) > 0 || $info_formulaire['result_radio'] != '') { $pdf->AddPage(); $pdf->Image('../image/logo/essai1.jpg', 10, 6, 30); $pdf->SetFont('Times', '', 18); $titre3 = utf8_decode(stripslashes(ucfirst($info_veto[0]['nom']))); $w = $pdf->GetStringWidth(stripslashes($titre3)) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, $titre3, 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['adresse']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['adresse'])), 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['code'] . " " . $info_veto[0]['commune']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['code'] . " " . $info_veto[0]['commune'])), 0, 'C'); $pdf->Ln(); $pdf->SetFont('Times', '', 12); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['tel']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['tel'])), 0, 'C'); $pdf->Ln(20); $pdf->MultiCell(85, 5, "Le " . date("d.m.y"), 0, 'L'); $pdf->SetFont('Times', 'B', 12); $pdf->MultiCell(190, 7, requetemysql::gestion_string_maj("Compte-rendu de l'examen radiologique du " . $info_formulaire['date_consultation'] . ", concernant :" . $_POST['caracteristique']), '0', 'L'); $pdf->SetFont('Times', '', 12); if ($_SESSION['login'] != $_SESSION['login2']) { $pdf->MultiCell(190, 7, requetemysql::gestion_string_maj("Ces radios ont été réalisées par " . $info_veto2[0]['nom_vet'] . ", exerçant à :" . $info_veto2[0]['adresse'] . " " . $info_veto2[0]['code'] . " " . $info_veto2[0]['commune'] . ". Téléphone :" . $info_veto2[0]['tel']), '0', 'L'); } $pdf->Ln(); // Largeurs des colonnes $w = array(190 / 4, 190 / 4, 190 / 4, 190 / 4); $header = array(utf8_decode('Personnel exposé aux RX'), utf8_decode('constantes'), utf8_decode('date'), utf8_decode('Zone radiographiée')); // En-tête for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C'); } $pdf->Ln(); // Données foreach ($info_radio as $row) { $pdf->Cell($w[0], 6, requetemysql::gestion_string_maj($row['perso']), 'LR', 0, 'R'); $pdf->Cell($w[1], 6, requetemysql::gestion_string_norm($row['expo']), 'LR', 0, 'R'); $pdf->Cell($w[2], 6, requetemysql::gestion_string_norm($row['ma_date']), 'LR', 0, 'C'); $pdf->Cell($w[3], 6, requetemysql::gestion_string_norm($row['zone']), 'LR', 0, 'C'); $pdf->Ln(); } // Trait de terminaison $pdf->Cell(array_sum($w), 0, '', 'T'); $pdf->Ln(4); $pdf->MultiCell(0, 10, utf8_decode("Résultat de la lecture de cliché :"), 'LTRB', 'C', false); $pdf->Ln(4); $pdf->Write(5, requetemysql::gestion_string_maj($info_formulaire['result_radio'])); } $mon_url = '../sauvegarde/animaux/' . $_POST['animal_id'] . '/resume_consult_' . $variable . '.pdf'; $pdf->Output($mon_url, F); return $mon_url; }
// En-tête for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C'); } $pdf->Ln(); // Données foreach ($tarifs as $row) { $pdf->Cell($w[0], 6, requetemysql::gestion_string_maj($row['nom']), 'LR', 0, 'C'); $pdf->Cell($w[1], 6, requetemysql::gestion_string_norm($row['prixttc']), 'LR', 0, 'R'); $pdf->Ln(); } // Trait de terminaison $pdf->Cell(array_sum($w), 0, '', 'T'); $pdf->Ln(8); $pdf->Cell(50, 20, utf8_decode("Commentaire :"), 'LTB', 0, false); $pdf->MultiCell(0, 20, requetemysql::gestion_string_maj($commentaire), 'TRB', 'L', false); $pdf->Ln(8); $pdf->Cell(50, 20, utf8_decode("Signature :"), 'LTB', 0, false); $pdf->MultiCell(0, 20, "", 'TRB', 'L', false); $mon_url = '../sauvegarde/clinique/impression_tarif/' . $login_veto . '/tarifs_' . date("d_m_y") . uniqid() . '.pdf'; //$pdf->Output($mon_url, F); $pdf->Output($mon_url, F); echo json_encode($mon_url); } else { header('HTTP/1.1 400 Bad Request'); exit("Vous n'avez pas les droits d'accéder à cette section"); } } } } }
/** * print_result4 * print all the jobs realized by member since reference date selected in the second part (start date to share job between member) * * @param array $arr : * @param array $arr['team'] team with param (login, nom, adresse, code, commune, tel1, tel2, mail) * @param array $arr['team2'] team2 with param (login, total_job, total_jobv2, liste_job) * @param date $arr['date_ref'] format DD/MM/YYYY date selected to begin share job between member * @param string $arr['date_debut'] date of the begin of the selected month format : DD/MM/YYYY * @param string $arr['date_fin'] date of the end of the selected month format : DD/MM/YYYY * @param array $arr['agenda'] array of schedule for the month sort by job and by login * @return json json of ok */ public static function print_result4($arr) { try { require 'fpdf/fpdf.php'; require 'fpdi/fpdi.php'; $filename = 'planning/'; if (!file_exists($filename)) { if (!mkdir($filename, 0755, true)) { die('Echec lors de la création des répertoires...'); } } if ($arr['cas'] == 1) { $pdf = new FPDF(); } $intersect = array_uintersect($arr['team'], $arr['team2'], 'compareDeepValue'); if (isset($_SESSION['login2'])) { $info_veto = requetemysql::info_veterinaire(array('login' => strtolower($_SESSION['login']))); if (empty($info_veto)) { throw new Exception("Erreur dans la recherche des informations sur le vétérinaire"); } else { $info_veto = json_decode($info_veto, true); } } $transformation_object = array_map(function ($e) { return is_object($e) ? $e->login : $e['login']; }, $arr['team2']); // var_error_log("liste_pointv2"); // var_error_log($transformation_object); foreach ($intersect as $info_veto2) { if ($arr['cas'] == 2) { $pdf = new FPDF(); } $mon_index = array_search($info_veto2->login, $transformation_object); var_error_log($mon_index); $pdf->AddPage(); $pdf->Image('../images/logo/essai1.jpg', 10, 6, 30); if (isset($_SESSION['login2'])) { $pdf->SetFont('Times', '', 18); $titre3 = utf8_decode(stripslashes(ucfirst($info_veto[0]['nom']))); $w = $pdf->GetStringWidth(stripslashes($titre3)) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, $titre3, 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['adresse']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['adresse'])), 0, 'C'); $pdf->Ln(); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['code'] . " " . $info_veto[0]['commune']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['code'] . " " . $info_veto[0]['commune'])), 0, 'C'); $pdf->Ln(); $pdf->SetFont('Times', '', 12); $w = $pdf->GetStringWidth(utf8_decode(stripslashes($info_veto[0]['tel']))) + 6; $pdf->SetX((210 - $w) / 2); $pdf->Cell($w, 7, utf8_decode(stripslashes($info_veto[0]['tel'])), 0, 'C'); $pdf->Ln(15); } $pdf->Cell(90); $pdf->MultiCell(85, 5, requetemysql::gestion_string_maj($info_veto2->nom) . "\n" . requetemysql::gestion_string_norm($info_veto2->adresse) . "\n" . requetemysql::gestion_string_norm($info_veto2->code) . ' ' . requetemysql::gestion_string_norm($info_veto2->commune), 0, 'C'); $pdf->Ln(25); $pdf->MultiCell(85, 5, "Le " . date("d.m.y"), 0, 'L'); if (isset($_SESSION['login2'])) { $pdf->MultiCell(85, 5, requetemysql::gestion_string_maj(TXT_CHARGEMENT_EXPORT8 . stripslashes(ucfirst($info_veto[0]['nom']))), 0, 'L'); } else { $pdf->MultiCell(85, 5, requetemysql::gestion_string_maj(TXT_CHARGEMENT_EXPORT23), 0, 'L'); } $pdf->SetFont('Times', '', 18); $pdf->SetFillColor(153, 153, 153); $pdf->SetTextColor(0, 0, 0); $pdf->SetDrawColor(153, 153, 153); $pdf->SetLineWidth(0.3); $pdf->SetFont('', 'B'); $pdf->MultiCell(0, 12, utf8_decode(TXT_CHARGEMENT_EXPORT24 . requetemysql::gestion_string_maj(htmlentities($info_veto2->login)) . " sur la période du :" . requetemysql::gestion_string_norm($arr['date_ref']) . " au " . requetemysql::gestion_string_norm($arr['date_fin'])), 0, '', true); // Largeurs des colonnes $w = array(190 / 6, 190 / 6, 190 / 6, 190 / 2); $header = array(utf8_decode(TXT_CHARGEMENT_EXPORT26), utf8_decode(TXT_CHARGEMENT_EXPORT27) . " " . requetemysql::gestion_string_norm($arr['date_ref']) . "-" . requetemysql::gestion_string_norm($arr['date_debut']), utf8_decode(TXT_CHARGEMENT_EXPORT27) . " " . requetemysql::gestion_string_norm($arr['date_ref']) . "-" . requetemysql::gestion_string_norm($arr['date_fin']), utf8_decode(TXT_CHARGEMENT_EXPORT28)); // Données $pdf->SetFont('Times', '', 8); // En-tête for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C'); } $pdf->Ln(); foreach ($arr['team2'][$mon_index]->total_job as $row) { foreach ($row as $k => $v) { $pdf->Cell($w[0], 6, requetemysql::gestion_string_maj($k), 1, 0, 'C'); $pdf->Cell($w[1], 6, requetemysql::gestion_string_maj($v), 1, 0, 'C'); foreach ($arr['team2'][$mon_index]->total_jobv2 as $row2) { foreach ($row2 as $k2 => $v2) { if ($k2 == $k) { $pdf->Cell($w[2], 6, requetemysql::gestion_string_maj($v2), 1, 0, 'C'); } } } $retour1 = true; foreach ($arr['team2'][$mon_index]->liste_job as $row3) { foreach ($row3 as $k3 => $v3) { if ($k3 == $k) { $retour1 = false; $pdf->MultiCell($w[3], 6, requetemysql::gestion_string_maj(implode(",", $v3)) . " " . $arr['agenda'][$k][$info_veto2->login], 1, 'L', false); } } } if ($retour1) { $pdf->Ln(); } } } // Trait de terminaison $pdf->Cell(array_sum($w), 0, '', 'T'); $pdf->Ln(20); if ($arr['cas'] == 2) { $mon_url = $filename . 'resume_activite_' . requetemysql::gestion_string_maj(htmlentities($info_veto2->login)) . '_' . uniqid() . '.pdf'; //$pdf->Output($mon_url, F); $pdf->Output('../' . $mon_url, F); $filename = $mon_url; $files_name = explode("/", $filename); if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}\$#", $info_veto2->mail)) { $passage_ligne = "\r\n"; } else { $passage_ligne = "\n"; } //=====Déclaration des messages au format texte et au format HTML. $message_txt = TXT_CHARGEMENT_EXPORT32 . $info_veto2->nom . TXT_CHARGEMENT_EXPORT33 . stripslashes(ucfirst($info_veto[0]['nom'])) . TXT_CHARGEMENT_EXPORT34 . requetemysql::gestion_string_norm($arr['date_ref']) . " - " . requetemysql::gestion_string_norm($arr['date_fin']); $message_txt .= TXT_CHARGEMENT_EXPORT35; $message_txt = utf8_decode($message_txt); $message_html = TXT_CHARGEMENT_EXPORT36 . $info_veto2->nom . TXT_CHARGEMENT_EXPORT37 . stripslashes(ucfirst($info_veto[0]['nom'])) . TXT_CHARGEMENT_EXPORT38 . requetemysql::gestion_string_norm($arr['date_ref']) . " - " . requetemysql::gestion_string_norm($arr['date_fin']) . " : </p>"; $message_html .= TXT_CHARGEMENT_EXPORT39; $message_html = utf8_decode($message_html); //=====Lecture et mise en forme de la pièce jointe analyse. $fichier = fopen('../' . $filename, "r"); $attachement = fread($fichier, filesize('../' . $filename)); $attachement = chunk_split(base64_encode($attachement)); fclose($fichier); //========== //========== //=====Création de la boundary $boundary = "-----=" . md5(rand()); $boundary_alt = "-----=" . md5(rand()); //========== //=====Définition du sujet. $sujet = TXT_CHARGEMENT_EXPORT40; //========= //=====Création du header de l'e-mail $header = "From: \"" . NOMMAILSERVEUR . "\"<" . MAILSERVEUR . ">" . $passage_ligne; $header .= "Reply-to: \"" . NOMMAILSERVEUR . "\" <" . MAILSERVEUR . ">" . $passage_ligne; $header .= "Bcc: \"archives urgences vet\" <*****@*****.**>" . $passage_ligne; $header .= "MIME-Version: 1.0" . $passage_ligne; $header .= "Content-Type: multipart/mixed;" . $passage_ligne . " boundary=\"{$boundary}\"" . $passage_ligne; //=====Création du message. $message = $passage_ligne . "--" . $boundary . $passage_ligne; $message .= "Content-Type: multipart/alternative;" . $passage_ligne . " boundary=\"{$boundary_alt}\"" . $passage_ligne; $message .= $passage_ligne . "--" . $boundary_alt . $passage_ligne; //=====Ajout du message au format texte. $message .= "Content-Type: text/plain; charset=\"ISO-8859-1\"" . $passage_ligne; $message .= "Content-Transfer-Encoding: 8bit" . $passage_ligne; $message .= $passage_ligne . $message_txt . $passage_ligne; //========== $message .= $passage_ligne . "--" . $boundary_alt . $passage_ligne; //=====Ajout du message au format HTML $message .= "Content-Type: text/html; charset=\"ISO-8859-1\"" . $passage_ligne; $message .= "Content-Transfer-Encoding: 8bit" . $passage_ligne; $message .= $passage_ligne . $message_html . $passage_ligne; //========== $message .= $passage_ligne . "--" . $boundary_alt . "--" . $passage_ligne; //========== $message .= $passage_ligne . "--" . $boundary . $passage_ligne; //=====Ajout de la pièce jointe. $message .= "Content-Type: application/pdf; name=\"" . $files_name[count($files_name) - 1] . "\"" . $passage_ligne; $message .= "Content-Transfer-Encoding: base64" . $passage_ligne; $message .= "Content-Disposition: attachment; filename=\"" . $files_name[count($files_name) - 1] . "\"" . $passage_ligne; $message .= $passage_ligne . $attachement . $passage_ligne . $passage_ligne; //========== $message .= $passage_ligne . "--" . $boundary . "--" . $passage_ligne; //=====Envoi de l'e-mail. mail($info_veto2->mail, $sujet, $message, $header); //========== usleep(100000); } } if ($arr['cas'] == 1) { $mon_url = $filename . 'resume_activite_' . uniqid() . '.pdf'; //$pdf->Output($mon_url, F); $pdf->Output('../' . $mon_url, F); return json_encode($mon_url); } else { if ($arr['cas'] == 2) { return json_encode("ok"); } } } catch (Exception $e) { return 'Exception -> '; var_dump($e->getMessage()); } }