<?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");
?>

<!-- Scripts Javascript pour fenêtres -->
<script language="JavaScript" src="../jscript/fen.js"></script>

<!-- Scripts Javascript pour contrôle de formulaire -->
<script	type="text/javascript" src="../jscript/verif_form.js"></script>
<br>
<!--- Formulaire de Recherche -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td nowrap width="33%">
	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET" name="formr" id="formr">
	<input type="text" name="search" value="<?php echo @$_GET['search']; ?>"> 
	<input type="hidden" name="page" value="1"> 
	<input name="rech" type="button" class="bton_std" id="rech" value="<?PHP echo $but_rech; ?>" onClick="submit_rech_lst();">
	<input name="reinit" type="button" class="bton_std" value="<?PHP echo $but_reinit; ?>" onClick="document.formr.search.value='';submit_rech_lst();">
	<?PHP
	foreach ($_GET as $key=>$value)
	{
		if (($key<>"search") && ($key<>"fi") && ($key<>"page"))
			echo '<input type="hidden" name="'.$key.'" id="'.$key.'" value="'.$value.'">';

	}
	$urlimp = $fic_imp."?".$_SERVER['QUERY_STRING'];
	?>	    
	</form>
	</td>
	<td nowrap align="center" width="33%">
	<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>
	</td>
	<td nowrap align="right">
	<?PHP if ((@$_GET['ta'] <> "i") AND ($fic_imp <>"")) { ?>
	<a href="javascript:;" onclick="lanceimp('<?PHP echo $urlimp; ?>');")><img src="../img/print.png" title="Imprimer dernière Recherche" border="0" align="absmiddle"></a>
	<a href="javascript:;" onclick="lanceimp('<?PHP echo $urlimp; ?>');")> Imprimer la derni&egrave;re recherche</a>
	<?PHP }  else echo "&nbsp;";
  	if (($url_add <> "") AND (@$_GET['ta'] <> "i"))
		echo '<br /><a href="'.$url_add.'"><img src="../img/add.png" title ="Ajouter enregistrement" border="0" align="absmiddle"> Ajouter</a>';
	else 
		echo "&nbsp;";

	?>
	</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td nowrap colspan="2">
	<?PHP 
	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;";
	?>
	</td>
	<td align="right">
	<div style="padding-top:5px;">
	<?PHP
  	if ($url_rss <> "")
	{
		// On vérifie si le module rss est bien en place
		if (file_exists("../rss/rss.php"))
		{
			echo '<img src="../img/feed_add.png" title ="S\'abonner &aacute; un flux RSS" border="0" align="absmiddle"> ';
			echo '<select class="annot_petit" name="rss" size="1" id="rss" onChange="javascript:; var lnk=this.value; this.value=\'-1\'; if (document.all) {fensaisie(lnk,800,600,\'directories=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes\');}else{document.location.href=lnk;}">';
			echo '<option value="-1" class="annot_petit" "selected">&raquo; Choisir le flux &laquo;</option>';
			// 15 derniers enregistrements
			echo '<option value="'.$url_rss.'&lst=15" class="annot_petit">';
			echo 'Les 15 derniers enregistrements</option>';
			// 30 derniers enregistrements
			echo '<option value="'.$url_rss.'&lst=30" class="annot_petit">';
			echo 'Les 30 derniers enregistrements</option>';
			// Cette semaine
			echo '<option value="'.$url_rss.'&week=1" class="annot_petit">';
			echo 'Les enregistrements de cette semaine</option>';
			// 15 derniers jours
			echo '<option value="'.$url_rss.'&nday=15" class="annot_petit">';
			echo 'Les enregistrements des 15 derniers jours</option>';
			// Cette semaine
			echo '<option value="'.$url_rss.'&nday=30" class="annot_petit">';
			echo 'Les enregistrements des 30 derniers jours</option>';
			echo '</select>';
		}
		else
			echo "&nbsp;";
  	}
	else
		echo "&nbsp;";
	?>
	</div>
	</td>
</tr>
<tr>
  <td nowrap="nowrap" colspan="2">
  <div class="annot_petit_it"> Nota :
  <div style="margin-left:10px;">
  <?PHP if ($lst_villes==FALSE) { ?>
  Pour voir la signification d'une ic&ocirc;ne, laissez le pointeur de la souris dessus.<br />
  Vous pouvez &eacute;galement effectuer des recherches sur les dates &quot;sous&quot; les ic&ocirc;nes et sur les codes ou libell&eacute;s &quot;sous&quot; les ic&ocirc;nes de statuts/lieux.
  <?PHP } else { ?>
  Veuillez saisir au moins 4 caract&egrave;res pour la recherche.
  <?PHP } ?>
  </div>
  </div>
  </td>
  <td align="right" valign="top">
	<?PHP
	if (count($tab_fi)>0)
	{
		echo '<br /><img src="../img/filtre.png" border="0" align="absmiddle" title="Filtrer">';
		echo ' <select class="annot_petit" name="fi" size="1" id="fi" onChange="javascript:; fen_lst_filtre(this.value,'.count($tab_fi).');">';
		echo '<option value="-1" class="annot_petit" ';
		if ($fi==-1) echo "selected";
		echo '>&raquo; Choisir filtre &laquo;</option>';
		foreach ($tab_fi as $key=>$value)
		{
			echo '<option value="'.$key.'" class="annot_petit"'; 
			if (($fi == $key) AND ($fi<>""))
				echo ' selected';
			echo '>';
			echo $value."</option>";
		}
		echo '</select>';
	} else 
		echo '&nbsp;';
	?>
  </td>
</tr>
</table>
<!--- Fin du Formulaire de Recherche -->
