Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 3 | Rev 12 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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