Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 3 | Rev 11 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 linda 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
5 linda 22
// CVS : $Id: eflore_photo.inc.php,v 1.2 2004-06-17 15:19:26 linda Exp $
3 linda 23
/**
24
* Titre
25
*
26
* Description
27
*
28
*@package nom_du_paquetage
29
*@subpackage nom_du_sous-paquetage_si_necessaire
30
//Auteur original :
31
*@author        linda ANGAMA<linda_angama@yahoo.fr>
32
//Autres auteurs :
33
*@author        Aucun
34
*@copyright     Tela-Botanica 2000-2004
5 linda 35
*@version       $Revision: 1.2 $ $Date: 2004-06-17 15:19:26 $
3 linda 36
*/
37
 
5 linda 38
 
3 linda 39
$res="";
40
 
5 linda 41
GEN_stockerStyleExterne('photo', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/photo.css');
42
$deb=$_GET['deb'];
43
$agrandit=$_GET['agrandit'];
3 linda 44
if (isset($agrandit))
45
{
46
$res.="<div align=\"center\">";
5 linda 47
$res.="<p><a href=\"eflore_photo.inc.php?".SID."&deb=".$_SESSION['dep']."\">Retour &agrave la miniature</a></p>";
3 linda 48
$res.="<img src=\"".$agrandit."\"></div>";
49
unset($agrandit);
50
}
5 linda 51
else
52
{
53
if (!isset($deb)){$deb=0;}
3 linda 54
$_SESSION['dep']=$deb;
55
$path_rdf="/home/linda/Documents/testphp/rdf/";
56
$sep="\"\n";
57
$img_pg=6;
58
$prec=null;
59
$suiv=null;
60
 
61
//en-tete commune a tous les fichiers rdf
62
$en_tete="<rdf=RDF";
63
$en_tete .="\n";
64
$en_tete .="xmls:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#";
65
$en_tete .=$sep;
66
$en_tete .="xmls:dc=\"http://purl.org/dc/elements/1.1/".$sep;
67
$en_tete .="xmls:dcterms=\"http://purl.org/dc/terms".$sep;
68
$en_tete .=">"."\n\n";
69
 
70
//connexion a la base
71
$dsn="mysql://root:0000@localhost/test";
72
$db=DB::connect($dsn);
73
 if (DB::isError($db))
74
  {
75
        echo "<ERREUR>";
76
        echo "Impossible d'&eacutetablir de connexion ",$db->getMessage();
77
        echo "</ERREUR>";
78
        exit;
79
    }
80
 
81
 
82
//requete sql
83
$req="select * from images";
84
$cond="where identifier<=7";
5 linda 85
$requete="select count('identifier') from images ";
3 linda 86
if(!$cond=="")
87
{
88
	$resultat=$db->query($req." ".$cond);
89
	$cpt=$db->query("select count('identifier') from images ".$cond);
5 linda 90
    echo $requete.$cond;
3 linda 91
	$nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
92
	print("nombre de lignes r&eacutesultat de la requ&ecircte : ".$nbre_ligne[0]."<br>");
93
}
94
else
95
{
96
	$resultat=$db->query($req);
97
	$cpt=$db->query("select count('identifier') from images ");
98
	$nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
99
}
100
 
101
//selection des lignes de la requete &agrave traiter
102
 
103
if (($deb+$img_pg+1)<=($nbre_ligne[0]))
104
{
105
	$fin=$deb+$img_pg-1;
106
}
107
else
108
{
109
	$fin=$nbre_ligne[0]-1;
110
}
111
 
112
 
113
 
114
//affichage des miniatures et g&eacuten&eacuteration des fichiers rdf
115
if ($fin!==0)
116
{
117
	foreach (range($deb, $fin) as $num_ligne)
118
	{
119
		if (!$ligne = $resultat->fetchrow(DB_FETCHMODE_ORDERED, $num_ligne))
120
		{
121
			break;
122
		}
123
		$url_img=$ligne[8];
124
		$url_img_mini=$url_img."mini_photos/mini_";
125
		$url_img_mini .=$ligne[1];
126
		$url_img .=$ligne[1];
127
		$res.="<div class=\"float\">";
128
		$res.="<map name=\"mini".$url_img."\">";
129
		$res.="<area shape=\"rect\" coords=\"0,0,175,175\" href=\"gde_photo.php?agrandit=".$url_img."&".SID."\">";
130
		$res.="</map>";
131
		$res.="<img src=\"".$url_img_mini."\" border=0 usemap=\"#mini".$url_img."\">";
132
		$res.="<p>num_ligne : ".$num_ligne."  id:  ".$ligne[0]."->".$ligne[1]."</p></div>";
133
 
5 linda 134
/*		//g&eacuten&eacuteration d'un fichier rdf pour chaque resultat de la requete
3 linda 135
		$fic=$path_rdf;
136
		$fic .=$ligne[0];
137
		$fic .=".rdf";
138
		if(!file_exists($fic))
139
		{
140
			$fp=fopen($fic,"w+");
141
			$text_rdf="";
142
			if(!$fp)
143
			{
144
				$res.="erreur de cr&eacuteation du fichier rdf";
145
				exit;
146
			}
147
 
148
			$text_rdf .=$en_tete;
149
 
150
			$text_rdf .="<rdf:Description  rdf:about=\"";
151
			$url_img=$ligne[8];
152
			$url_img .=$ligne[1];
153
			$text_rdf .=$url_img .$sep;
154
 
155
			$text_rdf .="dc:identifier=\"";
156
			$text_rdf .=$ligne[0];
157
			$text_rdf .=$sep;
158
 
159
			$text_rdf .="dc:title=\"";
160
			$text_rdf .=$ligne[1];
161
			$text_rdf .=$sep;
162
 
163
			$text_rdf .="dc:creator=\"";
164
			$text_rdf .=$ligne[2];
165
			$text_rdf .=$sep;
166
 
167
			$text_rdf .="dc:type=\"";
168
			$text_rdf .=$ligne[3];
169
			$text_rdf .=$sep;
170
 
171
			if(!(is_null($ligne[4])))
172
			{
173
				$text_rdf .="dcterms:created=\"";
174
				$text_rdf .=$ligne[4];
175
				$text_rdf .=$sep;
176
			}
177
 
178
			$text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
179
 
180
			$i=fwrite($fp,$text_rdf);
181
			fclose($fp);
5 linda 182
		}*/
3 linda 183
	}
184
	if ($deb!=0)
185
	{
186
		if (($deb-$img_pg-1)>=0)
187
		{
5 linda 188
			$prec="<a href=eflore_photo.inc.php?deb=".($deb-$img_pg-1).">Pr&eacutec&eacutedent</a>";
3 linda 189
			$res.="<div class=\"prec\">".$prec."</div>";
190
		}
191
		else
192
		{
5 linda 193
			$prec="<a href=eflore_photo.inc.php?deb=0>Pr&eacutec&eacutedent</a>";
3 linda 194
		}
195
		$res.="<div class=\"prec\">".$prec."</div>";
196
	}
197
 
198
	if ($deb+$img_pg<$nbre_ligne[0])
199
	{
5 linda 200
		$suiv="<a href=eflore_photo.inc.php?deb=".($fin+1).">Suivant</a>";
3 linda 201
		$res.="<div class=\"suiv\">".$suiv."</div>";
202
	}
203
 
204
}
205
 
206
DB::disconnect();
5 linda 207
}
3 linda 208
echo $res;
209
 
210
?>
211
</BODY>
212
</HTML>