Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev 12 Rev 15
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.4 2004-06-23 13:21:23 linda Exp $
22
// CVS : $Id: eflore_photo.inc.php,v 1.5 2004-07-01 14:22:41 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.4 $ $Date: 2004-06-23 13:21:23 $
35
*@version       $Revision: 1.5 $ $Date: 2004-07-01 14:22:41 $
36
*/
36
*/
37
 
37
 
38
 
38
 
39
$res="";
39
$res="";
40
 
40
 
41
GEN_stockerStyleExterne('photo', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/photo.css');
41
GEN_stockerStyleExterne('photo', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/photo.css');
42
 
42
 
43
if (isset($_GET['agrandit']))
43
if (isset($_GET['agrandit']))
44
{
44
{
45
$res.="<div>";
45
$res.="<div>";
46
$res.="<p><a href=\"papyrus.php?site=3&menu=39&onglet=photo&"./*.SID."&*/"deb=".$_SESSION['dep']."\">Retour &agrave; la miniature</a></p>";
46
$res.="<p><a href=\"papyrus.php?site=3&menu=39&onglet=photo&"./*.SID."&*/"deb=".$_SESSION['dep']."\">Retour &agrave; la miniature</a></p>";
47
$res.="<div class=\"debord\"><img src=\"".$_GET['agrandit']."\"></div></div>";
47
$res.="<div class=\"debord\"><img src=\"".$_GET['agrandit']."\"></div></div>";
48
//unset($agrandit);
48
//unset($agrandit);
49
}
49
}
50
else
50
else
51
{
51
{
52
    if (!isset($_GET['deb']))    {$deb=0;}
52
    if (!isset($_GET['deb']))    {$deb=0;}
53
    else {$deb=$_GET['deb'];}
53
    else {$deb=$_GET['deb'];}
54
    $_SESSION['dep']=$deb;
54
    $_SESSION['dep']=$deb;
55
    $sep="\"\n";
55
    $sep="\"\n";
56
    $img_pg=6;
56
    $img_pg=6;
57
    $img_l=3;
57
    $img_l=3;
58
    $prec=null;
58
    $prec=null;
59
    $suiv=null;
59
    $suiv=null;
60
 
60
 
61
    //en-tete commune a tous les fichiers rdf
61
    //en-tete commune a tous les fichiers rdf
62
    $en_tete="<rdf=RDF";
62
    $en_tete="<rdf=RDF";
63
    $en_tete .="\n";
63
    $en_tete .="\n";
64
    $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#";
65
    $en_tete .=$sep;
65
    $en_tete .=$sep;
66
    $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;
67
    $en_tete .="xmls:dcterms=\"http://purl.org/dc/terms".$sep;
67
    $en_tete .="xmls:dcterms=\"http://purl.org/dc/terms".$sep;
68
    $en_tete .=">"."\n\n"; 
68
    $en_tete .=">"."\n\n"; 
69
 
69
 
70
    //connexion a la base
70
    //connexion a la base
71
 
71
 
72
    if (DB::isError($GLOBALS['db_eflore']))
72
    if (DB::isError($GLOBALS['db_eflore']))
73
    {
73
    {
74
        echo "<ERREUR>";
74
        echo "<ERREUR>";
75
        echo "Impossible d'&eacutetablir de connexion ",$GLOBALS['db_eflore']->getMessage();
75
        echo "Impossible d'&eacutetablir de connexion ",$GLOBALS['db_eflore']->getMessage();
76
        echo "</ERREUR>";
76
        echo "</ERREUR>";
77
        exit;
77
        exit;
78
    }
78
    }
79
 
79
 
80
 
80
 
81
    //requete sql 
81
    //requete sql 
82
    $req="select * from images";
82
    $req="select * from images";
83
    $cond="";
83
    $cond="";
84
//    $cond="where identifier<=7";
84
//    $cond="where identifier<=7";
85
    $requete="select count('identifier') from images ";
85
    $requete="select count('identifier') from images ";
86
    if(!$cond=="")
86
    if(!$cond=="")
87
    {
87
    {
88
        $resultat=$GLOBALS['db_eflore']->query($req." ".$cond);
88
        $resultat=$GLOBALS['db_eflore']->query($req." ".$cond);
89
        $cpt=$GLOBALS['db_eflore']->query("select count('identifier') from images ".$cond);
89
        $cpt=$GLOBALS['db_eflore']->query("select count('identifier') from images ".$cond);
90
        $nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
90
        $nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
91
        //print("nombre de lignes r&eacute;sultat de la requ&ecirc;te : ".$nbre_ligne[0]."<br>");
91
        //print("nombre de lignes r&eacute;sultat de la requ&ecirc;te : ".$nbre_ligne[0]."<br>");
92
    }
92
    }
93
    else
93
    else
94
    {
94
    {
95
        $resultat=$GLOBALS['db_eflore']->query($req);
95
        $resultat=$GLOBALS['db_eflore']->query($req);
96
        $cpt=$GLOBALS['db_eflore']->query("select count('identifier') from images ");
96
        $cpt=$GLOBALS['db_eflore']->query("select count('identifier') from images ");
97
        $nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
97
        $nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
98
    }
98
    }
99
 
99
 
100
    //selection des lignes de la requete &agrave; traiter
100
    //selection des lignes de la requete &agrave; traiter
101
 
101
 
102
    if (($deb+$img_pg+1)<=($nbre_ligne[0])) 
102
    if (($deb+$img_pg+1)<=($nbre_ligne[0])) 
103
    {
103
    {
104
        $fin=$deb+$img_pg-1;
104
        $fin=$deb+$img_pg-1;
105
    }
105
    }
106
    else 
106
    else 
107
    {
107
    {
108
        $fin=$nbre_ligne[0]-1;
108
        $fin=$nbre_ligne[0]-1;
109
    }
109
    }
110
 
110
 
111
 
111
 
112
 
112
 
113
    //affichage des miniatures et g&eacute;n&eacute;ration des fichiers rdf
113
    //affichage des miniatures et g&eacute;n&eacute;ration des fichiers rdf
114
    if ($fin!==0)
114
    if ($fin!==0)
115
    {
115
    {
116
        $res.="            <ul class=\"liste_photo\">\n";
116
        $res.="            <ul class=\"liste_photo\">\n";
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
            if ($num_ligne%$img_l==0)
123
            if ($num_ligne%$img_l==0)
124
            {
124
            {
125
                $res.="              ";
125
                $res.="              ";
126
                $res.="<li class=\"colonne\">";
126
                $res.="<li class=\"colonne\">";
127
                $res.="\n              ";
127
                $res.="\n              ";
128
                $res.="<ul>\n";
128
                $res.="<ul>\n";
129
            }
129
            }
130
            $url_img=$ligne[8];
130
            $url_img=$ligne[8];
131
            $url_img_mini=$url_img."mini_photos_plte/mini_";
131
            $url_img_mini=$url_img."mini_photos_plte/mini_";
132
            $url_img_mini .=$ligne[1];
132
            $url_img_mini .=$ligne[1];
133
            $url_img .=$ligne[1];
133
            $url_img .=$ligne[1];
134
            $res.="                ";
134
            $res.="                ";
135
            $res.="<li class=\"ligne\">\n";
135
            $res.="<li class=\"ligne\">\n";
136
            $res.="                  ";
136
            $res.="                  ";
-
 
137
            $res.="<p class=\"info\">";
137
            $res.="<a href=\"papyrus.php?site=3&menu=39&onglet=photo&agrandit=".$url_img."\">";
138
            $res.="<a href=\"papyrus.php?site=3&menu=39&onglet=photo&agrandit=".$url_img."\">";
138
            $res.="\n                    ";
139
            $res.="\n                    ";
139
            $res.="<img src=\"".$url_img_mini."\" border=0 />";
140
            $res.="<img src=\"".$url_img_mini."\" border=0 />";
140
            $res.="\n                  ";
141
            $res.="\n                  ";
141
            $res.="</a>";
142
            $res.="</a>";
142
            $res.="\n                  ";
143
            $res.="\n                  ";
143
            $res.="<p class=\"info\">";
144
            $res.="\n                  ";
-
 
145
            
144
            $res.="\n                    ";
146
            $res.="\n                    ";
145
            $res.="<span class=\"label\">";
147
            $res.="<p class=\"label\">";
146
            $res.="\n                      ";
148
            $res.="\n                      ";
147
            $res.="num_ligne : ".$num_ligne;
149
            $res.="taille réelle de l'image : ".intval(filesize($url_img)/1024)." ko";
148
            $res.="\n                    ";
150
            $res.="\n                    ";
-
 
151
            list($long,$larg,$type,$attr)=getimagesize($url_img);
149
            $res.="</span>";
152
            $res.="largeur : ".$larg." px<br>";
150
            $res.="\n                    ";
153
            $res.="\n                    ";
151
            $res.="<span class=\"label\">";
154
            $res.="longueur :".$long." px<br>";
152
            $res.="\n                      ";
155
            $res.="\n                      ";
153
            $res.="id: ".$ligne[0]."->".$ligne[1];
156
            $res.="auteur : ";
154
            $res.="\n                    ";
157
            $res.="\n                    ";
155
            $res.="</span>";
158
            $res.="</p>";
156
            $res.="\n                  ";
159
            $res.="\n                  ";
157
            $res.="</p>";
160
            $res.="</p>";
158
            $res.="\n                   ";
161
            $res.="\n                   ";
159
            $res.="</li>\n";
162
            $res.="</li>\n";
-
 
163
            $res.="<li class=\"ligne2\"><div class=\"separateur\">&nbsp;</div></li>\n";
160
            if ($num_ligne%$img_l==2)
164
            if ($num_ligne%$img_l==2)
161
            {
165
            {
162
                $res.="            </ul>  \n";
166
                $res.="            </ul>  \n";
-
 
167
                $res.="<li class=\"colonne\"><span class=\"spacer\"></span></li>";
163
            }
168
            }
164
            
169
            
165
            
170
            
166
            //g&eacute;n&eacute;ration d'un fichier rdf pour chaque resultat de la requete
171
            //g&eacute;n&eacute;ration d'un fichier rdf pour chaque resultat de la requete
167
            $fic=EFLORE_CHEMIN_RDF;
172
            $fic=EFLORE_CHEMIN_RDF;
168
            $fic .=$ligne[0];
173
            $fic .=$ligne[0];
169
            $fic .=".rdf";
174
            $fic .=".rdf";
170
            if(!file_exists($fic))
175
            if(!file_exists($fic))
171
            {
176
            {
172
                $fp=fopen($fic,"w+");
177
                $fp=fopen($fic,"w+");
173
                $text_rdf="";
178
                $text_rdf="";
174
                if(!$fp)
179
                if(!$fp)
175
                {
180
                {
176
                    $res.="erreur de cr&eacute;ation du fichier rdf";
181
                    $res.="erreur de cr&eacute;ation du fichier rdf";
177
                    exit;
182
                    exit;
178
                }
183
                }
179
            
184
            
180
                $text_rdf .=$en_tete;
185
                $text_rdf .=$en_tete;
181
            
186
            
182
                $text_rdf .="<rdf:Description  rdf:about=\"";
187
                $text_rdf .="<rdf:Description  rdf:about=\"";
183
                $url_img=$ligne[8];
188
                $url_img=$ligne[8];
184
                $url_img .=$ligne[1];
189
                $url_img .=$ligne[1];
185
                $text_rdf .=$url_img .$sep;
190
                $text_rdf .=$url_img .$sep;
186
            
191
            
187
                $text_rdf .="dc:identifier=\"";
192
                $text_rdf .="dc:identifier=\"";
188
                $text_rdf .=$ligne[0];
193
                $text_rdf .=$ligne[0];
189
                $text_rdf .=$sep;
194
                $text_rdf .=$sep;
190
            
195
            
191
                $text_rdf .="dc:title=\"";
196
                $text_rdf .="dc:title=\"";
192
                $text_rdf .=$ligne[1];
197
                $text_rdf .=$ligne[1];
193
                $text_rdf .=$sep;
198
                $text_rdf .=$sep;
194
            
199
            
195
                $text_rdf .="dc:creator=\"";
200
                $text_rdf .="dc:creator=\"";
196
                $text_rdf .=$ligne[2];
201
                $text_rdf .=$ligne[2];
197
                $text_rdf .=$sep;
202
                $text_rdf .=$sep;
198
            
203
            
199
                $text_rdf .="dc:type=\"";
204
                $text_rdf .="dc:type=\"";
200
                $text_rdf .=$ligne[3];
205
                $text_rdf .=$ligne[3];
201
                $text_rdf .=$sep;
206
                $text_rdf .=$sep;
202
            
207
            
203
                if(!(is_null($ligne[4])))
208
                if(!(is_null($ligne[4])))
204
                {
209
                {
205
            
210
            
206
                    $text_rdf .="dcterms:created=\"";
211
                    $text_rdf .="dcterms:created=\"";
207
                    $text_rdf .=$ligne[4];
212
                    $text_rdf .=$ligne[4];
208
                    $text_rdf .=$sep;
213
                    $text_rdf .=$sep;
209
                }
214
                }
210
            
215
            
211
                $text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
216
                $text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
212
            
217
            
213
                $i=fwrite($fp,$text_rdf);
218
                $i=fwrite($fp,$text_rdf);
214
                fclose($fp);
219
                fclose($fp);
215
            }
220
            }
216
        }
221
        }
217
        $res.="</ul>\n";
222
        $res.="</ul>\n";
218
        //affichage des liens suivant/précédent
223
        //affichage des liens suivant/précédent
219
        if ($deb!=0)
224
        if ($deb!=0)
220
        {
225
        {
221
            if (($deb-$img_pg-1)>=0)
226
            if (($deb-$img_pg-1)>=0)
222
            {
227
            {
223
                $prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($deb-$img_pg-1).">Pr&eacute;c&eacute;dent</a>";
228
                $prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($deb-$img_pg-1).">Pr&eacute;c&eacute;dent</a>";
224
                $res.="<div class=\"prec\">".$prec."</div>";
229
                $res.="<div class=\"prec\">".$prec."</div>";
225
            }
230
            }
226
            else
231
            else
227
            {
232
            {
228
                $prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=0>Pr&eacute;c&eacute;dent</a>";
233
                $prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=0>Pr&eacute;c&eacute;dent</a>";
229
            }
234
            }
230
            $res.="<div class=\"prec\">".$prec."</div>";
235
            $res.="<div class=\"prec\">".$prec."</div>";
231
        }
236
        }
232
    
237
    
233
        if ($deb+$img_pg<$nbre_ligne[0]) 
238
        if ($deb+$img_pg<$nbre_ligne[0]) 
234
        {
239
        {
235
            $suiv="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($fin+1).">Suivant</a>";
240
            $suiv="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($fin+1).">Suivant</a>";
236
            $res.="<div class=\"suiv\">".$suiv."</div>";
241
            $res.="<div class=\"suiv\">".$suiv."</div>";
237
        }
242
        }
238
    }
243
    }
239
 
244
 
240
}
245
}
241
 
246
 
242
?>
247
?>