Enhance ChronoTrack API event page rendering and form integration
This commit updates the `fxChronotrackApiAdminRenderEventPage` function to include an optional parameter for inline rendering, allowing for a more flexible display of the ChronoTrack API section. The event modification form is also adjusted to conditionally render the ChronoTrack API section based on the event ID, improving user experience and navigation. Additionally, the layout is refined to ensure proper heading levels based on the inline status.
This commit is contained in:
@ -7,7 +7,7 @@ function fxChronotrackApiAdminEsc($str) {
|
||||
return htmlspecialchars((string)$str, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
function fxChronotrackApiAdminRenderEventPage($intEveId, $strLangue = 'fr') {
|
||||
function fxChronotrackApiAdminRenderEventPage($intEveId, $strLangue = 'fr', $blnInlineOnEventForm = false) {
|
||||
global $vDomaine;
|
||||
|
||||
$arrEvent = fxChronotrackApiMs1EventRow($intEveId, $strLangue);
|
||||
@ -21,8 +21,13 @@ function fxChronotrackApiAdminRenderEventPage($intEveId, $strLangue = 'fr') {
|
||||
$strStatus = $arrConfig['sync_status'] ?? '';
|
||||
$blnClosed = ($strStatus === MSIN_API_CHRONOTRACK_SYNC_FERME);
|
||||
|
||||
echo '<div class="ct-api-admin">';
|
||||
echo '<h1 class="h3">MSIN API ChronoTrack</h1>';
|
||||
$strWrapperId = $blnInlineOnEventForm ? ' id="chronotrack_api"' : '';
|
||||
echo '<div class="ct-api-admin"' . $strWrapperId . '>';
|
||||
if ($blnInlineOnEventForm) {
|
||||
echo '<h2 class="h4">MSIN API ChronoTrack</h2>';
|
||||
} else {
|
||||
echo '<h1 class="h3">MSIN API ChronoTrack</h1>';
|
||||
}
|
||||
echo '<p class="text-muted">Configuration du lien pour l\'événement MS1 <strong>' . fxChronotrackApiAdminEsc($arrEvent['eve_nom']) . '</strong> (eve_id '
|
||||
. intval($arrEvent['eve_id']) . ').</p>';
|
||||
|
||||
@ -69,8 +74,10 @@ function fxChronotrackApiAdminRenderEventPage($intEveId, $strLangue = 'fr') {
|
||||
fxChronotrackApiAdminRenderRaceMapping($intEveId, $arrConfig, $strLangue, $blnClosed);
|
||||
}
|
||||
|
||||
echo '<p class="mt-3"><a class="btn btn-outline-secondary btn-sm" href="index.php?t='
|
||||
. urlencode(base64_encode(4)) . '&a=mod&id=' . intval($intEveId) . '">← Retour fiche événement</a></p>';
|
||||
if (!$blnInlineOnEventForm) {
|
||||
echo '<p class="mt-3"><a class="btn btn-outline-secondary btn-sm" href="index.php?t='
|
||||
. urlencode(base64_encode(4)) . '&a=mod&id=' . intval($intEveId) . '">← Retour fiche événement</a></p>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
fxChronotrackApiAdminRenderPageScript($intEveId, $arrConfig, $blnClosed, $vDomaine);
|
||||
|
||||
@ -27,6 +27,9 @@ if (!isset($strhomeclientannuler)) {
|
||||
}
|
||||
|
||||
$intMenuActuel = intval($tabResults['menu']['men_id']);
|
||||
$strMenuTableActuel = isset($tabResults['menu']['men_table']) ? (string)$tabResults['menu']['men_table'] : '';
|
||||
$intEveIdForm = ($strAction === 'mod' && !empty($_GET['id'])) ? intval($_GET['id']) : 0;
|
||||
$blnIsEventModForm = ($intEveIdForm > 0 && ($intMenuActuel === 4 || $strMenuTableActuel === 'inscriptions_evenements'));
|
||||
$blnCompteShowAccesSections = false;
|
||||
|
||||
if ($strAction == 'mod' && $tabResults['data'] == null) {
|
||||
@ -105,17 +108,6 @@ if ($strAction == 'mod') {
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../php/inc_fx_eve_acces.php');
|
||||
fxEveAccesShowEventAccessPanel(intval($_GET['id']));
|
||||
?>
|
||||
<div class="card border-primary mt-3 mb-2" id="chronotrack_api">
|
||||
<div class="card-body py-3">
|
||||
<h2 class="h5 card-title mb-2">MSIN API ChronoTrack</h2>
|
||||
<p class="text-muted small mb-2 mb-md-0">Lier cet événement à ChronoTrack Live (mapping épreuves, sync).</p>
|
||||
<a class="btn btn-outline-primary btn-sm" href="chronotrack_api.php?eve_id=<?php echo intval($_GET['id']); ?>">
|
||||
<i class="fa fa-exchange" aria-hidden="true"></i> Configurer ChronoTrack
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
@ -134,7 +126,7 @@ if ($strAction == 'mod') {
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($intMenuActuel == 4) {
|
||||
if ($blnIsEventModForm) {
|
||||
?>
|
||||
<a class="btn btn-secondary" href="#chronotrack_api">
|
||||
ChronoTrack
|
||||
@ -1092,6 +1084,12 @@ if ($strAction == 'mod') {
|
||||
<p> </p>
|
||||
<?php
|
||||
|
||||
if ($blnIsEventModForm) {
|
||||
require_once(dirname(__FILE__) . '/../../php/chronotrack_api/inc_bootstrap.php');
|
||||
fxChronotrackApiAdminRenderEventPage($intEveIdForm, $strLangue, true);
|
||||
echo '<hr class="my-4">';
|
||||
}
|
||||
|
||||
for ($intCtr = 1; $intCtr <= fxcountpatch($tabSubTables); $intCtr++) {
|
||||
|
||||
$intMenu = urlencode(base64_encode(fxUnescape($tabSubTables[$intCtr]['men_id'])));
|
||||
@ -1104,9 +1102,7 @@ if ($strAction == 'mod') {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if ($strAction == 'mod') {
|
||||
if ($intMenuActuel == 4) {
|
||||
if ($blnIsEventModForm) {
|
||||
?>
|
||||
<h1 id="list_rapports">Rapport de l'événement</h1>
|
||||
<ul class="nav nav-pills flex-column">
|
||||
|
||||
Reference in New Issue
Block a user