Files
ms1inscription-v5/bib_dist_print.php
stephan 21b28a0d06 Implement PDF distribution panel for bib management (MSIN-4433)
This commit introduces a new feature for generating and managing PDF distributions of bibs. It adds a new AJAX action to handle requests for the distribution panel, along with corresponding JavaScript functions to refresh and initialize the panel. CSS styles are updated to enhance the layout of the distribution panel, and new PHP functions are added to support the generation and metadata handling for the PDF prints. The version code is incremented to 4.72.759 to reflect these changes.
2026-07-08 12:00:58 -04:00

47 lines
1.3 KiB
PHP

<?php
// MSIN-4433 — Génération PDF distribution des dossards (POST + session promoteur).
session_start();
$_SERVER['PHP_SELF'] = '/compte.php';
$_SERVER['SCRIPT_NAME'] = '/compte.php';
require_once('php/inc_fonctions.php');
require_once('php/inc_fx_promoteur.php');
$strLangue = $_SESSION['lang'] ?? 'fr';
$reqLang = $_REQUEST['lang'] ?? $_REQUEST['lng'] ?? '';
if (!empty($reqLang) && in_array($reqLang, ['fr', 'en'], true)) {
$strLangue = $reqLang;
}
$vPage = 'compte.php';
$vtexte_page = obtenirTextepage($vPage, $strLangue, 2);
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
exit;
}
$int_eve_id = (int)($_POST['eve_id'] ?? 0);
$_REQUEST['eve_id'] = $int_eve_id;
$_POST['eve_id'] = $int_eve_id;
fxBibRequireDistPrintAccess();
$tabSelections = fxBibParseDistPrintSelectionsFromPost($_POST);
$tabSave = fxBibSaveDistPrintSelections($int_eve_id, $tabSelections, $strLangue);
if (!$tabSave['success']) {
http_response_code(400);
header('Content-Type: text/plain; charset=utf-8');
echo $tabSave['message'] ?? 'Invalid selection';
exit;
}
$strPrintedBy = fxBibGetCurrentPromoteurDisplayName();
$intComId = (int)($_SESSION['com_id'] ?? 0);
fxBibSaveDistPrintMeta($int_eve_id, $intComId, $strPrintedBy);
fxBibOutputDistPrintPdf($int_eve_id, $strLangue, $strPrintedBy);
exit;