Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev 11 Rev 12
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.3 2004-06-22 12:28:01 linda Exp $
22
// CVS : $Id: eflore_photo.inc.php,v 1.4 2004-06-23 13:21:23 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.3 $ $Date: 2004-06-22 12:28:01 $
35
*@version       $Revision: 1.4 $ $Date: 2004-06-23 13:21:23 $
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.="<a href=\"papyrus.php?site=3&menu=39&onglet=photo&agrandit=".$url_img."\">";
137
            $res.="<a href=\"papyrus.php?site=3&menu=39&onglet=photo&agrandit=".$url_img."\">";
138
            $res.="\n                    ";
138
            $res.="\n                    ";
139
            $res.="<img src=\"".$url_img_mini."\" border=0 />";
139
            $res.="<img src=\"".$url_img_mini."\" border=0 />";
140
            $res.="\n                  ";
140
            $res.="\n                  ";
141
            $res.="</a>";
141
            $res.="</a>";
142
            $res.="\n                  ";
142
            $res.="\n                  ";
143
            $res.="<p class=\"info\">";
143
            $res.="<p class=\"info\">";
144
            $res.="\n                    ";
144
            $res.="\n                    ";
145
            $res.="<span class=\"label\">";
145
            $res.="<span class=\"label\">";
146
            $res.="\n                      ";
146
            $res.="\n                      ";
147
            $res.="num_ligne : ".$num_ligne;
147
            $res.="num_ligne : ".$num_ligne;
148
            $res.="\n                    ";
148
            $res.="\n                    ";
149
            $res.="</span>";
149
            $res.="</span>";
150
            $res.="\n                    ";
150
            $res.="\n                    ";
151
            $res.="<span class=\"label\">";
151
            $res.="<span class=\"label\">";
152
            $res.="\n                      ";
152
            $res.="\n                      ";
153
            $res.="id: ".$ligne[0]."->".$ligne[1];
153
            $res.="id: ".$ligne[0]."->".$ligne[1];
154
            $res.="\n                    ";
154
            $res.="\n                    ";
155
            $res.="</span>";
155
            $res.="</span>";
156
            $res.="\n                  ";
156
            $res.="\n                  ";
157
            $res.="</p>";
157
            $res.="</p>";
158
            $res.="\n                   ";
158
            $res.="\n                   ";
159
            $res.="</li>\n";
159
            $res.="</li>\n";
160
            if ($num_ligne%$img_l==2)
160
            if ($num_ligne%$img_l==2)
161
            {
161
            {
162
                $res.="            </ul><div style=\"clear:both;\">&nbsp;</div>\n  \n";
162
                $res.="            </ul>  \n";
163
            }
163
            }
164
            
164
            
165
            
165
            
166
            //g&eacute;n&eacute;ration d'un fichier rdf pour chaque resultat de la requete
166
            //g&eacute;n&eacute;ration d'un fichier rdf pour chaque resultat de la requete
167
            $fic=EFLORE_CHEMIN_RDF;
167
            $fic=EFLORE_CHEMIN_RDF;
168
            $fic .=$ligne[0];
168
            $fic .=$ligne[0];
169
            $fic .=".rdf";
169
            $fic .=".rdf";
170
            if(!file_exists($fic))
170
            if(!file_exists($fic))
171
            {
171
            {
172
                $fp=fopen($fic,"w+");
172
                $fp=fopen($fic,"w+");
173
                $text_rdf="";
173
                $text_rdf="";
174
                if(!$fp)
174
                if(!$fp)
175
                {
175
                {
176
                    $res.="erreur de cr&eacute;ation du fichier rdf";
176
                    $res.="erreur de cr&eacute;ation du fichier rdf";
177
                    exit;
177
                    exit;
178
                }
178
                }
179
            
179
            
180
                $text_rdf .=$en_tete;
180
                $text_rdf .=$en_tete;
181
            
181
            
182
                $text_rdf .="<rdf:Description  rdf:about=\"";
182
                $text_rdf .="<rdf:Description  rdf:about=\"";
183
                $url_img=$ligne[8];
183
                $url_img=$ligne[8];
184
                $url_img .=$ligne[1];
184
                $url_img .=$ligne[1];
185
                $text_rdf .=$url_img .$sep;
185
                $text_rdf .=$url_img .$sep;
186
            
186
            
187
                $text_rdf .="dc:identifier=\"";
187
                $text_rdf .="dc:identifier=\"";
188
                $text_rdf .=$ligne[0];
188
                $text_rdf .=$ligne[0];
189
                $text_rdf .=$sep;
189
                $text_rdf .=$sep;
190
            
190
            
191
                $text_rdf .="dc:title=\"";
191
                $text_rdf .="dc:title=\"";
192
                $text_rdf .=$ligne[1];
192
                $text_rdf .=$ligne[1];
193
                $text_rdf .=$sep;
193
                $text_rdf .=$sep;
194
            
194
            
195
                $text_rdf .="dc:creator=\"";
195
                $text_rdf .="dc:creator=\"";
196
                $text_rdf .=$ligne[2];
196
                $text_rdf .=$ligne[2];
197
                $text_rdf .=$sep;
197
                $text_rdf .=$sep;
198
            
198
            
199
                $text_rdf .="dc:type=\"";
199
                $text_rdf .="dc:type=\"";
200
                $text_rdf .=$ligne[3];
200
                $text_rdf .=$ligne[3];
201
                $text_rdf .=$sep;
201
                $text_rdf .=$sep;
202
            
202
            
203
                if(!(is_null($ligne[4])))
203
                if(!(is_null($ligne[4])))
204
                {
204
                {
205
            
205
            
206
                    $text_rdf .="dcterms:created=\"";
206
                    $text_rdf .="dcterms:created=\"";
207
                    $text_rdf .=$ligne[4];
207
                    $text_rdf .=$ligne[4];
208
                    $text_rdf .=$sep;
208
                    $text_rdf .=$sep;
209
                }
209
                }
210
            
210
            
211
                $text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
211
                $text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
212
            
212
            
213
                $i=fwrite($fp,$text_rdf);
213
                $i=fwrite($fp,$text_rdf);
214
                fclose($fp);
214
                fclose($fp);
215
            }
215
            }
216
        }
216
        }
217
        $res.="</ul>\n";
217
        $res.="</ul>\n";
218
        //affichage des liens suivant/précédent
218
        //affichage des liens suivant/précédent
219
        if ($deb!=0)
219
        if ($deb!=0)
220
        {
220
        {
221
            if (($deb-$img_pg-1)>=0)
221
            if (($deb-$img_pg-1)>=0)
222
            {
222
            {
223
                $prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($deb-$img_pg-1).">Pr&eacute;c&eacute;dent</a>";
223
                $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>";
224
                $res.="<div class=\"prec\">".$prec."</div>";
225
            }
225
            }
226
            else
226
            else
227
            {
227
            {
228
                $prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=0>Pr&eacute;c&eacute;dent</a>";
228
                $prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=0>Pr&eacute;c&eacute;dent</a>";
229
            }
229
            }
230
            $res.="<div class=\"prec\">".$prec."</div>";
230
            $res.="<div class=\"prec\">".$prec."</div>";
231
        }
231
        }
232
    
232
    
233
        if ($deb+$img_pg<$nbre_ligne[0]) 
233
        if ($deb+$img_pg<$nbre_ligne[0]) 
234
        {
234
        {
235
            $suiv="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($fin+1).">Suivant</a>";
235
            $suiv="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=".($fin+1).">Suivant</a>";
236
            $res.="<div class=\"suiv\">".$suiv."</div>";
236
            $res.="<div class=\"suiv\">".$suiv."</div>";
237
        }
237
        }
238
    }
238
    }
239
 
239
 
240
}
240
}
241
 
241
 
242
?>
242
?>