Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 5 | Rev 12 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 11
Line 17... Line 17...
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.2 2004-06-17 15:19:26 linda Exp $
22
// CVS : $Id: eflore_photo.inc.php,v 1.3 2004-06-22 12:28:01 linda Exp $
23
/**
23
/**
24
* Titre
24
* Titre
25
*
25
*
26
* Description
26
* Description
27
*
27
*
Line 30... Line 30...
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.2 $ $Date: 2004-06-17 15:19:26 $
35
*@version       $Revision: 1.3 $ $Date: 2004-06-22 12:28:01 $
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
Line 38... Line 38...
38
 
38
 
39
$res="";
-
 
40
 
-
 
-
 
39
$res="";
41
GEN_stockerStyleExterne('photo', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/photo.css');
40
 
42
$deb=$_GET['deb'];
41
GEN_stockerStyleExterne('photo', GEN_CHEMIN_CLIENT.'eflore/presentations/styles/photo.css');
43
$agrandit=$_GET['agrandit'];
42
 
44
if (isset($agrandit))
43
if (isset($_GET['agrandit']))
45
{
44
{
46
$res.="<div align=\"center\">";
45
$res.="<div>";
47
$res.="<p><a href=\"eflore_photo.inc.php?".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>";
48
$res.="<img src=\"".$agrandit."\"></div>";
47
$res.="<div class=\"debord\"><img src=\"".$_GET['agrandit']."\"></div></div>";
49
unset($agrandit);
48
//unset($agrandit);
50
}
49
}
-
 
50
else
51
else
51
{
52
{
-
 
53
if (!isset($deb)){$deb=0;}
52
    if (!isset($_GET['deb']))    {$deb=0;}
54
$_SESSION['dep']=$deb;
53
    else {$deb=$_GET['deb'];}
-
 
54
    $_SESSION['dep']=$deb;
55
$path_rdf="/home/linda/Documents/testphp/rdf/";
55
    $sep="\"\n";
56
$sep="\"\n";
56
    $img_pg=6;
57
$img_pg=6;
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"; 
-
 
69
 
-
 
-
 
68
    $en_tete .=">"."\n\n"; 
70
//connexion a la base
69
 
71
$dsn="mysql://root:0000@localhost/test";
70
    //connexion a la base
72
$db=DB::connect($dsn);
71
 
73
 if (DB::isError($db))
72
    if (DB::isError($GLOBALS['db_eflore']))
74
  {
73
    {
75
        echo "<ERREUR>";
74
        echo "<ERREUR>";
76
        echo "Impossible d'&eacutetablir de connexion ",$db->getMessage();
75
        echo "Impossible d'&eacutetablir de connexion ",$GLOBALS['db_eflore']->getMessage();
Line 77... Line 76...
77
        echo "</ERREUR>";
76
        echo "</ERREUR>";
78
        exit;
77
        exit;
-
 
78
    }
79
    }
79
 
80
 
80
 
81
 
81
    //requete sql 
82
//requete sql 
82
    $req="select * from images";
83
$req="select * from images";
83
    $cond="";
84
$cond="where identifier<=7";
84
//    $cond="where identifier<=7";
85
$requete="select count('identifier') from images ";
-
 
86
if(!$cond=="")
85
    $requete="select count('identifier') from images ";
87
{
86
    if(!$cond=="")
88
	$resultat=$db->query($req." ".$cond);
87
    {
89
	$cpt=$db->query("select count('identifier') from images ".$cond);
88
        $resultat=$GLOBALS['db_eflore']->query($req." ".$cond);
90
    echo $requete.$cond;
89
        $cpt=$GLOBALS['db_eflore']->query("select count('identifier') from images ".$cond);
91
	$nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
90
        $nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
92
	print("nombre de lignes r&eacutesultat de la requ&ecircte : ".$nbre_ligne[0]."<br>");
91
        //print("nombre de lignes r&eacute;sultat de la requ&ecirc;te : ".$nbre_ligne[0]."<br>");
93
}
92
    }
94
else
93
    else
95
{
-
 
96
	$resultat=$db->query($req);
-
 
Line 97... Line 94...
97
	$cpt=$db->query("select count('identifier') from images ");
94
    {
98
	$nbre_ligne=$cpt->fetchRow(DB_FETCHMODE_ORDERED);
-
 
99
}
-
 
100
 
-
 
101
//selection des lignes de la requete &agrave traiter
-
 
102
 
-
 
103
if (($deb+$img_pg+1)<=($nbre_ligne[0])) 
-
 
104
{
-
 
Line -... Line 95...
-
 
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
    }
-
 
99
 
-
 
100
    //selection des lignes de la requete &agrave; traiter
-
 
101
 
-
 
102
    if (($deb+$img_pg+1)<=($nbre_ligne[0])) 
Line 105... Line -...
105
	$fin=$deb+$img_pg-1;
-
 
106
}
-
 
107
else 
-
 
108
{
-
 
109
	$fin=$nbre_ligne[0]-1;
-
 
110
}
-
 
111
 
-
 
112
 
-
 
113
 
-
 
114
//affichage des miniatures et g&eacuten&eacuteration des fichiers rdf
-
 
115
if ($fin!==0)
-
 
116
{
-
 
117
	foreach (range($deb, $fin) as $num_ligne) 
-
 
118
	{
-
 
119
		if (!$ligne = $resultat->fetchrow(DB_FETCHMODE_ORDERED, $num_ligne)) 
-
 
120
		{
-
 
121
			break;
-
 
122
		}
-
 
123
		$url_img=$ligne[8];
-
 
124
		$url_img_mini=$url_img."mini_photos/mini_";
-
 
125
		$url_img_mini .=$ligne[1];
-
 
126
		$url_img .=$ligne[1];
-
 
127
		$res.="<div class=\"float\">";
-
 
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."\">";
-
 
130
		$res.="</map>";
-
 
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>";
-
 
133
		
-
 
134
/*		//g&eacuten&eacuteration d'un fichier rdf pour chaque resultat de la requete
-
 
135
		$fic=$path_rdf;
-
 
136
		$fic .=$ligne[0];
-
 
137
		$fic .=".rdf";
-
 
138
		if(!file_exists($fic))
-
 
139
		{
-
 
140
			$fp=fopen($fic,"w+");
-
 
141
			$text_rdf="";
-
 
142
			if(!$fp)
-
 
143
			{
-
 
144
				$res.="erreur de cr&eacuteation du fichier rdf";
-
 
145
				exit;
-
 
146
			}
-
 
147
			
-
 
148
			$text_rdf .=$en_tete;
-
 
149
			
-
 
150
			$text_rdf .="<rdf:Description  rdf:about=\"";
-
 
151
			$url_img=$ligne[8];
-
 
152
			$url_img .=$ligne[1];
-
 
153
			$text_rdf .=$url_img .$sep;
-
 
154
			
-
 
155
			$text_rdf .="dc:identifier=\"";
-
 
156
			$text_rdf .=$ligne[0];
-
 
157
			$text_rdf .=$sep;
-
 
158
			
-
 
159
			$text_rdf .="dc:title=\"";
-
 
160
			$text_rdf .=$ligne[1];
-
 
161
			$text_rdf .=$sep;
-
 
162
			
-
 
163
			$text_rdf .="dc:creator=\"";
-
 
164
			$text_rdf .=$ligne[2];
-
 
165
			$text_rdf .=$sep;
-
 
166
			
-
 
167
			$text_rdf .="dc:type=\"";
-
 
168
			$text_rdf .=$ligne[3];
-
 
169
			$text_rdf .=$sep;
-
 
170
			
-
 
171
			if(!(is_null($ligne[4])))
-
 
172
			{
-
 
173
				$text_rdf .="dcterms:created=\"";
-
 
174
				$text_rdf .=$ligne[4];
-
 
175
				$text_rdf .=$sep;
-
 
176
			}
-
 
177
			
-
 
178
			$text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
-
 
179
			
-
 
180
			$i=fwrite($fp,$text_rdf);
-
 
181
			fclose($fp);
-
 
182
		}*/
-
 
183
	}
-
 
184
	if ($deb!=0)
-
 
185
	{
-
 
186
		if (($deb-$img_pg-1)>=0)
-
 
187
		{
-
 
188
			$prec="<a href=eflore_photo.inc.php?deb=".($deb-$img_pg-1).">Pr&eacutec&eacutedent</a>";
-
 
189
			$res.="<div class=\"prec\">".$prec."</div>";
-
 
190
		}
-
 
191
		else
-
 
192
		{
-
 
193
			$prec="<a href=eflore_photo.inc.php?deb=0>Pr&eacutec&eacutedent</a>";
-
 
Line -... Line 103...
-
 
103
    {
-
 
104
        $fin=$deb+$img_pg-1;
-
 
105
    }
-
 
106
    else 
-
 
107
    {
-
 
108
        $fin=$nbre_ligne[0]-1;
-
 
109
    }
-
 
110
 
-
 
111
 
-
 
112
 
-
 
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.="                  ";
-
 
137
            $res.="<a href=\"papyrus.php?site=3&menu=39&onglet=photo&agrandit=".$url_img."\">";
-
 
138
            $res.="\n                    ";
-
 
139
            $res.="<img src=\"".$url_img_mini."\" border=0 />";
-
 
140
            $res.="\n                  ";
-
 
141
            $res.="</a>";
-
 
142
            $res.="\n                  ";
-
 
143
            $res.="<p class=\"info\">";
-
 
144
            $res.="\n                    ";
-
 
145
            $res.="<span class=\"label\">";
-
 
146
            $res.="\n                      ";
-
 
147
            $res.="num_ligne : ".$num_ligne;
-
 
148
            $res.="\n                    ";
-
 
149
            $res.="</span>";
-
 
150
            $res.="\n                    ";
-
 
151
            $res.="<span class=\"label\">";
-
 
152
            $res.="\n                      ";
-
 
153
            $res.="id: ".$ligne[0]."->".$ligne[1];
-
 
154
            $res.="\n                    ";
-
 
155
            $res.="</span>";
-
 
156
            $res.="\n                  ";
-
 
157
            $res.="</p>";
-
 
158
            $res.="\n                   ";
-
 
159
            $res.="</li>\n";
-
 
160
            if ($num_ligne%$img_l==2)
-
 
161
            {
-
 
162
                $res.="            </ul><div style=\"clear:both;\">&nbsp;</div>\n  \n";
-
 
163
            }
-
 
164
            
-
 
165
            
-
 
166
            //g&eacute;n&eacute;ration d'un fichier rdf pour chaque resultat de la requete
-
 
167
            $fic=EFLORE_CHEMIN_RDF;
-
 
168
            $fic .=$ligne[0];
-
 
169
            $fic .=".rdf";
-
 
170
            if(!file_exists($fic))
-
 
171
            {
-
 
172
                $fp=fopen($fic,"w+");
-
 
173
                $text_rdf="";
-
 
174
                if(!$fp)
-
 
175
                {
-
 
176
                    $res.="erreur de cr&eacute;ation du fichier rdf";
-
 
177
                    exit;
-
 
178
                }
-
 
179
            
-
 
180
                $text_rdf .=$en_tete;
-
 
181
            
-
 
182
                $text_rdf .="<rdf:Description  rdf:about=\"";
-
 
183
                $url_img=$ligne[8];
-
 
184
                $url_img .=$ligne[1];
-
 
185
                $text_rdf .=$url_img .$sep;
-
 
186
            
-
 
187
                $text_rdf .="dc:identifier=\"";
-
 
188
                $text_rdf .=$ligne[0];
-
 
189
                $text_rdf .=$sep;
-
 
190
            
-
 
191
                $text_rdf .="dc:title=\"";
-
 
192
                $text_rdf .=$ligne[1];
-
 
193
                $text_rdf .=$sep;
-
 
194
            
-
 
195
                $text_rdf .="dc:creator=\"";
-
 
196
                $text_rdf .=$ligne[2];
-
 
197
                $text_rdf .=$sep;
-
 
198
            
-
 
199
                $text_rdf .="dc:type=\"";
-
 
200
                $text_rdf .=$ligne[3];
-
 
201
                $text_rdf .=$sep;
-
 
202
            
-
 
203
                if(!(is_null($ligne[4])))
-
 
204
                {
-
 
205
            
-
 
206
                    $text_rdf .="dcterms:created=\"";
-
 
207
                    $text_rdf .=$ligne[4];
-
 
208
                    $text_rdf .=$sep;
-
 
209
                }
-
 
210
            
-
 
211
                $text_rdf .=">\n</rdf:Description>\n</rdf:RDF>\n";
-
 
212
            
-
 
213
                $i=fwrite($fp,$text_rdf);
-
 
214
                fclose($fp);
-
 
215
            }
-
 
216
        }
-
 
217
        $res.="</ul>\n";
-
 
218
        //affichage des liens suivant/précédent
-
 
219
        if ($deb!=0)
-
 
220
        {
-
 
221
            if (($deb-$img_pg-1)>=0)
194
		}
222
            {
-
 
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>";
-
 
225
            }
-
 
226
            else
-
 
227
            {
-
 
228
                $prec="<a href=papyrus.php?site=3&menu=39&onglet=photo&deb=0>Pr&eacute;c&eacute;dent</a>";
Line 195... Line -...
195
		$res.="<div class=\"prec\">".$prec."</div>";
-
 
196
	}
229
            }
197
	
-
 
Line 198... Line 230...
198
	if ($deb+$img_pg<$nbre_ligne[0]) 
230
            $res.="<div class=\"prec\">".$prec."</div>";
199
	{
-
 
200
		$suiv="<a href=eflore_photo.inc.php?deb=".($fin+1).">Suivant</a>";
-
 
201
		$res.="<div class=\"suiv\">".$suiv."</div>";
231
        }