<?php
 
require_once 'class/class.oLogger.php';
 
 
/**-----------------------------------------------------------------------------
 
 * Check Param and assign default values
 
 */
 
 
$sSearchContext = '';
 
 
if (!isset ($_POST['ord'])) {
 
    $_POST['ord'] = 1;
 
}
 
if (!isset ($_POST['type'])) {
 
    $_POST['type'] = '';
 
}
 
if (!isset ($_POST['page'])) {
 
    $_POST['page'] = '';
 
}
 
$sOutput = $nomFichier = $sTypeSelect = $sPageSelect = '';
 
 
if (isset ($_POST['fichier'])) {
 
    $oLogger = new oLogger ($_POST['fichier']);
 
 
    $sTypeSelect .= '<select name="types" onchange="filtreType (this.value);">';
 
    $sTypeSelect .= '<option value="">TOUS TYPES</option>';
 
    $aTypes = $oLogger -> getList ('TYPE');
 
    foreach ($aTypes as $type) {
 
        $selected = (isset ($_POST['type']) && $_POST['type'] == $type)?'selected="selected"':'';
 
        $sTypeSelect.= '<option value="'.$type.'" '.$selected.'>'.$type.'</option>';
 
    }
 
    $sTypeSelect .= '</select>';
 
 
    $sPageSelect .= '<select name="pages" onchange="filtrePage (this.value);">';
 
    $sPageSelect .= '<option value="">TOUTES PAGES</option>';
 
    $aPages = $oLogger -> getList ('PAGE');
 
    foreach ($aPages as $page) {
 
        $selected = (isset ($_POST['page']) && $_POST['page'] == $page)?'selected="selected"':'';
 
        $sPageSelect.= '<option value="'.$page.'" '.$selected.'>'.$page.'</option>';
 
    }
 
    $sPageSelect .= '</select>';
 
 
    $nomFichier = basename ($_POST['fichier']);
 
    $aTmp = explode ('/', $_POST['fichier']);
 
    $idUser = $aTmp[0];
 
    /*
 
    $sQuery = 'SELECT dest_nom FROM destinataires WHERE dest_id='.$idUser;
 
    $oDB -> query ($sQuery);
 
    $aRes = $oDB -> fetch_assoc ();
 
    $nomUser = $aRes['dest_nom'];
 
    */
 
    $nomUser = 'USER #'.$idUser;
 
    $ord = ($_POST['ord'] == 0)?false:true;
 
    $sOutput .= $oLogger -> getDetail ($ord, $_POST['type'], $_POST['page']);
 
}
 
 
 
$appPath = "Gestion / Logs / Détails /";
 
?>
 
<html>
 
 
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 
<title>Template site logistique</title>
 
<link rel="stylesheet" href="css/main.css" />
 
<style type="text/css">
 
/* local style */
 
</style>
 
<script language="Javascript" type="text/javascript">
 
function tri () {
 
    with (document.getElementById('hid')) {
 
        ord.value = (ord.value == 0)?1:0;
 
        submit ();
 
    }
 
}
 
 
function filtreType (t) {
 
    with (document.getElementById('hid')) {
 
        type.value = t;
 
        submit ();
 
    }
 
}
 
 
function filtrePage (p) {
 
    with (document.getElementById('hid')) {
 
        page.value = p;
 
        submit ();
 
    }
 
}
 
 
function _blank () {
 
    with (document.getElementById('hid')) {
 
        page.value = '';
 
        type.value = '';
 
        submit ();
 
    }
 
}
 
</script>
 
</head>
 
 
<body>
 
 
<div id="main">
 
    <div id="search">
 
        <h3>Rechercher</h3>
 
        <form id="hid" action="" method="post">
 
        <label for="types">Types de requête</label>
 
        <?php echo $sTypeSelect; ?>
 
        <label for="pages">Pages</label>
 
        <?php echo $sPageSelect; ?>
 
        <input type="hidden" name="ord" value="<?php echo $_POST['ord']; ?>" />
 
        <input type="hidden" name="fichier" value="<?php echo $_POST['fichier']; ?>" />
 
        <input type="hidden" name="type" value="<?php echo $_POST['type']; ?>" />
 
        <input type="hidden" name="page" value="<?php echo $_POST['page']; ?>" />
 
        </form>
 
        <br />
 
        <br />
 
        <center><input type="button" value=" Annuler " onclick="_blank('hid');" class="bt" style="cursor:pointer;"/></center>
 
        <br />
 
    </div>
 
    <div id="cont">
 
        <span class="context"><a href="log.consult.php">BACK TO LOGS LIST</a></span>
 
        <!-- START:search module -->
 
        <div id="asearch">
 
            <span class="context"><?php echo $sSearchContext;?></span>
 
        </div>
 
        <div id="path"><?php echo $appPath; ?>
 
        </div>
 
        <!-- END:search module -->
 
        <table class="result" cellpadding="0" cellspacing="0" style="width: 100%;">
 
            <th colspan="4"><?php echo $nomFichier; ?> - <?php echo $nomUser; ?> </th>
 
            <tr>
 
                <td style="width: 50px;"><div class="title"><a href="javascript:tri ();">DATE</a></div></td>
 
                <td style="width: 80px;"><div class="title">PAGE</div></td>
 
                <td style="width: 80px;"><div class="title">TYPE</div></td>
 
                <td style="width: 150px;"><div class="title">QUERY</div></td>
 
            </tr>
 
                <?php echo $sOutput; ?>
 
        </table>
 
    </div>
 
</div>
 
 |