Location: PHPKode > projects > Open Biblio > biblio2/includes/search2.inc
<?php  
/* OpenBIBLIO -- A library administration web interface
 * Copyright (C) 2002-2005 Frédéric Descamps <hide@address.com>
 *
 * 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; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
          ?>
	<br>
        <CENTER>

        <FORM action=histobook.php METHOD=POST>
        <TABLE BORDER=0>
        <TR>
        <TD>
	<?php echo _("Titre"); ?> :</TD><TD><INPUT TYPE="text" NAME="liv_nom" size=15" ></TD>        
        </TABLE><BR>
        <INPUT TYPE="hidden" NAME="user" value="<?php echo $user; ?>">
        <INPUT TYPE="hidden" NAME="action" value="<?php echo $action; ?>">
        <INPUT TYPE="hidden" NAME="type" value="<?php echo $type; ?>">
        <INPUT TYPE="hidden" NAME="sw" value="1">
        <INPUT TYPE="hidden" NAME="id" value="<?php echo $id; ?>">        
        <input type="Submit" value="<?php echo _("Rechercher"); ?>">
        </FORM>
        <HR>
        <FORM action=histobook.php METHOD=POST>
        <TABLE BORDER=0>
        <TR>
        <TD>ISBN :</TD><TD><INPUT TYPE="text" NAME="liv_ISBN" size=15" ></TD>
        </TABLE><BR>
        <INPUT TYPE="hidden" NAME="user" value="<?php echo $_POST['user']; ?>">
        <INPUT TYPE="hidden" NAME="action" value="<?php echo $_POST['action']; ?>">
        <INPUT TYPE="hidden" NAME="type" value="<?php echo $_POST['type']; ?>">
        <INPUT TYPE="hidden" NAME="sw" value="1">
        <INPUT TYPE="hidden" NAME="id" value="<?php echo $_POST['id']; ?>">
        <input type="Submit" value="<?php echo _("Rechercher"); ?>">
        </FORM>
        </CENTER><HR>
        <?php
  if($_POST['liv_ISBN']){$rech ="ISBN like '%". return_isbn($_POST['liv_ISBN']) ."%'"; }
  if($_POST['liv_nom']){$rech ="nom like '%${_POST['liv_nom']}%'"; }
  if($rech)
  {
  $requete = "select * from livres where " . $rech ." order by nom";
  put_log(1,$requete,$user);
  if(!($resultat = biblio_db_query($requete)))
  { print _("PROBLEME : ") .biblio_db_error(); }
  else 
  {
                echo "<CENTER><H3>";
		echo _("Selectionner un livre");
		echo "</H3>";                
                echo "<TABLE><TR><th>";
		echo _("Titre");
		echo "</th><th>";
		echo _("Auteur");
		echo "</th><th>";
		echo _("Genre");
		echo "</th><th>";
		echo _("ISBN");
		echo "</th><th>";
		echo _("Disponible");
		echo "</th><th>";
		echo _("Action");
		echo "</th><tr>";
                while ($row = biblio_db_fetch_array($resultat)) 
	        {      
                        $liv_id = $row['id'];           
                        $liv_nom =  $row['nom'];                                
                        $liv_auteur =  $row['auteur']; 
                        $liv_genre_ID =  $row['genre_ID']; 
                        $liv_local_ID =  $row['location_ID']; 
                        $liv_etat_ID =  $row['etat_ID'];
                        $liv_ISBN =  $row['ISBN'];   
                        $liv_ed = $row['edition'];   
                        $liv_date = $row['date_ed'];
                        $liv_col = $row['collection'];  
                        $liv_temp = $row['temp']; 
                        $liv_noout = $row['noout']; 
                        $liv_del = $row['del']; 
                        $requete = "select * from genres where id=$liv_genre_ID";
                        if($resultat2 = biblio_db_query($requete))
                        while ($row2 = biblio_db_fetch_array($resultat2)) 
	                {       
	                  $genre = $row2['genre'];
	                }
                       $str_a ="<IMG SRC=\"images/wh_r_arr.gif\" ALT=\"" . _("voir"). "\" border=0>"; 
			
			if ($liv_del_str == 1) $liv_del_str = "<FONT COLOR=RED>non</FONT>";
			else $liv_del_str = _("oui");

                        echo "<TR><TD>$liv_nom</TD><TD>$liv_auteur</TD><TD>$genre</TD><TD>$liv_ISBN</TD><TD ALIGN=RIGHT>$liv_del_str</TD>";
			echo "<TD ALIGN=RIGHT><A href=\"histobook.php?user=$user&nom=$liv_nom&id=$liv_id\">$str_a</A></TD></tr>";            
                }
                echo "</TABLE></CENTER>";
  }
 }      
?>
Return current item: Open Biblio