Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 17 | 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
// +------------------------------------------------------------------------------------------------------+
59 jpm 22
// CVS : $Id: eflore_photo.inc.php,v 1.7 2004-12-23 20:05:17 jpm 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
59 jpm 35
*@version       $Revision: 1.7 $ $Date: 2004-12-23 20:05:17 $
3 linda 36
*/
37
 
5 linda 38
 
17 linda 39
$res='';
3 linda 40
 
5 linda 41
GEN_stockerStyleExterne('photo', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/photo.css');
17 linda 42
//connexion a la base
11 linda 43
 
17 linda 44
if (DB::isError($GLOBALS['db_eflore']))
3 linda 45
{
17 linda 46
    echo '<ERREUR>';
47
    echo 'Impossible d\'&eacutetablir de connexion '.$GLOBALS['db_eflore']->getMessage();
48
    echo '</ERREUR>';
49
    exit;
3 linda 50
}
17 linda 51
 
52
    //requete sql
59 jpm 53
    $req_img='select * from eflore_info_image, eflore_taxon_a_txt, eflore_inventaire_observation, eflore_licence, eflore_personne_contributeur';
17 linda 54
    $req=' where eii_id_image=eitat_id_taxon_ref ';
59 jpm 55
    $req.=' and eii_id_version_projet_img=etat_id_version_projet_taxon_ref ';
17 linda 56
    $req.=' and eio_ce_image=eii_id_image ';
57
    $req.=' and eii_id_version_projet_img=eio_ce_version_projet_img ';
58
    $req.=' and eii_ce_licence_img=eli_id_licence';
59
    $req.=' and eitat_id_texte='.N_TAXON;
60
    $req.=' and eitat_id_version_projet_txt='.N_VERSION_PROJET_TAXON;
61
    $req.=' and epc_id_contributeur=eii_ce_contributeur_image';
62
    if (isset($_GET['suppr'])){
63
        $req.=' and eii_ce_contributeur_image='.CONTRIBUTEUR;
64
    }
65
    $req_img.=$req;
66
    $resultat_img=$GLOBALS['db_eflore']->query($req_img);
67
    (DB::isError($resultat_img)) ?
68
           die (BOG_afficherErreurSql(__FILE__, __LINE__, 'img:'.$resultat_img->getMessage(), $req_img)) : '' ;
69
    $nbre_ligne=$resultat_img->numRows();
70
//-------------------------------------------PAGE AVEC LA PHOTO TAILLE REELLE-------------------------------------------------//
71
if (isset($_GET['agrandit'])){
72
    $req_img.=' and eii_id_image='.$_GET['id'];
73
    $resultat_img=$GLOBALS['db_eflore']->query($req_img);
74
    (DB::isError($resultat_img)) ?
75
           die (BOG_afficherErreurSql(__FILE__, __LINE__, 'img:'.$resultat_img->getMessage(), $req_img)) : '' ;
76
    $ligne=& $resultat_img->fetchRow(DB_FETCHMODE_ASSOC);
77
    $req_nom='select *';
78
    $req_nom.=' from eflore_selection_nom , eflore_nom ';
79
    $req_nom.=' LEFT JOIN eflore_botaniste_intitule_abreviation ON en_ce_auteur_basio= ebia_id_intitule_botaniste_abrege';
80
    $req_nom.=' where esn_id_taxon='.N_TAXON;
81
    $req_nom.=' and esn_id_version_projet_taxon='.N_VERSION_PROJET_TAXON;
82
    $req_nom.=' and esn_id_nom=en_id_nom';
83
    if ($ligne['eio_ce_autre_nom_latin']==0){
84
        $req_nom.=' and en_id_nom='.selectNom();
85
    }
86
    else {
87
        $req_nom.=' and en_id_nom='.$ligne['eio_ce_autre_nom_latin'];
88
    }
89
    $resultat_nom=$GLOBALS['db_eflore']->query($req_nom);
90
    (DB::isError($resultat_nom)) ?
91
           die (BOG_afficherErreurSql(__FILE__, __LINE__, 'cpt:'.$resultat_nom->getMessage(), $req_nom)) : '' ;
92
    $nom=& $resultat_nom->fetchRow(DB_FETCHMODE_ASSOC);
93
    $req_cat='select * from eflore_info_image_valeur, eflore_info_image_posseder_valeur';
94
    $req_cat.=' where  eiipv_id_valeur_categorie_img= eiiv_id_valeur_categorie_img ';
95
    $req_cat.=' and eiipv_id_image='.$_GET['id'];
96
    $resultat_cat=$GLOBALS['db_eflore']->query($req_cat);
97
    (DB::isError($resultat_cat)) ?
98
           die (BOG_afficherErreurSql(__FILE__, __LINE__, 'cpt:'.$resultat_cat->getMessage(), $req_cat)) : '' ;
99
    $res.='<div>';
100
    $res.='<p><a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.$_SESSION['dep'].'">Retour &agrave; la miniature</a></p>';
101
    $res.='<p>'.EN_ID_NOM.$nom['en_nom_genre'].' '.$nom['en_epithete_espece'].' '.$nom['ebia_intitule_botaniste_abrege'].'</p>';
102
    if ($ligne['eio_ce_autre_nom_latin']!=0){
103
        $res.='<p>'.EIO_AUTRE_FLORE.$ligne['eio_autre_flore'].'</p>';
104
    }
105
    $res.='<p>'.CONTRIBUTEUR_IMG.$ligne['epc_nom_principal'].'</p>';
106
    $res.='<p>'.EII_AUTEUR_IMG.$ligne['eii_auteur_img'].'</p>';
107
    if ($ligne['eio_autre_auteur_determination']!=NULL){
108
        $res.='<p>'.EIO_AUTRE_AUTEUR_DETERMINATION.$ligne['eio_autre_auteur_determination'].'</p>';
109
    }
110
 
111
    while($cat=& $resultat_cat->fetchRow(DB_FETCHMODE_ASSOC)){
112
        switch ($cat['eiiv_ce_categorie_img']) {
113
            case 1:
114
                $res.='<p>'.NATURE.$cat['eiiv_intitule_valeur_categorie_img'].'</p>';
115
                break;
116
            case 2:
117
                $res.='<p>'.DEVELOPPEMENT.$cat['eiiv_intitule_valeur_categorie_img'].'</p>';
118
                break;
119
            case 3:
120
                $res.='<p>'.SUJET.$cat['eiiv_intitule_valeur_categorie_img'].'</p>';
121
        }
122
    }
123
 
124
    $res.='<p>'.EIS_LIEUDIT.'</p>';
125
    $form_date=substr($ligne['eio_date_observation'],0,4);
126
    if (($mois=substr($ligne['eio_date_observation'],5,2))!='00'){
127
        $form_date=$mois.'/'.$form_date;
128
    }
129
    if (($jour=substr($ligne['eio_date_observation'],8,2))!='00'){
130
        $form_date=$jour.'/'.$form_date;
131
    }
132
    $res.='<p>'.DATE_IMG.$form_date.'</p>';
133
    $info='';
134
    if ($ligne['eii_description_courte_img']!=NULL){
135
        $info=$ligne['eii_description_courte_img'];
136
    }
137
    else {
138
        $info=$ligne['eii_description_longue_img'];
139
    }
140
    if ($ligne['eii_description_courte_img']!=NULL || $ligne['eii_description_longue_img']!=NULL){
141
        $res.='<p>Informations compl&eacute;mentaires : '.$info.'</p>';
142
    }
143
    $res.='<div class="debord"><img src="'.$_GET['agrandit'].'"></div></div>';
144
 
145
$res.=$ligne['eli_texte_licence'];
146
}
147
 
148
//-----------------------------------------PAGE AVEC L'AFFICHAGE DES MINIATURES------------------------------------------------//
5 linda 149
else
150
{
11 linda 151
    if (!isset($_GET['deb']))    {$deb=0;}
152
    else {$deb=$_GET['deb'];}
153
    $_SESSION['dep']=$deb;
154
    $img_pg=6;
155
    $img_l=3;
156
    $prec=null;
157
    $suiv=null;
3 linda 158
 
17 linda 159
    if (!isset($_GET['suppr'])){
160
    //affichage du lien vers le formulaire de soumission d'images
161
    $res.='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&soum=1">'.FORM_AJOUT.'</a>';
162
    if ($nbre_ligne==0){
163
        $res.='<p class="plein_texte">Il n\'y a aucune illustration de ce taxon disponible</p>';
3 linda 164
    }
17 linda 165
    $res.='<br /><a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&suppr=1">'.FORM_MODIF.'</a>';
11 linda 166
    }
17 linda 167
    else{
168
        $res.='<p><a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.$_SESSION['dep'].'">'.AFF_MINI.'</a></p>';
11 linda 169
    }
3 linda 170
 
11 linda 171
    //selection des lignes de la requete &agrave; traiter
3 linda 172
 
17 linda 173
    if (($deb+$img_pg+1)<=($nbre_ligne))
11 linda 174
    {
175
        $fin=$deb+$img_pg-1;
176
    }
177
    else
178
    {
17 linda 179
        $fin=$nbre_ligne-1;
11 linda 180
    }
3 linda 181
 
11 linda 182
    //affichage des miniatures et g&eacute;n&eacute;ration des fichiers rdf
183
    if ($fin!==0)
184
    {
17 linda 185
        $res.='            <ul class="liste_photo">'."\n";
186
        $i=0;
11 linda 187
        foreach (range($deb, $fin) as $num_ligne)
188
        {
17 linda 189
            if (!$ligne =& $resultat_img->fetchrow(DB_FETCHMODE_ASSOC, $num_ligne))
11 linda 190
            {
191
                break;
192
            }
193
            if ($num_ligne%$img_l==0)
194
            {
17 linda 195
                $res.='              ';
196
                $res.='<li class="colonne">';
11 linda 197
                $res.="\n              ";
17 linda 198
                $res.='<ul>'."\n";
11 linda 199
            }
17 linda 200
            $i++;
201
            $url_img=$ligne['eii_lien_vers_img'];
202
            $url_img_mini=EFLORE_CHEMIN_IMG_PLTE.'mini_photos_plte/mini_';
203
            $url_img_mini .=$ligne['eii_id_image'].'.jpg';
204
            if ($ligne['eii_lien_vers_img']!=EFLORE_CHEMIN_IMG_PLTE){
205
                $url_img .=$ligne['eii_nom_fichier_img'];
11 linda 206
            }
17 linda 207
            else{
208
                $url_img .=$ligne['eii_id_image'].'.jpg';
209
            }
210
            $res.='                ';
211
            $res.='<li class="ligne">'."\n";
212
            $res.='                  ';
213
            $res.='<p class="info">';
214
            if (!@fopen($url_img,'r')){
215
                $res.="\n                    ";
216
                $res.='<img src="'.$url_img_mini.'" alt="'.$ligne['eii_description_courte_img'].' date:'.$ligne['eio_date_observation'].'" border=0 />';
217
                $res.="\n                  ";
218
                $res.='</a>';
219
                $res.="\n                  ";
220
                $res.="\n                  ";
221
                $res.='</p>';
222
                $res.="\n                  ";
223
                $res.="\n                    ";
224
                $res.='<p class="label">';
225
                $res.="\n                      ";
226
                $res.=DEFAUT_IMG.'<br />';
227
                $res.="\n                      ";
228
                $res.=AUTEUR.$ligne['eii_auteur_img'];
229
                $res.="\n                    ";
230
                $res.='</p>';
231
                $res.="\n                   ";
232
                $res.='</li>'."\n";
233
            }
234
            else{
235
                if (!isset($_GET['suppr'])){
236
                    $res.='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&agrandit='.$url_img.'&id='.$ligne['eii_id_image'].'">';
11 linda 237
                }
17 linda 238
                else{
239
                    $res.='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&modif=1&id='.$ligne['eii_id_image'].'">';
11 linda 240
                }
17 linda 241
                $res.="\n                    ";
242
                $res.='<img src="'.$url_img_mini.'" alt="'.$ligne['eii_description_courte_img'].DATE_IMG.$ligne['eio_date_observation'].'" border=0 />';
243
                $res.="\n                  ";
244
                $res.='</a>';
245
                $res.="\n                  ";
246
                $res.="\n                  ";
247
                $res.='</p>';
248
                $res.="\n                  ";
249
                $res.="\n                    ";
250
                $res.='<p class="label">';
251
                $res.="\n                      ";
252
                $res.=POIDS.$ligne['eii_poids_img'].' ko<br />';
253
                $res.="\n                    ";
254
                $res.=TAILLE.$ligne['eii_larg_img'].'x'.$ligne['eii_long_img'].' px<br />';
255
                $res.="\n                      ";
256
                $res.=AUTEUR.$ligne['eii_auteur_img'];
257
                $res.="\n                    ";
258
                $res.='</p>';
259
                $res.="\n                   ";
260
                $res.='</li>'."\n";
261
            }
262
            if ($num_ligne%$img_l==($img_l-1))
263
            {
264
                $res.="            </ul></li>  \n";
265
                $res.='<li class="colonne"><span class="spacer"></span></li>';
266
            }
11 linda 267
 
17 linda 268
            if (!isset($_GET['suppr'])){
269
                generationRdf($ligne);
11 linda 270
            }
271
        }
17 linda 272
        $res.='<li class="colonne"><span class="spacer"></span></li>';
11 linda 273
        $res.="</ul>\n";
274
        //affichage des liens suivant/précédent
275
        if ($deb!=0)
276
        {
17 linda 277
            if (($deb-$img_pg)>=0)
11 linda 278
            {
17 linda 279
                if (!isset($_GET['suppr'])){
280
                    $prec='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.($deb-$img_pg).'">'.PREC.'</a>';
281
                }
282
                else{
283
                    $prec='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.($deb-$img_pg).'&suppr=1">'.PREC.'</a>';
284
                }
11 linda 285
            }
286
            else
287
            {
17 linda 288
                if (!isset($_GET['suppr'])){
289
                    $prec='<a href="'.EFLORE_CHEMIN_APPLI.'"&onglet=photo&deb=0">'.PREC.'</a>';
290
                }
291
                else{
292
                    $prec='<a href="'.EFLORE_CHEMIN_APPLI.'"&onglet=photo&deb=0&suppr=1">'.PREC.'</a>';
293
                }
11 linda 294
            }
17 linda 295
            $res.='<div class="prec">'.$prec.'</div>';
11 linda 296
        }
297
 
17 linda 298
        if ($deb+$img_pg<$nbre_ligne)
11 linda 299
        {
17 linda 300
            if (!isset($_GET['suppr'])){
301
                $suiv='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.($fin+1).'">'.SUIV.'</a>';
302
            }
303
            else{
304
                $suiv='<a href="'.EFLORE_CHEMIN_APPLI.'&onglet=photo&deb='.($fin+1).'&suppr=1">'.SUIV.'</a>';
305
            }
306
            $res.='<div class="suiv">'.$suiv.'</div>';
11 linda 307
        }
308
    }
3 linda 309
 
310
}
59 jpm 311
?>