Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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