Files
ms1inscription-v5/superadm/db.php
2026-05-13 09:43:32 -04:00

506 lines
14 KiB
PHP

<?php
require_once "../superadm/php/inc_functions.php";
require_once "../superadm/php/inc_fx_dashboard.php";
error_reporting(E_ALL);
ini_set("display_errors", true);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<style>
/* General Styles */
body {
margin: 0;
padding: 0;
font-family: 'Arial', sans-serif;
background: radial-gradient(circle at bottom, #0d0d2b, #020212 70%);
color: #d1f1ff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
min-height: 100vh;
}
header {
width: 100%;
padding: 20px;
text-align: center;
background: linear-gradient(to bottom, #121228, #0d0d2b);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
font-size: 24px;
color: #68d8e0;
text-transform: uppercase;
border-bottom: 2px solid #1a3b59;
}
/* Dashboard Grid */
.dashboard {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
padding: 20px;
max-width: 1200px;
width: 100%;
}
.dashboard-item .value table {
width: 100%;
border-collapse: separate;
border-spacing: 0 6px; /* espace vertical entre lignes */
font-size: 14px;
font-weight: normal;
}
.dashboard-item .value th {
text-align: left;
padding-bottom: 8px;
}
.dashboard-item .value td {
padding: 4px 10px;
}
/* Événement */
.col-event {
text-align: left;
width: 55%;
word-break: break-word;
}
/* Chiffres */
.col-total,
.col-nb,
.col-var {
text-align: right;
width: 15%;
font-variant-numeric: tabular-nums; /* chiffres alignés */
}
/* Dashboard Items */
.dashboard-item {
background: linear-gradient(145deg, #1a3b59, #0d1f33);
border: 1px solid #1f4868;
border-radius: 10px;
padding: 20px;
text-align: center;
box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1), 0 5px 15px rgba(0, 0, 0, 0.5);
}
.dashboard-itemsm {
background: linear-gradient(145deg, #1a3b33, #0d1f22);
border: 1px solid #1f4868;
border-radius: 10px;
padding: 20px;
text-align: center;
box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1), 0 5px 15px rgba(0, 0, 0, 0.5);
}
.dashboard-itemsa {
background: linear-gradient(145deg, #2a62bc, #2a62bc);
border: 1px solid #1f4868;
border-radius: 10px;
padding: 20px;
text-align: center;
box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1), 0 5px 15px rgba(0, 0, 0, 0.5);
grid-column: span 2; /* Étendre sur deux colonnes */
}
.dashboard-itemsu {
background: linear-gradient(145deg, #9fcdff, #9fcdff);
border: 1px solid #1f4868;
border-radius: 10px;
padding: 20px;
color: mintcream;
text-align: left;
box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1), 0 5px 15px rgba(0, 0, 0, 0.5);
}
.dashboard-item .value table th,
.dashboard-item .value table td {
font-size: 14px;
font-weight: normal;
}
.dashboard-itembbk {
background: linear-gradient(145deg, #9fcdff, #9fcdff);
border: 1px solid #1f4868;
border-radius: 10px;
padding: 20px;
color: #086335;
text-align: left;
box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.1), 0 5px 15px rgba(0, 0, 0, 0.5);
}
.dashboard-item h2 {
color: #68d8e0;
font-size: 20px;
margin-bottom: 10px;
}
.dashboard-item .value {
font-size: 28px;
font-weight: bold;
color: #00e6ff;
}
.dashboard-item p {
color: #b0cce5;
font-size: 16px;
}
.valeur { padding:10px 0; text-align:right; color:#00e6ff; font-weight:bold; }
.small { font-size:12px; }
.medium { font-size:16px; }
.large { font-size:22px; }
/* Responsive Design */
@media (max-width: 768px) {
header {
font-size: 20px;
}
.dashboard {
padding: 10px;
}
}
#sm2 h2 {
font-size: 16px;
}
#sm2 .value {
font-size: 40px;
}
</style>
</head>
<body>
<header>
MS1inscription
</header>
<div class="dashboard">
<?php
if (!fxDashboardAccess('dashboard_ventes')) {
die('Accès non autorisé');
}
if (1==2){
$db = fxGetDashboard();
foreach ($db as $key => $value) {
?>
<div class="dashboard-item" id="<?php echo($value['db_id']); ?>">
<h2><?php echo($value['db_titre']); ?></h2>
<div class="value"> <?php
$arrdb = $objDatabase->fxGetVar($value['db_sql']);
echo($arrdb);
?></div>
</div>
<?php
}}
?>
<?php
$db = fxGetDashboard();
?>
<div class="dashboard-item">
<h2>Résumé</h2>
<div class="value" style="font-size:18px; font-weight:normal; text-align:left;">
<table style="width:100%; border-collapse:collapse;">
<tbody>
<?php foreach ($db as $value) { ?>
<tr style="border-top:1px solid rgba(255,255,255,0.08);">
<td style="padding:10px 0; color:#68d8e0;">
<?php echo $value['db_titre']; ?>
</td>
<td style="padding:10px 0; text-align:right; color:#00e6ff; font-weight:bold; font-size:<?php echo $value['css']; ?>;">
<?php
$val = $objDatabase->fxGetVar($value['db_sql']);
if ($value['db_format'] === 'montant') {
echo '$' . number_format((float)$val, 0, ',', ' ');
} else {
echo $val;
}
?> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<div class="dashboard-itemsm" id="sm">
<h2>MS1inscription analytiques</h2>
<div class="value"> <?php
$propertyId = '407765252';
$data = analy7jours($propertyId);
$result = [];
$x = 0;
foreach ($data['rows'] as $value) {
$formattedDate = substr($value['dimensionValues'][0]['value'], 0, 4) . '/' . substr($value['dimensionValues'][0]['value'], 4, 2) . '/' . substr($value['dimensionValues'][0]['value'], 6, 2);
$result[$x]['date'] = $formattedDate;
$result[$x]['value'] = $value['metricValues'][0]['value'];
$x = $x + 1;
}
usort($result, function ($a, $b) {
return strtotime($a['date']) <=> strtotime($b['date']);
});
// Affichage des résultats triés
foreach ($result as $value) {
echo($value['date'] . ' : ' . $value['value'] . '<br>');
}
?></div>
</div>
<div class="dashboard-itemsa">
<h2>Changements de prix (prochains 7 jours)</h2>
<div class="value">
<?php
$rows = getPrixEpreuvesProchainsJours(7);
?>
<table class="dashboard-table">
<thead>
<tr>
<th class="col-date">Date</th>
<th class="col-event">Événement</th>
<!--
<th class="col-epreuve">Épreuve</th>
<th class="col-num">Avant ($)</th>
<th class="col-num">Après ($)</th>-->
</tr>
</thead>
<tbody>
<?php
if (!is_array($rows)) {
$rows = [];
}
foreach ($rows as $row) { ?>
<tr>
<td class="col-date" style="white-space:nowrap;">
<?php echo str_replace('-', '&#8209;', $row['ep_date_limite']); ?>
</td>
<td class="col-event" style="font-size:75%; white-space:nowrap;">
<?php
$txt = $row['eve_nom_fr'];
echo mb_strlen($txt) > 50 ? mb_substr($txt, 0, 20) . '…' : $txt;
?>
</td>
<!--
<td class="col-epreuve" style="text-align: left;font-size:75%; white-space:nowrap;">
<?php
$txt2 = $row['epr_type_fr'];
echo mb_strlen($txt2) > 30 ? mb_substr($txt2, 0, 30) . '…' : $txt2;
?>
</td>
<td class="col-num">
<?php echo $row['ep_montant_avant'] !== null ? number_format($row['ep_montant_avant'], 2) : ''; ?>
</td>
<td class="col-num">
<?php echo number_format($row['ep_montant'], 2); ?>
</td>-->
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php
$top = getTopEventsMultiDays(1);
foreach ($top as $date => $events) {
?>
<div class="dashboard-itemsa">
<h2><?php echo $date; ?></h2>
<div class="value">
<table class="dashboard-table">
<thead>
<tr>
<th class="col-event">Événement</th>
<th class="col-total">Total ($)</th>
<th class="col-nb">NB</th>
<th class="col-var">%</th>
</tr>
</thead>
<tbody>
<?php foreach ($events as $event) { ?>
<tr>
<td class="col-event"><?php echo $event['eve_nom_fr']; ?></td>
<td class="col-total"><?php echo number_format($event['total'], 2); ?></td>
<td class="col-nb"><?php echo $event['transactions']; ?></td>
<td class="col-var">
<?php echo $event['variation'] !== null ? $event['variation'].'%' : ''; ?> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<?php
}
?>
</div>
<header>
MS1timing
</header>
<div class="dashboard">
<div class="dashboard-itemsa" id="sm">
<h2>Événements à venir</h2>
<div class="value"> <?php
fxGetAgenda();;
?></div>
</div>
<div class="dashboard-itemsm" id="sm">
<h2>MS1timing analytiques</h2>
<div class="value"> <?php
$propertyId = '407665718';
$data = analy7jours($propertyId);
$result=[];
$x=0;
foreach ($data['rows'] as $value) {
$formattedDate = substr($value['dimensionValues'][0]['value'], 0, 4) . '/' . substr($value['dimensionValues'][0]['value'], 4, 2) . '/' . substr($value['dimensionValues'][0]['value'], 6, 2);
$result[$x]['date']=$formattedDate;
$result[$x]['value']=$value['metricValues'][0]['value'];
$x=$x+1;
}
usort($result, function ($a, $b) {
return strtotime($a['date']) <=> strtotime($b['date']);
});
// Affichage des résultats triés
foreach ($result as $value) {
echo($value['date'].' : '.$value['value'].'<br>');
}
?></div>
</div>
<div class="dashboard-itembbk" id="sm">
<h2>Backup</h2>
<div class="value"> <?php
fxbackup("ms1timing");
?></div>
</div>
</div>
<header>
Support
</header>
<div class="dashboard">
<div class="dashboard-itemsm" id="sm2">
<h2>IN PROGRESS</h2>
<div class="value" id="sm2"> <?php
echo(fxGetTicket('IN PROGRESS'));
?></div>
</div>
<div class="dashboard-itemsm" id="sm2">
<h2>WAITING FOR CUSTOMER</h2>
<div class="value" id="sm2"> <?php
echo(fxGetTicket('WAITING FOR CUSTOMER'));
?></div>
</div>
<div class="dashboard-itemsm" id="sm2">
<h2>WAITING FOR SUPPORT</h2>
<div class="value" id="sm2"> <?php
echo(fxGetTicket('WAITING FOR SUPPORT'));
?></div>
</div>
<div class="dashboard-itemsm" id="sm2">
<h2>PENDING</h2>
<div class="value" id="sm2"> <?php
echo(fxGetTicket('PENDING'));
?></div>
</div>
<div class="dashboard-itemsu" id="sm">
<h2>UP time serveurs</h2>
<div class="value"> <?php
fxGetUptime();
?></div>
</div>
<div class="dashboard-itembbk" id="sm">
<h2>Backup</h2>
<div class="value"> <?php
fxbackup("ms1inscription");
?></div>
</div>
</div>
</body>
</html>