Location: PHPKode > projects > Open Biblio > biblio2/pretlist.php
<?php  
/* OpenBIBLIO -- A library administration web interface
 * Copyright (C) 2002-2005 Fr&eacute;d&eacute;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.
 */
include_once("includes/db.inc");
include_once("includes/functions.inc");

session_start();
include_once("includes/session.inc");

ControleAcces("pretlist.php",$login,$pwd,$user_id,session_id());

if(!$user_id)
{
 exit;
}

$tab_mois = array('',_('janvier'),_('f&eacute;vrier'),_('mars'),_('avril'),_('mai'),_('juin'),_('juillet'),_('août'),_('septembre'),_('octobre'),_('novembre'),_('decembre'));
$date_ent = date("Y-m-d");
ereg("(....)-(..)-(..)$",$date_ent,$match);
$jour  = $match[3];
$mois  = sprintf("%d",$match[2]);
$annee = $match[1];
$date_ent =  "$jour " . $tab_mois[$mois] . " $annee";
put_log(6,_("LISTING PRETS") ." : $date_ent",$user);
$title = _("Listing des livres toujours en pr&ecirc;t au $date_ent");
$date_ent = date("Y-m-d");
include ("includes/header.inc");


$requete = "SELECT t2.nom, t1.date_out, t1.id id_to, t4.nom nom_el, t4.prenom prenom_el, t6.classe, t5.local, t5.biblio, t5.rangee FROM prets as t1 inner join livres as t2 on t2.id=t1.livre_ID inner join eleves as t4 on t4.id = t1.eleve_ID inner join classes as t6 on t6.id = t4.classe_id inner join locations as t5 on t5.id=t2.location_ID where date_int is null order by t6.classe,t5.local, t5.biblio, t5.rangee, t4.nom, t2.nom "; 
if(!($resultat = biblio_db_query($requete)))
{ print _("PROBLEME : ") .biblio_db_error(); }
else 
{ 
  $i=0;	        
  echo "<br><CENTER><TABLE BORDER=1><tr><th>";
  echo _("Classe");
  echo "</th><th>";
  echo _("Eleve");
  echo "</th><th>";
  echo _("Titre");
  echo "</th><th>";
  echo _("Local");
  echo "</th><th>";
  echo _("Biblio");
  echo "</th><th>";
  echo _("Rang&eacute;e");
  echo "</th><th>";
  echo _("Nb de jours<BR>d'emprunt");
  echo "</th></tr>";
  while ($myrow = biblio_db_fetch_array($resultat)) 
  {
       $classe = $myrow['classe'];
       $eleve = $myrow['nom_el'] . " " . $myrow['prenom_el'];
       $local  = $myrow['local'];
       $biblio = $myrow['biblio'];
       $rangee = $myrow['rangee'];
       $livre_titre = $myrow['nom'];
       $date_out = $myrow['date_out'];
       $date_end =  date("Y-m-d");
       $elementsdate = explode("-",$date_out);
       $date_start = mktime(0,0,0,$elementsdate[1],$elementsdate[2],$elementsdate[0]);
       $elementsdate = explode("-",$date_end);
       $date_end = mktime(0,0,0,$elementsdate[1],$elementsdate[2],$elementsdate[0]);
       $total_jour = $date_end - $date_start;
       $total_jour = $total_jour/86400;
       $i++;
       if ($i%2 == 1) {$col="WHITE";}
       else {$col="lightyellow";}
       echo "<TR bgcolor=$col><TD>$classe</TD><TD>$eleve</TD><TD>$livre_titre</TD><TD>$local</TD><TD>$biblio</TD><TD ALIGN=RIGHT> $rangee</TD><TD ALIGN=RIGHT> $total_jour</TD></tr>";      
  }     
}

print "</TABLE></CENTER>";
?>
<br><br>
<div>
<span id=left-text>
<A HREF="admin.php?menu=1">
<?php echo _("retour menu administration"); ?>
</A><BR>
<A HREF="index.php">
<?php echo _("retour menu principal"); ?>
</A></span>
</div>
<br>
<?php
include("includes/footer.inc");
?>
Return current item: Open Biblio