<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.9

Copyright (C) 2006-2009  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://smitst.homelinux.com
****************************************************************************************/


// 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 -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td nowrap>
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET" name="formr" id="formr" onSubmit="javascript:; return (verif_formrl(this,tab1_champ,'','<?PHP echo $_SESSION["lng"]; ?>'));">
	<input type="text" name="search" value="<?php echo @$_GET['search']; ?>"> 
	 <a href="javascript:;" onClick="document.formr.search.value=''"><img src="../img/raz.png" border="0" align="absmiddle"></a>
	 <span class="annot_petit_gras">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">
	<img src="../img/calendar.png" align="absmiddle" id="f_img_dd" title="<?PHP echo $alt_chxdate; ?>">
	 <select name="hd" id="hd">
	<?PHP
	// Création de la liste des heures
	for ($i=300; $i<86400 ;$i+=300)
	{
		$heure=heure_to_hhmm(sec_heure($i));
		echo '<option value="'.$heure.'" ';
		if (isset($_GET['hd']))
		{
			if ($_GET['hd']== $heure)
				echo ' selected';
		}
		echo '>'.$heure.'</option>';
	}
	?>
	</select>
	<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	 <span class="annot_petit_gras">au</span> 
	<input name="df" type="text" id="df" value="<?php echo @$_GET['df']; ?>" size="10" maxlength="10" readonly="1">
	<img src="../img/calendar.png" align="absmiddle" id="f_img_df" title="<?PHP echo $alt_chxdate; ?>">
	 <select name="hf" id="hf">
	<?PHP
	// Création de la liste des heures
	for ($i=300; $i<86400 ;$i+=300)
	{
		$heure=heure_to_hhmm(sec_heure($i));
		echo '<option value="'.$heure.'" ';
		if (isset($_GET['hf']))
		{
			if ($_GET['hf']== $heure)
				echo ' selected';
		}
		echo '>'.$heure.'</option>';
	}
	?>
	</select>
	<img src="../img/oblig.png" align="absmiddle" alt="<?PHP echo $alt_chp_oblig; ?>">
	<?PHP
	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.'">';

	}
	?>	
	<br /><input name="rech" type="submit" class="bton_std" id="rech" value="<?PHP echo $but_rech; ?>">
	<input type="reset" class="bton_std" value="<?PHP echo $but_reinit; ?>" onClick="self.location='<?PHP echo "pdtloc_lst.php?td=".$td."&ta=".$ta."&cc=".$cc."&ca=".$ca."&cl=".$cl."&dd=".$dd."&df=".$df."&fi=1"; ?>';">
	</form>
	<script type="text/javascript">
	<!--
	Calendar.setup({
		inputField     :    "dd",     // id of the input field
		ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
		button         :    "f_img_dd",  // trigger for the calendar (button ID)
		align          :    "Br",           // alignment (defaults to "Bl")
		electric	   :	false,
		singleClick    :    true
	});
	Calendar.setup({
		inputField     :    "df",     // id of the input field
		ifFormat       :    "<?PHP echo $datefmtc; ?>",      // format of the input field
		button         :    "f_img_df",  // trigger for the calendar (button ID)
		align          :    "Br",           // alignment (defaults to "Bl")
		electric	   :	false,
		singleClick    :    true
	});
	//-->
	</script>
	</td>
	<td nowrap align="right">
	<?PHP if ($afflst==TRUE) { ?>
	<a href="javascript:;" onclick="self.location.reload();"><img src="../img/reload.png" title="Rafraîchir l'affichage" border="0" align="absmiddle"></a>
	<a href="javascript:;" onclick="self.location.reload();")>Rafra&icirc;chir l'affichage</a>
	<?PHP } 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)
		{
	?>
		<br /><img src="../img/filtre.png" border="0" align="absmiddle" title="Filtrer">
		 <select name="fi" size="1" id="fi" onChange="javascript:; fen_lst_filtre(this.value,<?PHP  echo (count($tab_fi)-1); ?>);" class="annot_petit">
		<?PHP
		foreach ($tab_fi as $key=>$value)
		{
			echo '<option value="'.$key.'" class="annot_petit"'; 
			if ($fi == intval($key))
				echo ' selected';
			echo '>';
			echo $value."</option>";
		}
		?>		
		</select>
	<?PHP
		} else echo "&nbsp;";
	} else echo "&nbsp;";
	?>
  </td>
</tr>
</table>
<!--- Fin du Formulaire de Recherche -->
