Rev 11 | Rev 15 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library 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 |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: eflore_photo.inc.php,v 1.4 2004-06-23 13:21:23 linda Exp $
/**
* Titre
*
* Description
*
*@package nom_du_paquetage
*@subpackage nom_du_sous-paquetage_si_necessaire
//Auteur original :
*@author linda ANGAMA<linda_angama@yahoo.fr>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $ $Date: 2004-06-23 13:21:23 $
*/
$res="";
GEN_stockerStyleExterne('photo', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/photo.css');
if (isset($_GET['agrandit']))
{
$res.="<div>";
$res.="<p><a href=\"papyrus.php?site=3&menu=39&onglet=photo&"./*.SID."&*/"deb=".$_SESSION['dep']."\">Retour à la miniature</a></p>";
$res.="<div class=\"debord\"><img src=\"".$_GET['agrandit']."\"></div></div>";
//unset($agrandit);
}
else
{
if (!isset($_GET['deb'])) {$deb=0;}
else {$deb=$_GET['deb'];}
$_SESSION['dep']=$deb;
$sep="\"\n";
$img_pg=6;
$img_l=3;
$prec=null;
$suiv=null;
//en-tete commune a tous les fichiers rdf
$en_tete="<rdf=RDF";
$en_tete .="\n";
$en_tete .="xmls:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#";
$en_tete .=$sep;
$en_tete .="xmls:dc=\"http://purl.org/dc/elements/1.1/".$sep;
$en_tete .="xmls:dcterms=\"http://purl.org/dc/terms".$sep;
$en_tete .=">"."\n\n";
//connexion a la base
if (DB::isError($GLOBALS['db_eflore']))
{
echo "<ERREUR>";
echo "Impossible d'établir de connexion ",$GLOBALS['db_eflore']->getMessage();
echo "</ERREUR>";
exit;
}
//requete sql
$req="select * from images";
$cond="";
// $cond="where identifier<=7";
$requete="select count('identifier') from images ";
if(!$cond=="")
{
$resultat=$GLOBALS['db_eflore']->query($req." ".$cond);
$cpt=$GLOBALS['db_eflore']->query("select count('identifier') from images ".$cond);
$nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
//print("nombre de lignes résultat de la requête : ".$nbre_ligne[0]."<br>");
}
else
{
$resultat=$GLOBALS['db_eflore']->query($req);
$cpt=$GLOBALS['db_eflore']->query("select count('identifier') from images ");
$nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
}
//selection des lignes de la requete à traiter
if (($deb+$img_pg+1)<=($nbre_ligne[0]))
{
$fin=$deb+$img_pg-1;
}
else
{
$fin=$nbre_ligne[0]-1;
}
//affichage des miniatures et génération des fichiers rdf
if ($fin!==0)
{
$res.=" <ul class=\"liste_photo\">\n";
foreach (range($deb, $fin) as $num_ligne)
{
if (!$ligne = $resultat->fetchrow(DB_FETCHMODE_ORDERED, $num_ligne))
{
break;
}
if ($num_ligne%$img_l==0)
{
$res.=" ";
$res.="<li class=\"colonne\">";
$res.="\n ";
$res.="<ul>\n";
}
$url_img=$ligne[8];
$url_img_mini=$url_img."mini_photos_plte/mini_";
$url_img_mini .=$ligne[1];
$url_img .=$ligne[1];
$res.=" ";
$res.="<li class=\"ligne\">\n";
$res.=" ";
$res.="<a href=\"papyrus.php?site=3&menu=39&onglet=photo&agrandit=".$url_img."\">";
$res.="\n ";
$res.="<img src=\"".$url_img_mini."\" border=0 />";
$res.="\n ";
$res.="</a>";
$res.="\n ";
$res.="<p class=\"info\">";
$res.="\n ";
$res.="<span class=\"label\">";
$res.="\n ";
$res.="num_ligne : ".$num_ligne;
$res.="\n ";
$res.="</span>";
$res.="\n ";
$res.="<span class=\"label\">";
$res.="\n ";
$res.="id: ".$ligne[0]."->".$ligne[1];
$res.="\n ";
$res.="</span>";
$res.="\n ";
$res.="</p>";
$res.="\n ";
$res.="</li>\n";
if ($num_ligne%$img_l==2)
{
$res.=" </ul> \n";
}
//génération d'un fichier rdf pour chaque resultat de la requete
$fic=EFLORE_CHEMIN_RDF;
$fic .=$ligne[0];
$fic .=".rdf";
if(!file_exists($fic))
{
$fp=fopen($fic,"w+");
$text_rdf="";
if(!$fp)
{
$res.="erreur de création du fichier rdf";
exit;
}
$text_rdf .=$en_tete;
$text_rdf .="<rdf:Description rdf:about=\"";
$url_img=$ligne[8];
$url_img .=$ligne[1];
$text_rdf .=$url_img .$sep;
$text_rdf .="dc:identifier=\"";
$text_rdf .=$ligne[0];
$text_rdf .=$sep;
$text_rdf .="dc:title=\"";
$text_rdf .=$ligne[1];
$text_rdf .=$sep;
$text_rdf .="dc:creator=\"";
$text_rdf .=$ligne[2];
$text_rdf .=$sep;
$text_rdf .="dc:type=\"";
$text_rdf .=$ligne[3];
$text_rdf .=$sep;
if(!(is_null($ligne[4])))
{
$text_rdf .="dcterms:created=\"";
$text_rdf .=$ligne[4];
$text_rdf .=$sep;
}
$text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
$i=fwrite($fp,$text_rdf);
fclose($fp);
}
}
$res.="</ul>\n";
//affichage des liens suivant/précédent
if ($deb!=0)
{
if (($deb-$img_pg-1)>=0)
{
$prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($deb-$img_pg-1).">Précédent</a>";
$res.="<div class=\"prec\">".$prec."</div>";
}
else
{
$prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=0>Précédent</a>";
}
$res.="<div class=\"prec\">".$prec."</div>";
}
if ($deb+$img_pg<$nbre_ligne[0])
{
$suiv="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($fin+1).">Suivant</a>";
$res.="<div class=\"suiv\">".$suiv."</div>";
}
}
}
?>