223 lines
8.4 KiB
PHP
223 lines
8.4 KiB
PHP
<?php
|
|
/*
|
|
*********************************************************************
|
|
* File : $RCSfile: album.php,v $
|
|
* Version : $Revision: 1.3 $
|
|
* Modified by : $Author: jb $ ($Date: 2003/06/28 22:20:19 $)
|
|
*********************************************************************
|
|
Classe Cadre
|
|
V 0.01 : NADAL Jean-Baptiste : 02 03 2001
|
|
V 0.22 Rejout des touches de navigations entre les images
|
|
Description : Cette classe permet de gérer l'album photo de l'Harmonie
|
|
*/
|
|
|
|
class Album {
|
|
// =====================================================
|
|
// Les Variables
|
|
var $szCheminAlbum; // chemin de l'album
|
|
var $szDateAlbum; // Date de l'album
|
|
var $szTitreAlbum; // Titre de l'album
|
|
var $nbImgCol;
|
|
|
|
// =============================================================
|
|
// Constructeur de la classe
|
|
function Album($chemin)
|
|
{
|
|
$this->szCheminAlbum = $chemin;
|
|
$this->nbImgCol = 2;
|
|
} // fin du constructeur
|
|
|
|
// =============================================================
|
|
function getDate() { return $this->szDateAlbum; }
|
|
function getTitre() { return $this->szTitreAlbum; }
|
|
function AffichePresentation()
|
|
{
|
|
global $page_index, $racine;
|
|
echo "
|
|
<br>
|
|
<center>
|
|
<table border=0>
|
|
<tr>
|
|
<td>
|
|
<a href=\"$page_index?page=album_photo&palb=racine\">
|
|
<img src=\"$racine/Imgs/album_photo.jpg\" alt=\"Entrer dans l'album photo\" border=0>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br><b>Clicker sur l'image pour entrer dans l'album</b>
|
|
</center>";
|
|
}
|
|
|
|
function ScanAllAbum($Rep)
|
|
{
|
|
$indice=0;
|
|
$fichier ="$this->szCheminAlbum/$Rep/index.neodoc";
|
|
$pFichier = fopen($fichier,"r");
|
|
if ($pFichier == false)
|
|
return 1;
|
|
|
|
while ( feof($pFichier) != 1 )
|
|
{
|
|
$szLigne = fgets($pFichier,120);
|
|
if ($indice ==0)
|
|
$this->szTitreAlbum = $szLigne;
|
|
else if ( $indice ==1)
|
|
$this->szDateAlbum = $szLigne;
|
|
$indice++;
|
|
}
|
|
fclose ($pFichier);
|
|
}
|
|
|
|
function AfficheAbum ($Rep)
|
|
{
|
|
global $page_index, $racine;
|
|
$indice = 0;
|
|
$array = array();
|
|
$i = 0;
|
|
|
|
if ($Rep == "racine")
|
|
$monRepertoire = opendir($this->szCheminAlbum);
|
|
else {
|
|
$chemin = "$this->szCheminAlbum/$Rep/normal";
|
|
$monRepertoire = opendir($chemin);
|
|
}
|
|
|
|
echo "<br><center><table border=2 width=\"95%\"><tr>\n";
|
|
while ($entryName = readdir ($monRepertoire)) {
|
|
|
|
if (($entryName != ".") && ($entryName != ".."))
|
|
$array[$i++] = $entryName;
|
|
}
|
|
closedir($monRepertoire);
|
|
|
|
/* Sort the file in lexicographic mode. */
|
|
natcasesort ($array);
|
|
$array = array_values($array);
|
|
|
|
$total = sizeof($array);
|
|
|
|
for ($i = 0; $i < $total; $i++) {
|
|
echo " <td width=\"50%\" valign=center>";
|
|
if ($Rep == "racine")
|
|
$fichier ="\"$this->szCheminAlbum/$array[$i]/mini/01.jpg\"";
|
|
else
|
|
$fichier ="\"$this->szCheminAlbum/$Rep/mini/$array[$i]\"";
|
|
echo "<center>\n";
|
|
if ($Rep == "racine")
|
|
echo "<a href=\"$page_index?page=album_photo&palb=$array[$i]\" >\n";
|
|
else
|
|
echo "<a href=\"$page_index?page=album_photo&palb=$Rep&img=$array[$i]\" >\n";
|
|
echo "<img src=$fichier alt=$array[$i] border=0></a><br>\n";
|
|
if ($Rep == "racine")
|
|
$this->AfficheCommentaire ($array[$i]);
|
|
|
|
echo "<br></td>\n";
|
|
if ( $indice % $this->nbImgCol )
|
|
echo "</tr><tr>\n";
|
|
$indice++;
|
|
}
|
|
|
|
echo "</tr></table><br><b>Clicker sur l'image pour voir la collection</b><br><br>\n";
|
|
if ($Rep != "racine")
|
|
{
|
|
$monRepertoire = opendir($this->szCheminAlbum);
|
|
$precedent ="";
|
|
$suivant = "";
|
|
$bTrouve =false;
|
|
while($entryName = readdir($monRepertoire))
|
|
{
|
|
if ( ($entryName !=".") && ($entryName !="..") )
|
|
{
|
|
if ( $bTrouve == true) {
|
|
$suivant = $entryName;
|
|
break; }
|
|
if ( $entryName == $Rep )
|
|
$bTrouve = true;
|
|
if ( $bTrouve == false)
|
|
$precedent =$entryName;
|
|
} // fin if
|
|
} // fin while
|
|
echo "<table border=1><tr>\n";
|
|
if ( $precedent =="")
|
|
echo "<td><a href=$page_index?page=album_photo&palb=racine >\n";
|
|
else
|
|
echo "<td><a href=$page_index?page=album_photo&palb=$precedent>\n";
|
|
echo "<img src=$racine/Imgs/back.gif alt=back border=0></a></td>\n";
|
|
echo "<td><a href=$page_index?page=album_photo&palb=racine >\n";
|
|
echo "<img src=$racine/Imgs/home.gif alt=home border=0></a></td>\n";
|
|
if ( $suivant =="")
|
|
echo "<td><a href=$page_index?page=album_photo&palb=racine >\n";
|
|
else
|
|
echo "<td><a href=$page_index?page=album_photo&palb=$suivant>\n";
|
|
echo "<img src=$racine/Imgs/forward.gif alt=suivant border=0></a></td>\n";
|
|
echo "</tr></table>\n";
|
|
} //fin if ($Rep != "racine")
|
|
echo "</center> \n";
|
|
} // fin ScanAllAbum()
|
|
|
|
function AfficheImage($Rep,$NumImg)
|
|
{
|
|
global $page_index, $racine;
|
|
|
|
$fichier ="\"$this->szCheminAlbum/$Rep/normal/$NumImg\"";
|
|
echo "<img src=$fichier alt=$NumImg>\n";
|
|
$chemin = "$this->szCheminAlbum/$Rep/normal";
|
|
$monRepertoire = opendir( $chemin );
|
|
$precedent ="";
|
|
$suivant = "";
|
|
$bTrouve =false;
|
|
while($entryName = readdir($monRepertoire))
|
|
{
|
|
if ( ($entryName !=".") && ($entryName !="..") )
|
|
{
|
|
if ( $bTrouve == true) {
|
|
$suivant = $entryName;
|
|
break; }
|
|
if ( $entryName == $NumImg )
|
|
$bTrouve = true;
|
|
|
|
if ( $bTrouve == false)
|
|
$precedent =$entryName;
|
|
} // fin if
|
|
} // fin while
|
|
|
|
echo "<br><br><center><table border=1><tr>\n";
|
|
if ( $precedent =="")
|
|
echo "<td><a href=$page_index?page=album_photo&palb=$Rep>\n";
|
|
else
|
|
echo "<td><a href=$page_index?page=album_photo&palb=$Rep&img=$precedent >\n";
|
|
echo "<img src=$racine/Imgs/back.gif alt=back border=0></a></td>\n";
|
|
echo "<td><a href=$page_index?page=album_photo&palb=$Rep>\n";
|
|
echo "<img src=$racine/Imgs/home.gif alt=home border=0></a></td>\n";
|
|
if ( $suivant=="")
|
|
echo "<td><a href=$page_index?page=album_photo&palb=$Rep>\n";
|
|
else
|
|
echo "<td><a href=$page_index?page=album_photo&palb=$Rep&img=$suivant >\n";
|
|
echo "<img src=$racine/Imgs/forward.gif alt=suivant border=0></a></td>\n";
|
|
echo "</tr></table></center>\n";
|
|
}
|
|
|
|
function AfficheCommentaire($nomRep)
|
|
{
|
|
global $racine;
|
|
$commentaire="";
|
|
$fichier ="$this->szCheminAlbum/$nomRep/index.neodoc";
|
|
$pFichier = fopen($fichier,"r");
|
|
if ($pFichier == false)
|
|
return 1;
|
|
|
|
while ( feof($pFichier) != 1 )
|
|
{
|
|
$szLigne = fgets($pFichier,120);
|
|
$commentaire.=$szLigne;
|
|
}
|
|
fclose ($pFichier);
|
|
echo "<br><table width=192 height=61><tr><td background=\"$racine/Imgs/raye10.gif\" bgcolor=\"#5b8cc1\" valign=center>\n";
|
|
echo "<br><font color=white><center>$commentaire</center></font></td></tr></table></center>\n";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|