Files
ms1inscription-v5/superadm/eve_acces.php
stephan 8c7f3e13ed Refactor superadmin UI components and enhance ChronoTrack API integration
This commit introduces a new UI structure for the superadmin interface by implementing the fxSuperadmV2Panel functions, which improve the organization and presentation of event access and ChronoTrack API sections. The changes include the addition of collapsible panels for better user interaction and visual clarity. Additionally, the versioning in the settings file is updated to reflect the latest changes. These enhancements aim to streamline the user experience and improve the overall functionality of the superadmin interface.
2026-07-03 20:27:30 -04:00

149 lines
5.1 KiB
PHP

<?php
$strLangue = 'fr';
$strPage = 'eve_acces.php';
$strAction = $_GET['p'] ?? 'kits';
require_once('php/inc_start_time.php');
require_once('php/inc_functions.php');
require_once('php/inc_fx_eve_acces_admin.php');
global $objDatabase;
if (empty($_SESSION['usa_id'])) {
header('Location: login.php');
exit;
}
$strFlash = '';
$strError = '';
$intRoleId = isset($_GET['id']) ? intval($_GET['id']) : 0;
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'duplicate':
if ($intRoleId <= 0) {
header('Location: eve_acces.php?p=kits');
exit;
}
$arrResult = fxEveAccesAdminDuplicateRole($intRoleId);
if ($arrResult['state'] === 'ok') {
header('Location: eve_acces.php?p=kit&id=' . intval($arrResult['role_id']) . '&saved=1');
} else {
header('Location: eve_acces.php?p=kits&err=' . urlencode($arrResult['message']));
}
exit;
case 'toggle':
if ($intRoleId <= 0) {
header('Location: eve_acces.php?p=kits');
exit;
}
$arrResult = fxEveAccesAdminToggleRoleActif($intRoleId);
$strQ = ($arrResult['state'] === 'ok') ? 'ok=' . urlencode($arrResult['message']) : 'err=' . urlencode($arrResult['message']);
header('Location: eve_acces.php?p=kits&' . $strQ);
exit;
case 'delete':
if ($intRoleId <= 0) {
header('Location: eve_acces.php?p=kits');
exit;
}
$arrResult = fxEveAccesAdminDeleteRole($intRoleId);
if ($arrResult['state'] === 'ok') {
header('Location: eve_acces.php?p=kits&ok=' . urlencode($arrResult['message']));
} else {
header('Location: eve_acces.php?p=kits&err=' . urlencode($arrResult['message']));
}
exit;
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['action'] ?? '') === 'save_kit') {
$intRoleId = intval($_POST['role_id'] ?? 0);
$arrResult = fxEveAccesAdminSaveRole($_POST, $_POST['perm_keys'] ?? array());
if ($arrResult['state'] === 'ok') {
header('Location: eve_acces.php?p=kit&id=' . intval($arrResult['role_id']) . '&saved=1');
exit;
}
$strError = $arrResult['message'];
$strAction = 'kit';
}
if (isset($_GET['saved']) && $_GET['saved'] === '1') {
$strFlash = 'Kit enregistré.';
}
if (!empty($_GET['ok'])) {
$strFlash = (string)$_GET['ok'];
}
if (!empty($_GET['err'])) {
$strError = (string)$_GET['err'];
}
include('inc_header.php');
?>
<div class="container-fluid" id="main">
<div class="row">
<div class="col-md-9 col-lg-10 order-first order-md-last py-3">
<?php
require_once dirname(__FILE__) . '/../php/inc_fx_superadm_v2_ui.php';
switch ($strAction) {
case 'migrate':
$strV2Title = 'Accès promoteur — Migration legacy';
break;
case 'kit':
$strV2Title = 'Accès promoteur — Édition kit';
break;
case 'assignations':
$strV2Title = 'Accès promoteur — Assignations';
break;
case 'kits':
default:
$strV2Title = 'Accès promoteur — Kits d\'accès';
break;
}
fxSuperadmV2PanelOpen($strV2Title, array(
'zone_class' => 'superadm-content-v2-zone superadm-content-v2-zone--flush',
));
switch ($strAction) {
case 'migrate':
if ($strError !== '') {
echo '<div class="alert alert-danger">' . htmlspecialchars($strError, ENT_QUOTES, 'UTF-8') . '</div>';
}
fxEveAccesAdminRenderMigrationPage($strFlash);
break;
case 'kit':
if ($strFlash !== '' && $strError === '') {
echo '<div class="alert alert-success">' . htmlspecialchars($strFlash, ENT_QUOTES, 'UTF-8') . '</div>';
}
fxEveAccesAdminRenderKitForm($intRoleId, $strError);
break;
case 'assignations':
if ($intRoleId <= 0) {
header('Location: eve_acces.php?p=kits');
exit;
}
fxEveAccesAdminRenderKitAssignmentsPage($intRoleId, $strFlash);
break;
case 'kits':
default:
if ($strError !== '') {
$strFlash = '';
echo '<div class="alert alert-danger">' . htmlspecialchars($strError, ENT_QUOTES, 'UTF-8') . '</div>';
}
fxEveAccesAdminRenderKitsList($strFlash);
break;
}
fxSuperadmV2PanelClose();
?>
<p>&nbsp;</p>
</div>
<?php require_once('inc_droite.php'); ?>
</div>
</div>
<?php require_once('inc_footer.php'); ?>