diff --git a/images/doc/dossardposition.png b/images/doc/dossardposition.png index 3c24210..ace7961 100644 Binary files a/images/doc/dossardposition.png and b/images/doc/dossardposition.png differ diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index 6be39ed..7283225 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -9607,15 +9607,16 @@ function fxBibDistPrintResolveDocImagePath($strSrc) { return $strPath; } -/** MSIN-4471 — Insère une image doc (largeur max = page utile). */ -function fxBibDistPrintWriteImage($pdf, $strPath) { +/** MSIN-4471 — Insère une image doc (largeur max = page utile, ou $fltMaxWMm si fourni). */ +function fxBibDistPrintWriteImage($pdf, $strPath, $fltMaxWMm = 0, $blnCenter = false) { if ($strPath === '' || !is_file($strPath)) { return; } $fltLeft = method_exists($pdf, 'GetLeftMargin') ? $pdf->GetLeftMargin() : 10; $fltRight = method_exists($pdf, 'GetRightMargin') ? $pdf->GetRightMargin() : 10; $fltBottom = method_exists($pdf, 'GetBreakMargin') ? $pdf->GetBreakMargin() : 14; - $fltMaxW = $pdf->GetPageWidth() - $fltLeft - $fltRight; + $fltPageMax = $pdf->GetPageWidth() - $fltLeft - $fltRight; + $fltMaxW = ($fltMaxWMm > 0) ? min($fltMaxWMm, $fltPageMax) : $fltPageMax; $tabSize = @getimagesize($strPath); $fltW = $fltMaxW; if (is_array($tabSize) && !empty($tabSize[0]) && !empty($tabSize[1])) { @@ -9624,15 +9625,16 @@ function fxBibDistPrintWriteImage($pdf, $strPath) { $fltW = $fltNatW; } } - if ($pdf->GetY() + 10 > $pdf->GetPageHeight() - $fltBottom) { - $pdf->AddPage(); - } - $pdf->Image($strPath, $pdf->GetX(), $pdf->GetY(), $fltW); $fltH = 0; if (is_array($tabSize) && !empty($tabSize[0]) && !empty($tabSize[1])) { $fltH = $fltW * ($tabSize[1] / $tabSize[0]); } - $pdf->Ln(max(8, $fltH + 2)); + if ($pdf->GetY() + max(10, $fltH) > $pdf->GetPageHeight() - $fltBottom) { + $pdf->AddPage(); + } + $fltX = $blnCenter ? (($pdf->GetPageWidth() - $fltW) / 2) : $pdf->GetX(); + $pdf->Image($strPath, $fltX, $pdf->GetY(), $fltW); + $pdf->Ln(max(8, $fltH + 3)); } /** @@ -9821,7 +9823,19 @@ function fxBibDistPrintWriteIntroFlyer($pdf, $strHtml) { continue; } - // Autres blocs (ul/ol/img…) : rendu classique. + // Image doc (ex. position du dossard) — centrée, largeur limitée. + if ($strTag === 'img') { + $strSrc = $el->getAttribute('src'); + $strPath = fxBibDistPrintResolveDocImagePath($strSrc); + if ($strPath !== '') { + $pdf->Ln(1); + fxBibDistPrintWriteImage($pdf, $strPath, 85, true); + } + $i++; + continue; + } + + // Autres blocs (ul/ol…) : rendu classique. if ($strTag === 'p') { // p après les cartes (rare) : texte simple. $pdf->SetFont('Arial', '', 10); @@ -9983,8 +9997,9 @@ function fxBibDistPrintWriteHtml($pdf, $strHtml) { /** * MSIN-4471 — Dessine le QR résultats événement (kc.php?t=eve) centré. + * Affiche ms1.ca sous le QR (pas l'URL technique). */ -function fxBibDistPrintDrawEventQr($pdf, $int_eve_id) { +function fxBibDistPrintDrawEventQr($pdf, $int_eve_id, $strCaption = '') { $int_eve_id = (int)$int_eve_id; if ($int_eve_id <= 0 || !function_exists('fxKcEveResultatsQrPngBinary')) { return; @@ -10002,19 +10017,34 @@ function fxBibDistPrintDrawEventQr($pdf, $int_eve_id) { if (@file_put_contents($strTmpPng, $binPng) === false) { return; } - $fltSize = 70; - $fltX = ($pdf->GetPageWidth() - $fltSize) / 2; - $pdf->Ln(4); - $fltBottom = method_exists($pdf, 'GetBreakMargin') ? $pdf->GetBreakMargin() : 14; - if ($pdf->GetY() + $fltSize > $pdf->GetPageHeight() - $fltBottom) { + + $fltBottom = method_exists($pdf, 'GetBreakMargin') ? $pdf->GetBreakMargin() : 18; + $fltSize = 95; + + $strCaption = trim((string)$strCaption); + if ($strCaption !== '') { + $pdf->Ln(6); + $pdf->SetFont('Arial', 'B', 13); + $pdf->SetTextColor(25, 40, 70); + $pdf->MultiCell(0, 7, fxBibDistPrintPdfText($strCaption), 0, 'C'); + $pdf->SetTextColor(0, 0, 0); + $pdf->Ln(4); + } else { + $pdf->Ln(10); + } + + if ($pdf->GetY() + $fltSize + 16 > $pdf->GetPageHeight() - $fltBottom) { $pdf->AddPage(); } + $fltX = ($pdf->GetPageWidth() - $fltSize) / 2; $pdf->Image($strTmpPng, $fltX, $pdf->GetY(), $fltSize, $fltSize); - $pdf->Ln($fltSize + 4); - if (function_exists('fxKcEveResultatsQrUrl')) { - $pdf->SetFont('Arial', '', 8); - $pdf->MultiCell(0, 4, fxBibDistPrintPdfText(fxKcEveResultatsQrUrl($int_eve_id)), 0, 'C'); - } + $pdf->Ln($fltSize + 6); + + $pdf->SetFont('Arial', 'B', 16); + $pdf->SetTextColor(47, 95, 208); + $pdf->MultiCell(0, 8, fxBibDistPrintPdfText('ms1.ca'), 0, 'C'); + $pdf->SetTextColor(0, 0, 0); + @unlink($strTmpPng); } @@ -10049,10 +10079,15 @@ function fxBibOutputDistPrintIntroPages($pdf, $int_eve_id, $strLangue = 'fr') { $pdf->documentTitle = ($strTitre !== '') ? $strTitre : $strClef; $pdf->documentSubtitle = $strSous; $pdf->AddPage(); - fxBibDistPrintWriteIntroFlyer($pdf, $strHtml); + + // Page QR : en-tête + invite + gros QR + ms1.ca (pas de cartes flyer). if ($strClef === 'bib_dist_print_qr') { - fxBibDistPrintDrawEventQr($pdf, $int_eve_id); + $strCaption = trim(html_entity_decode(strip_tags($strHtml), ENT_QUOTES, 'UTF-8')); + fxBibDistPrintDrawEventQr($pdf, $int_eve_id, $strCaption); + continue; } + + fxBibDistPrintWriteIntroFlyer($pdf, $strHtml); } $pdf->blnIntroMode = false; @@ -10060,7 +10095,7 @@ function fxBibOutputDistPrintIntroPages($pdf, $int_eve_id, $strLangue = 'fr') { $pdf->documentSubtitle = ''; $pdf->eprTitle = ''; $pdf->SetMargins(10, 12, 10); - $pdf->SetAutoPageBreak(true, 16); + $pdf->SetAutoPageBreak(true, 18); } /** MSIN-4433 — Génère et envoie le PDF (format lettre). */ @@ -10171,30 +10206,36 @@ function fxBibOutputDistPrintPdf($int_eve_id, $strLangue = 'fr', $strPrintedBy = function Footer() { $strLogo = function_exists('fxBibDistPrintMs1LogoPath') ? fxBibDistPrintMs1LogoPath() : ''; - $fltLogoW = 20; - $fltLogoReserve = ($strLogo !== '') ? ($fltLogoW + 6) : 0; $fltPageW = $this->GetPageWidth(); + $fltPageH = $this->GetPageHeight(); + $fltLogoW = 22; + $fltLogoH = $fltLogoW * (101 / 355); // ~6.3 mm (ratio logo MS1) + $fltGap = 4; + $fltPageNumW = 32; + $fltLogoX = $fltPageW - $this->rMargin - $fltLogoW; + $fltLogoY = $fltPageH - 9.5; + $fltPageNumX = ($strLogo !== '') + ? ($fltLogoX - $fltGap - $fltPageNumW) + : ($fltPageW - $this->rMargin - $fltPageNumW); + $fltTextW = max(30, $fltPageNumX - $this->lMargin - 2); + + // Logo : fond noir pour garder le contraste (logo blanc sur noir). if ($strLogo !== '') { - // Petit logo bas droite (toutes les pages). - $this->Image( - $strLogo, - $fltPageW - $this->rMargin - $fltLogoW, - $this->GetPageHeight() - 11, - $fltLogoW - ); + $this->SetFillColor(0, 0, 0); + $this->Rect($fltLogoX - 0.8, $fltLogoY - 0.8, $fltLogoW + 1.6, $fltLogoH + 1.6, 'F'); + $this->Image($strLogo, $fltLogoX, $fltLogoY, $fltLogoW); } - $this->SetY(-12); + $this->SetY(-11); $this->SetFont('Arial', 'I', 7); $this->SetTextColor(90, 90, 90); - $fltTextW = $fltPageW - $this->lMargin - $this->rMargin - $fltLogoReserve - 22; - if ($fltTextW < 40) { - $fltTextW = 40; - } + $this->SetX($this->lMargin); $this->Cell($fltTextW, 4, fxBibDistPrintPdfText($this->footerText), 0, 0, 'L'); + $strPage = sprintf($this->pageText, $this->PageNo(), '{nb}'); - $this->Cell(22, 4, fxBibDistPrintPdfText($strPage), 0, 0, 'R'); + $this->SetXY($fltPageNumX, -11); + $this->Cell($fltPageNumW, 4, fxBibDistPrintPdfText($strPage), 0, 0, 'R'); $this->SetTextColor(0, 0, 0); } } @@ -10206,7 +10247,7 @@ function fxBibOutputDistPrintPdf($int_eve_id, $strLangue = 'fr', $strPrintedBy = $pdf->eventTitle = fxBibDistPrintTruncate($strEventTitle, 80); $pdf->documentTitle = fxBibTexte('bib_v4_dist_print_title', 0); $pdf->SetMargins(10, 12, 10); - $pdf->SetAutoPageBreak(true, 16); + $pdf->SetAutoPageBreak(true, 18); $pdf->AliasNbPages(); // MSIN-4471 — Pages d'explication (doc) avant les tableaux d'épreuves. diff --git a/sql/MSIN-4471-bib-dist-print-doc.sql b/sql/MSIN-4471-bib-dist-print-doc.sql index a36dcdd..809763e 100644 --- a/sql/MSIN-4471-bib-dist-print-doc.sql +++ b/sql/MSIN-4471-bib-dist-print-doc.sql @@ -1,7 +1,7 @@ -- MSIN-4471 — Pages intro PDF distribution des dossards -- Prérequis : tables doc_mod / doc_page / doc_anchor (MSIN-doc-module.sql) -- Idempotent : DELETE puis INSERT du module bib_dist_print --- Images optionnelles : déposer sous images/doc/ (ex. /images/doc/exemple.png) +-- Images : images/doc/dossardposition.png (page table participants) SET NAMES utf8mb4; @@ -22,11 +22,11 @@ INSERT INTO `doc_page` (`doc_mod_clef`, `doc_page_clef`, `doc_langue`, `doc_titr ('bib_dist_print', 'bib_dist_print_reco', 'fr', 'Conseils à la distribution', 'Pour une remise de dossards sans erreur', '

À lire avant de commencer. Quelques secondes à chaque remise évitent les échanges, les erreurs de chronométrage et les résultats incorrects.

1. Familles et groupes — plusieurs dossards

Lorsque vous remettez plusieurs dossards à une même famille ou à un groupe, assurez-vous que le prénom figure sur chaque dossard. S''il n''y est pas déjà, écrivez-le au verso. Ainsi, chacun part avec le bon numéro : un échange entre proches fausse le chronométrage et les résultats.

2. Ne pas céder son dossard

Un dossard inscrit à un nom ne doit pas être remis à une autre personne. Si un échange a déjà eu lieu, avisez immédiatement les organisateurs afin qu''ils corrigent la base de données avant la course.

3. Dossard bien visible à l''avant

Rappelez au participant d''épingler son dossard bien visible à l''avant du torse. C''est essentiel pour un chronométrage fiable et un bon temps officiel.

4. Vérifier ses infos avant la course (code QR)

Invitez les participants à scanner le code QR de l''événement pour consulter les résultats en ligne avant le départ. Ils pourront confirmer que leur nom, leur âge et leur numéro de dossard sont correctement associés à leur inscription.

', 'compte.php', 10, 1, NOW()), -('bib_dist_print', 'bib_dist_print_table', 'fr', 'Affiche table — participants', 'À placer sur la table de distribution', -'

Texte provisoire — Page destinée à être lue par les participants à la table.

À faire avant de vous présenter

À la table

  1. Donnez votre nom de famille clairement.
  2. Vérifiez le numéro de dossard avant de quitter la table.
  3. Épinglez le dossard bien visible à l''avant.

Vous pouvez ajouter une image d''exemple ici, par ex. :

Exemple d''affichage

', +('bib_dist_print', 'bib_dist_print_table', 'fr', 'Votre dossard', 'À placer sur la table — pour les participants', +'

Vous venez de recevoir votre dossard. Prenez un moment pour vérifier ces points avant le départ.

1. Vérifiez vos informations (code QR)

Scannez le code QR de l''événement pour consulter les résultats en ligne. Vérifiez que votre nom est bien orthographié, que vous êtes dans la bonne catégorie et la bonne distance. En cas d''erreur, revenez voir l''organisation pour corriger avant la course.

2. Portez votre dossard correctement

Épinglez votre dossard bien visible à l''avant du torse, aux quatre coins. Un dossard mal placé ou caché peut compromettre votre chronométrage.

Position correcte du dossard à l''avant

3. Courez avec le bon dossard

Assurez-vous de courir avec le dossard qui vous a été remis — celui inscrit à votre nom. Un mauvais numéro fausse les résultats.

4. Ne cédez pas votre dossard

Ne remettez pas votre dossard à une autre personne. Si un échange a déjà eu lieu, avisez immédiatement les organisateurs pour qu''ils corrigent la base de données.

', 'compte.php', 20, 1, NOW()), ('bib_dist_print', 'bib_dist_print_qr', 'fr', 'Code QR de l''événement', 'À afficher / découper pour l''événement', -'

Texte provisoire — Le code QR ci-dessous pointe vers les résultats (ou le lien configuré) de cet événement.

Vous pouvez le photocopier, le découper et le coller partout sur le site de l''événement.

Comment l''utiliser

Le QR est généré automatiquement à l''impression — inutile de l''insérer en image dans ce texte.

', +'

Utilisez ce code pour consulter vos résultats en ligne pendant la course.

', 'compte.php', 30, 1, NOW()); -- --------------------------------------------------------------------------- @@ -36,9 +36,9 @@ INSERT INTO `doc_page` (`doc_mod_clef`, `doc_page_clef`, `doc_langue`, `doc_titr ('bib_dist_print', 'bib_dist_print_reco', 'en', 'Distribution tips', 'For a smooth, error-free bib handout', '

Read before you start. A few seconds at each handout prevent swaps, timing errors, and incorrect results.

1. Families and groups — multiple bibs

When handing out several bibs to the same family or group, make sure each bib shows a first name. If it is not already there, write it on the back. This way everyone leaves with the right number: a swap between relatives will skew timing and results.

2. Do not give away your bib

A bib registered under one name must not be given to someone else. If a swap has already happened, notify the organizers immediately so they can correct the database before the race.

3. Bib clearly visible on the front

Remind the participant to pin the bib clearly visible on the front of the torso. This is essential for reliable timing and an accurate official time.

4. Check details before the race (QR code)

Invite participants to scan the event QR code and view results online before the start. They can confirm that their name, age, and bib number are correctly linked to their registration.

', 'compte.php', 10, 1, NOW()), -('bib_dist_print', 'bib_dist_print_table', 'en', 'Table sign — participants', 'Place on the distribution table', -'

Placeholder — Page meant to be read by participants at the table.

Before you come up

At the table

  1. Say your last name clearly.
  2. Check the bib number before leaving the table.
  3. Pin the bib clearly on the front.

You can add a sample image here, e.g.:

Sample display

', +('bib_dist_print', 'bib_dist_print_table', 'en', 'Your bib', 'Place on the table — for participants', +'

You just received your bib. Take a moment to check these points before the start.

1. Check your details (QR code)

Scan the event QR code to view results online. Confirm that your name is spelled correctly, and that you are in the right category and right distance. If anything is wrong, see the organizers to correct it before the race.

2. Wear your bib correctly

Pin your bib clearly visible on the front of your torso, at all four corners. A hidden or poorly placed bib can compromise your timing.

Correct bib placement on the front

3. Run with the correct bib

Make sure you run with the bib that was handed to you — the one registered under your name. The wrong number will skew results.

4. Do not give away your bib

Do not give your bib to someone else. If a swap has already happened, notify the organizers immediately so they can correct the database.

', 'compte.php', 20, 1, NOW()), ('bib_dist_print', 'bib_dist_print_qr', 'en', 'Event QR code', 'Display / cut out for the event', -'

Placeholder — The QR code below points to this event''s results (or configured link).

You can photocopy, cut and post it around the event site.

How to use it

The QR is generated automatically when printing — no need to embed it as an image in this text.

', +'

Use this code to view your results online during the race.

', 'compte.php', 30, 1, NOW());