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

133 lines
4.9 KiB
PHP

<?php
// vérifier les paramètres
if (!empty($_GET['t']))
$intMenu = $_GET['t'];
else
$intMenu = 0;
if (!empty($_GET['a']))
$strAction = $_GET['a'];
else
$strAction = '';
$page = $strPage = 'rapport.php';
$strLangue = 'fr';
if (isset($_GET['lng'])) {
if ($_GET['lng'] != '')
$strLangue = $_GET['lng'];
}
require_once('php/inc_functions.php');
require_once('php/inc_fx_messages.php');
require_once('php/inc_fx_excell.php');
// si on clique le bouton ajouter
if (isset($_POST['btn_add_top']) || isset($_POST['btn_add_bot']))
fxSetForm('add', $intMenu, $_POST, $_FILES);
// si on clique le bouton enregistrer
if (isset($_POST['btn_save_top']) || isset($_POST['btn_save_bot']))
fxSetForm('mod', $intMenu, $_POST, $_FILES);
// si on clique excel
if (isset($_POST['btn_excel_top']) || isset($_POST['btn_excel_bot'])) {
if(isset($_POST['strwhere']))
$strwhere=$_POST['strwhere'];
else
$strorder="";
if(isset($_POST['strorder']))
$strorder=$_POST['strorder'];
else
$strorder="";
fxrapportexcell($intMenu, $strLangue, $strorder,$strwhere);
}
// si on clique le bouton supprimer
foreach (array_keys($_POST) as $strValue) {
if (strstr($strValue, 'btn_delete_file_')) {
fxDeleteFile($intMenu, $_POST, substr($strValue, strrpos($strValue, '_') + 1));
} elseif (strstr($strValue, 'btn_delete_')) {
if ($strAction == 'list')
fxSetForm('del', $intMenu, $_POST, '');
else {
$tabSubtablesDel = fxGetMenus('', base64_decode(urldecode($intMenu)));
for ($intCtr = 1; $intCtr <= count($tabSubtablesDel); $intCtr++) {
if (isset($_POST['chk_' . $tabSubtablesDel[$intCtr]['men_table']]))
fxSetForm('del', urlencode(base64_encode(fxUnescape($tabSubtablesDel[$intCtr]['men_table']))), $_POST, '');
}
}
}
}
require_once('inc_header.php');
?>
<div id="main">
<div id="main_inner" class="fluid">
<?php
if ($strAction == "report") {
?>
<div id="primaryContent_columnless">
<div id="columnA_columnless">
<?php
}
else {
?>
<div id="primaryContent_2columns">
<div id="columnA_2columns">
<?php
}
switch ($strAction) {
case 'report':
default:
// récupérer les données pour créer la liste
if (isset($_GET['pg']))
$intPage = $_GET['pg'];
else
$intPage = 1;
$strOrder = $strWhere = '';
// vérifier la clause WHERE
if (isset($_GET['btn_search'])) {
$tabWhere = array();
$tabFields = fxGetFormFields('search', $intMenu);
for ($intCtr = 1; $intCtr <= count($tabFields); $intCtr++) {
// former le WHERE si la valeur n'est pas vide
if ($tabFields[$intCtr]['name'] == 'a-ach_maj') {
if (trim($_GET[$tabFields[$intCtr]['name'] . '_from']) != '' && trim($_GET[$tabFields[$intCtr]['name'] . '_to']) != '')
$tabWhere[] = "(" . str_replace('-', '.',fxUnescape($tabFields[$intCtr]['name'])) . " >= '" . $_GET[fxUnescape($tabFields[$intCtr]['name']) . '_from'] . "' AND " . str_replace('-', '.',fxUnescape($tabFields[$intCtr]['name'])) . " <= '" . $_GET[fxUnescape($tabFields[$intCtr]['name']) . '_to'] . "')";
}
else {
if (trim($_GET[$tabFields[$intCtr]['name']]) != '')
$tabWhere[] = fxUnescape($tabFields[$intCtr]['name']) . " LIKE '%" . $GLOBALS['db']->fxEscape(trim($_GET[$tabFields[$intCtr]['name']])) . "%'";
}
}
// pousser le WHERE dans une variable
if (count($tabWhere) > 0)
$strWhere = implode(',', $tabWhere);
}
// vérifier la clause ORDER BY
if (isset($_GET['o'])) {
$strOrder = $GLOBALS['db']->fxEscape(trim($_GET['o']));
}
$tabResults = fxGetListData($intMenu, $strOrder, $strWhere, $intPage, $strLangue);
fxShowList($tabResults, $intMenu, $strOrder, $strWhere, $intPage, $strLangue);
break;
}
?>
<p>&nbsp;</p>
<br class="clear" />
</div>
</div>
</div>
</div>
<?php require_once('inc_footer.php'); ?>