Subversion Repositories eFlore/Archives.eflore-consultation-v2

Compare Revisions

Ignore whitespace Rev 16 → Rev 17

/trunk/eflore_photo.inc.php
19,7 → 19,7
// | 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.5 2004-07-01 14:22:41 linda Exp $
// CVS : $Id: eflore_photo.inc.php,v 1.6 2004-08-17 11:13:38 linda Exp $
/**
* Titre
*
32,216 → 32,282
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $ $Date: 2004-07-01 14:22:41 $
*@version $Revision: 1.6 $ $Date: 2004-08-17 11:13:38 $
*/
 
 
$res="";
$res='';
 
GEN_stockerStyleExterne('photo', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/photo.css');
//connexion a la base
 
if (isset($_GET['agrandit']))
if (DB::isError($GLOBALS['db_eflore']))
{
$res.="<div>";
$res.="<p><a href=\"papyrus.php?site=3&menu=39&onglet=photo&"./*.SID."&*/"deb=".$_SESSION['dep']."\">Retour &agrave; la miniature</a></p>";
$res.="<div class=\"debord\"><img src=\"".$_GET['agrandit']."\"></div></div>";
//unset($agrandit);
echo '<ERREUR>';
echo 'Impossible d\'&eacutetablir de connexion '.$GLOBALS['db_eflore']->getMessage();
echo '</ERREUR>';
exit;
}
 
//requete sql
$req_img='select * from eflore_info_image, eflore_info_txt_a_taxon, eflore_inventaire_observation, eflore_licence, eflore_personne_contributeur';
$req=' where eii_id_image=eitat_id_taxon_ref ';
$req.=' and eii_id_version_projet_img=eitat_id_version_projet_taxon_ref ';
$req.=' and eio_ce_image=eii_id_image ';
$req.=' and eii_id_version_projet_img=eio_ce_version_projet_img ';
$req.=' and eii_ce_licence_img=eli_id_licence';
$req.=' and eitat_id_texte='.N_TAXON;
$req.=' and eitat_id_version_projet_txt='.N_VERSION_PROJET_TAXON;
$req.=' and epc_id_contributeur=eii_ce_contributeur_image';
if (isset($_GET['suppr'])){
$req.=' and eii_ce_contributeur_image='.CONTRIBUTEUR;
}
$req_img.=$req;
$resultat_img=$GLOBALS['db_eflore']->query($req_img);
(DB::isError($resultat_img)) ?
die (BOG_afficherErreurSql(__FILE__, __LINE__, 'img:'.$resultat_img->getMessage(), $req_img)) : '' ;
$nbre_ligne=$resultat_img->numRows();
//-------------------------------------------PAGE AVEC LA PHOTO TAILLE REELLE-------------------------------------------------//
if (isset($_GET['agrandit'])){
$req_img.=' and eii_id_image='.$_GET['id'];
$resultat_img=$GLOBALS['db_eflore']->query($req_img);
(DB::isError($resultat_img)) ?
die (BOG_afficherErreurSql(__FILE__, __LINE__, 'img:'.$resultat_img->getMessage(), $req_img)) : '' ;
$ligne=& $resultat_img->fetchRow(DB_FETCHMODE_ASSOC);
$req_nom='select *';
$req_nom.=' from eflore_selection_nom , eflore_nom ';
$req_nom.=' LEFT JOIN eflore_botaniste_intitule_abreviation ON en_ce_auteur_basio= ebia_id_intitule_botaniste_abrege';
$req_nom.=' where esn_id_taxon='.N_TAXON;
$req_nom.=' and esn_id_version_projet_taxon='.N_VERSION_PROJET_TAXON;
$req_nom.=' and esn_id_nom=en_id_nom';
if ($ligne['eio_ce_autre_nom_latin']==0){
$req_nom.=' and en_id_nom='.selectNom();
}
else {
$req_nom.=' and en_id_nom='.$ligne['eio_ce_autre_nom_latin'];
}
$resultat_nom=$GLOBALS['db_eflore']->query($req_nom);
(DB::isError($resultat_nom)) ?
die (BOG_afficherErreurSql(__FILE__, __LINE__, 'cpt:'.$resultat_nom->getMessage(), $req_nom)) : '' ;
$nom=& $resultat_nom->fetchRow(DB_FETCHMODE_ASSOC);
$req_cat='select * from eflore_info_image_valeur, eflore_info_image_posseder_valeur';
$req_cat.=' where eiipv_id_valeur_categorie_img= eiiv_id_valeur_categorie_img ';
$req_cat.=' and eiipv_id_image='.$_GET['id'];
$resultat_cat=$GLOBALS['db_eflore']->query($req_cat);
(DB::isError($resultat_cat)) ?
die (BOG_afficherErreurSql(__FILE__, __LINE__, 'cpt:'.$resultat_cat->getMessage(), $req_cat)) : '' ;
$res.='<div>';
$res.='<p><a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.$_SESSION['dep'].'">Retour &agrave; la miniature</a></p>';
$res.='<p>'.EN_ID_NOM.$nom['en_nom_genre'].' '.$nom['en_epithete_espece'].' '.$nom['ebia_intitule_botaniste_abrege'].'</p>';
if ($ligne['eio_ce_autre_nom_latin']!=0){
$res.='<p>'.EIO_AUTRE_FLORE.$ligne['eio_autre_flore'].'</p>';
}
$res.='<p>'.CONTRIBUTEUR_IMG.$ligne['epc_nom_principal'].'</p>';
$res.='<p>'.EII_AUTEUR_IMG.$ligne['eii_auteur_img'].'</p>';
if ($ligne['eio_autre_auteur_determination']!=NULL){
$res.='<p>'.EIO_AUTRE_AUTEUR_DETERMINATION.$ligne['eio_autre_auteur_determination'].'</p>';
}
while($cat=& $resultat_cat->fetchRow(DB_FETCHMODE_ASSOC)){
switch ($cat['eiiv_ce_categorie_img']) {
case 1:
$res.='<p>'.NATURE.$cat['eiiv_intitule_valeur_categorie_img'].'</p>';
break;
case 2:
$res.='<p>'.DEVELOPPEMENT.$cat['eiiv_intitule_valeur_categorie_img'].'</p>';
break;
case 3:
$res.='<p>'.SUJET.$cat['eiiv_intitule_valeur_categorie_img'].'</p>';
}
}
$res.='<p>'.EIS_LIEUDIT.'</p>';
$form_date=substr($ligne['eio_date_observation'],0,4);
if (($mois=substr($ligne['eio_date_observation'],5,2))!='00'){
$form_date=$mois.'/'.$form_date;
}
if (($jour=substr($ligne['eio_date_observation'],8,2))!='00'){
$form_date=$jour.'/'.$form_date;
}
$res.='<p>'.DATE_IMG.$form_date.'</p>';
$info='';
if ($ligne['eii_description_courte_img']!=NULL){
$info=$ligne['eii_description_courte_img'];
}
else {
$info=$ligne['eii_description_longue_img'];
}
if ($ligne['eii_description_courte_img']!=NULL || $ligne['eii_description_longue_img']!=NULL){
$res.='<p>Informations compl&eacute;mentaires : '.$info.'</p>';
}
$res.='<div class="debord"><img src="'.$_GET['agrandit'].'"></div></div>';
 
$res.=$ligne['eli_texte_licence'];
}
 
//-----------------------------------------PAGE AVEC L'AFFICHAGE DES MINIATURES------------------------------------------------//
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'&eacutetablir de connexion ",$GLOBALS['db_eflore']->getMessage();
echo "</ERREUR>";
exit;
if (!isset($_GET['suppr'])){
//affichage du lien vers le formulaire de soumission d'images
$res.='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&soum=1">'.FORM_AJOUT.'</a>';
if ($nbre_ligne==0){
$res.='<p class="plein_texte">Il n\'y a aucune illustration de ce taxon disponible</p>';
}
 
 
//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&eacute;sultat de la requ&ecirc;te : ".$nbre_ligne[0]."<br>");
$res.='<br /><a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&suppr=1">'.FORM_MODIF.'</a>';
}
else
{
$resultat=$GLOBALS['db_eflore']->query($req);
$cpt=$GLOBALS['db_eflore']->query("select count('identifier') from images ");
$nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
else{
$res.='<p><a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.$_SESSION['dep'].'">'.AFF_MINI.'</a></p>';
}
 
//selection des lignes de la requete &agrave; traiter
 
if (($deb+$img_pg+1)<=($nbre_ligne[0]))
if (($deb+$img_pg+1)<=($nbre_ligne))
{
$fin=$deb+$img_pg-1;
}
else
{
$fin=$nbre_ligne[0]-1;
$fin=$nbre_ligne-1;
}
 
 
 
//affichage des miniatures et g&eacute;n&eacute;ration des fichiers rdf
if ($fin!==0)
{
$res.=" <ul class=\"liste_photo\">\n";
$res.=' <ul class="liste_photo">'."\n";
$i=0;
foreach (range($deb, $fin) as $num_ligne)
{
if (!$ligne = $resultat->fetchrow(DB_FETCHMODE_ORDERED, $num_ligne))
if (!$ligne =& $resultat_img->fetchrow(DB_FETCHMODE_ASSOC, $num_ligne))
{
break;
}
if ($num_ligne%$img_l==0)
{
$res.=" ";
$res.="<li class=\"colonne\">";
$res.=' ';
$res.='<li class="colonne">';
$res.="\n ";
$res.="<ul>\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.="<p class=\"info\">";
$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.="\n ";
$res.="\n ";
$res.="<p class=\"label\">";
$res.="\n ";
$res.="taille réelle de l'image : ".intval(filesize($url_img)/1024)." ko";
$res.="\n ";
list($long,$larg,$type,$attr)=getimagesize($url_img);
$res.="largeur : ".$larg." px<br>";
$res.="\n ";
$res.="longueur :".$long." px<br>";
$res.="\n ";
$res.="auteur : ";
$res.="\n ";
$res.="</p>";
$res.="\n ";
$res.="</p>";
$res.="\n ";
$res.="</li>\n";
$res.="<li class=\"ligne2\"><div class=\"separateur\">&nbsp;</div></li>\n";
if ($num_ligne%$img_l==2)
{
$res.=" </ul> \n";
$res.="<li class=\"colonne\"><span class=\"spacer\"></span></li>";
$i++;
$url_img=$ligne['eii_lien_vers_img'];
$url_img_mini=EFLORE_CHEMIN_IMG_PLTE.'mini_photos_plte/mini_';
$url_img_mini .=$ligne['eii_id_image'].'.jpg';
if ($ligne['eii_lien_vers_img']!=EFLORE_CHEMIN_IMG_PLTE){
$url_img .=$ligne['eii_nom_fichier_img'];
}
//g&eacute;n&eacute;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&eacute;ation du fichier rdf";
exit;
else{
$url_img .=$ligne['eii_id_image'].'.jpg';
}
$res.=' ';
$res.='<li class="ligne">'."\n";
$res.=' ';
$res.='<p class="info">';
if (!@fopen($url_img,'r')){
$res.="\n ";
$res.='<img src="'.$url_img_mini.'" alt="'.$ligne['eii_description_courte_img'].' date:'.$ligne['eio_date_observation'].'" border=0 />';
$res.="\n ";
$res.='</a>';
$res.="\n ";
$res.="\n ";
$res.='</p>';
$res.="\n ";
$res.="\n ";
$res.='<p class="label">';
$res.="\n ";
$res.=DEFAUT_IMG.'<br />';
$res.="\n ";
$res.=AUTEUR.$ligne['eii_auteur_img'];
$res.="\n ";
$res.='</p>';
$res.="\n ";
$res.='</li>'."\n";
}
else{
if (!isset($_GET['suppr'])){
$res.='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&agrandit='.$url_img.'&id='.$ligne['eii_id_image'].'">';
}
$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;
else{
$res.='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&modif=1&id='.$ligne['eii_id_image'].'">';
}
$res.="\n ";
$res.='<img src="'.$url_img_mini.'" alt="'.$ligne['eii_description_courte_img'].DATE_IMG.$ligne['eio_date_observation'].'" border=0 />';
$res.="\n ";
$res.='</a>';
$res.="\n ";
$res.="\n ";
$res.='</p>';
$res.="\n ";
$res.="\n ";
$res.='<p class="label">';
$res.="\n ";
$res.=POIDS.$ligne['eii_poids_img'].' ko<br />';
$res.="\n ";
$res.=TAILLE.$ligne['eii_larg_img'].'x'.$ligne['eii_long_img'].' px<br />';
$res.="\n ";
$res.=AUTEUR.$ligne['eii_auteur_img'];
$res.="\n ";
$res.='</p>';
$res.="\n ";
$res.='</li>'."\n";
}
if ($num_ligne%$img_l==($img_l-1))
{
$res.=" </ul></li> \n";
$res.='<li class="colonne"><span class="spacer"></span></li>';
}
$text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
$i=fwrite($fp,$text_rdf);
fclose($fp);
if (!isset($_GET['suppr'])){
generationRdf($ligne);
}
}
$res.='<li class="colonne"><span class="spacer"></span></li>';
$res.="</ul>\n";
//affichage des liens suivant/précédent
if ($deb!=0)
{
if (($deb-$img_pg-1)>=0)
if (($deb-$img_pg)>=0)
{
$prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($deb-$img_pg-1).">Pr&eacute;c&eacute;dent</a>";
$res.="<div class=\"prec\">".$prec."</div>";
if (!isset($_GET['suppr'])){
$prec='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.($deb-$img_pg).'">'.PREC.'</a>';
}
else{
$prec='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.($deb-$img_pg).'&suppr=1">'.PREC.'</a>';
}
}
else
{
$prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=0>Pr&eacute;c&eacute;dent</a>";
if (!isset($_GET['suppr'])){
$prec='<a href="'.EFLORE_CHEMIN_APPLI.'"&onglet=photo&deb=0">'.PREC.'</a>';
}
else{
$prec='<a href="'.EFLORE_CHEMIN_APPLI.'"&onglet=photo&deb=0&suppr=1">'.PREC.'</a>';
}
}
$res.="<div class=\"prec\">".$prec."</div>";
$res.='<div class="prec">'.$prec.'</div>';
}
if ($deb+$img_pg<$nbre_ligne[0])
if ($deb+$img_pg<$nbre_ligne)
{
$suiv="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($fin+1).">Suivant</a>";
$res.="<div class=\"suiv\">".$suiv."</div>";
if (!isset($_GET['suppr'])){
$suiv='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.($fin+1).'">'.SUIV.'</a>';
}
else{
$suiv='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.($fin+1).'&suppr=1">'.SUIV.'</a>';
}
$res.='<div class="suiv">'.$suiv.'</div>';
}
}
 
}
 
 
?>