<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.2
 *
 * Copyright (C) 2006-2015  Sylvain FATOME
 * This program is free software; you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program
 * (in the directory docs);
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Contact : galawa@free.fr
 *
 * Web : http://smi.no-ip.org
 ****************************************************************************************/


// Vérification des tentatives de hack
$pos = strpos($_SERVER['PHP_SELF'], "inc.php");
if ($pos === FALSE)
    $ok_inc = TRUE;
else
    $ok_inc = FALSE;
if ($ok_inc == FALSE) header("Location: ../index.php");

/*************************************************************************************/
/* Formulaire de recherche pour les listes de produits louables en saisie de contrat */
/*************************************************************************************/
?>
<br />
<!--- Formulaire de Recherche -->
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET" name="formr" id="formr">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td nowrap colspan="2">
            <input type="text" name="search" id="search" value="<?php echo @$_GET['search']; ?>" class="searchBox">
            <?PHP echo ' <img src="../img/raz.png" id="razsearch" border="0" align="absmiddle">'; ?>
            <span class="annot_petit_gras"><?PHP echo _("disponible du"); ?></span>
            <input name="dd" type="text" id="dd" value="<?php if (isset($_GET['dd'])) echo @$_GET['dd']; else echo $coloc_datedebf; ?>" size="10" maxlength="10" readonly="1">
            <?PHP
            echo ' <img src="../img/raz.png" id ="razdd" border="0" align="absmiddle">';
            ?>
            <span class="annot_petit_gras"><?PHP echo ' '._("à").' '; ?></span>
            <input name="hd" id="hd" size="5" value="<?PHP echo $hd; ?>" class="selDown" readonly="1">
            <?PHP
            echo ' <img src="../img/oblig.png" align="absmiddle" alt="'._("Champ obligatoire").'">';
            echo ' <img src="../img/raz.png" id ="razhd" border="0" align="absmiddle">';
            ?>
            <span class="annot_petit_gras"><?PHP echo _("au"); ?></span>
            <input name="df" type="text" id="df" value="<?php echo @$_GET['df']; ?>" size="10" maxlength="10" readonly="1">
            <?PHP echo ' <img src="../img/raz.png" id ="razdf" border="0" align="absmiddle">'; ?>
            <span class="annot_petit_gras"><?PHP echo ' '._("à").' '; ?></span>
            <input name="hf" id="hf" size="5" value="<?PHP echo $hf; ?>" class="selDown" readonly="1">
            <?PHP
            echo ' <img src="../img/oblig.png" align="absmiddle" alt="'._("Champ obligatoire").'">';
            echo ' <img src="../img/raz.png" id ="razhf" border="0" align="absmiddle">';
            foreach ($_GET as $key => $value) {
                if (($key <> "search") && ($key <> "dd") && ($key <> "hd") && ($key <> "df") && ($key <> "hf"))
                    echo '<input type="hidden" name="' . $key . '" id="' . $key . '" value="' . $value . '">';

            }
            ?>
        </td>
    </tr>
    <tr>
        <td nowrap>
        <?PHP
            echo '<br />';
            echo '<input name="enr" id ="enr" type="button" class="bton_std" value="'._("Rechercher").'">';
            echo '<input type="button" class="bton_std" id="reset" value="'._("Réinitialiser").'">';
        ?>
        </td>
        <td nowrap align="right">
        <?PHP if ($afflst == TRUE)
        {
            echo '<a href="javascript:;" onclick="self.location.reload();"><img src="../img/reload.png" title="'._("Rafraîchir l'affichage").'" border="0" align="absmiddle">';
            echo ' ';
            echo _("Rafraîchir l'affichage");
            echo '</a>';
	    }
        else
            echo "&nbsp;";
        ?>
        </td>
    </tr>
    <tr>
        <td>
            <?PHP if ($afflst == TRUE) {
                if (!empty($_GET['tri'])) {
                    ?>
                    <span class="annot_petit_it">
		<?PHP
        echo _("Actuellement trié sur").' ';
        echo $_GET['tri'];
        if ($_GET['ord'] == "ASC")
            echo ', '._("ascendant");
        else
            echo ', '._("descendant");
        ?>
		</span>
                <?PHP
                } else echo "&nbsp;";
            } else echo "&nbsp;"; ?>
        </td>
        <td align="right">
            <?PHP
            if ($afflst == TRUE) {
                if (count($tab_fi) > 0) {
                    echo '<br />';
                    echo '<img src="../img/filtre.png" border="0" align="absmiddle" title="'._("Filtrer").'"> ';
                    cre_select('fi', 'fisel', $tab_fi, intval($fi), '', '', 1, FALSE, '', '', FALSE, TRUE);
                } else echo "&nbsp;";
            } else echo "&nbsp;";
            ?>
        </td>
    </tr>
</table>
<!--- Fin du Formulaire de Recherche -->
