Files
ms1inscription-v5/superadm/eve_acces.php
stephan 4e6eb3191b Add access management section to sidebar in admin interface
This commit introduces a new section in the admin sidebar for managing access, specifically adding a link for "Kits d'accès". The logic determines the active state based on the current script and query parameters, enhancing navigation for event access management.
2026-06-23 14:32:52 -04:00

99 lines
3.2 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;
}
}
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
switch ($strAction) {
case 'kit':
if ($strFlash !== '' && $strError === '') {
echo '<div class="alert alert-success">' . htmlspecialchars($strFlash, ENT_QUOTES, 'UTF-8') . '</div>';
}
fxEveAccesAdminRenderKitForm($intRoleId, $strError);
break;
case 'kits':
default:
if ($strError !== '') {
$strFlash = '';
echo '<div class="alert alert-danger">' . htmlspecialchars($strError, ENT_QUOTES, 'UTF-8') . '</div>';
}
fxEveAccesAdminRenderKitsList($strFlash);
break;
}
?>
<p>&nbsp;</p>
</div>
<?php require_once('inc_droite.php'); ?>
</div>
</div>
<?php require_once('inc_footer.php'); ?>