reste à afficher la carte
This commit is contained in:
parent
b32630d008
commit
cf7a46a3ae
@ -182,15 +182,7 @@ class geogallery extends common
|
||||
$this->update();
|
||||
|
||||
//Affichage de la galerie triée
|
||||
$g = $this->getData(['module', $this->getUrl(0), 'content']);
|
||||
$p = helper::arrayColumn(helper::arrayColumn($g, 'config'), 'position');
|
||||
asort($p, SORT_NUMERIC);
|
||||
$galleries = [];
|
||||
foreach ($p as $positionId => $item) {
|
||||
$galleries[$positionId] = $g[$positionId];
|
||||
}
|
||||
|
||||
|
||||
$galleries = $this->getData(['module', $this->getUrl(0), 'content']);
|
||||
|
||||
// Traitement de l'affichage
|
||||
if ($galleries) {
|
||||
@ -207,7 +199,6 @@ class geogallery extends common
|
||||
}
|
||||
// Met en forme le tableau
|
||||
self::$galleries[] = [
|
||||
$gallery['config']['position'] + 1,
|
||||
$gallery['config']['name'],
|
||||
$gallery['config']['directory'],
|
||||
template::button('galleryConfigEdit' . $galleryId, [
|
||||
@ -289,20 +280,13 @@ class geogallery extends common
|
||||
}
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => helper::translate('Galerie ajoutée'),
|
||||
'state' => true
|
||||
]);
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => helper::translate('Création d\'une galerie'),
|
||||
'view' => 'add'
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId,
|
||||
'notification' => helper::translate('Paramétrage de la galerie'),
|
||||
'state' => true
|
||||
]);
|
||||
|
||||
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
@ -384,9 +368,6 @@ class geogallery extends common
|
||||
// Données mises à jour par les options
|
||||
'name' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name']),
|
||||
'directory' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']),
|
||||
'position' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'position']),
|
||||
'fullScreen' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullScreen']),
|
||||
'showPageContent' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'showPageContent'])
|
||||
],
|
||||
'legend' => $legends,
|
||||
//'geo' => $geo,
|
||||
@ -504,109 +485,42 @@ class geogallery extends common
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Une seule galerie, bifurquer sur celle-ci
|
||||
$gallery = $this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) === true &&
|
||||
count($this->getData(['module', $this->getUrl(0), 'content'])) === 1
|
||||
? array_key_first($this->getData(['module', $this->getUrl(0), 'content']))
|
||||
: $this->getUrl(1);
|
||||
if ($gallery) {
|
||||
// La galerie n'existe pas
|
||||
if ($this->getData(['module', $this->getUrl(0), 'content', $gallery]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// La galerie existe
|
||||
else {
|
||||
// Images de la galerie
|
||||
$directory = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'directory']);
|
||||
|
||||
if (is_dir($directory)) {
|
||||
$iterator = new DirectoryIterator($directory);
|
||||
foreach ($iterator as $fileInfos) {
|
||||
if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) {
|
||||
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'legend', str_replace('.', '', $fileInfos->getFilename())]);
|
||||
$picturesSort[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'positions', str_replace('.', '', $fileInfos->getFilename())]);
|
||||
// Créer la miniature si manquante
|
||||
if (!file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) {
|
||||
$this->makeThumb(
|
||||
$fileInfos->getPathname(),
|
||||
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
||||
self::THUMBS_WIDTH
|
||||
);
|
||||
}
|
||||
// Définir la Miniature
|
||||
self::$thumbs[$directory . '/' . $fileInfos->getFilename()] = file_exists(str_replace('source', 'thumb', $directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))
|
||||
? str_replace('source', 'thumb', $directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())
|
||||
: str_replace('source', 'thumb', $directory) . '/' . strtolower($fileInfos->getFilename());
|
||||
|
||||
$exif = exif_read_data($fileInfos->getPath() . '/' . $fileInfos->getFilename());
|
||||
// Vérifier si les données EXIF contiennent des informations de géolocalisation
|
||||
if (!empty($exif['GPSLatitude']) && !empty($exif['GPSLongitude'])) {
|
||||
// Coordonnées
|
||||
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = [
|
||||
'lat' => $this->gps_decimal($exif['GPSLatitude'], $exif['GPSLatitudeRef']),
|
||||
'long' => $this->gps_decimal($exif['GPSLongitude'], $exif['GPSLatitudeRef'])
|
||||
];
|
||||
}
|
||||
|
||||
// Liste des galeries
|
||||
$galleries = array_keys($this->getData(['module', $this->getUrl(0), 'content']));
|
||||
foreach ($galleries as $key => $gallery) {
|
||||
$directory = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'directory']);
|
||||
if (is_dir($directory)) {
|
||||
$iterator = new DirectoryIterator($directory);
|
||||
foreach ($iterator as $fileInfos) {
|
||||
if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) {
|
||||
self::$galleries[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'legend', str_replace('.', '', $fileInfos->getFilename())]);
|
||||
// Créer la miniature si manquante
|
||||
if (!file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) {
|
||||
$this->makeThumb(
|
||||
$fileInfos->getPathname(),
|
||||
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
||||
self::THUMBS_WIDTH
|
||||
);
|
||||
}
|
||||
$exif = exif_read_data($fileInfos->getPath() . '/' . $fileInfos->getFilename());
|
||||
// Vérifier si les données EXIF contiennent des informations de géolocalisation
|
||||
if (!empty($exif['GPSLatitude']) && !empty($exif['GPSLongitude'])) {
|
||||
// Coordonnées
|
||||
self::$galleries[$directory . '/' . $fileInfos->getFilename()] = [
|
||||
'lat' => $this->gps_decimal($exif['GPSLatitude'], $exif['GPSLatitudeRef']),
|
||||
'long' => $this->gps_decimal($exif['GPSLongitude'], $exif['GPSLatitudeRef'])
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
// Tri des images par ordre alphabétique
|
||||
switch ($this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'sort'])) {
|
||||
case self::SORT_HAND:
|
||||
asort($picturesSort);
|
||||
if ($picturesSort) {
|
||||
foreach ($picturesSort as $name => $position) {
|
||||
$temp[$name] = self::$pictures[$name];
|
||||
}
|
||||
self::$pictures = $temp;
|
||||
break;
|
||||
}
|
||||
case self::SORT_DSC:
|
||||
krsort(self::$pictures, SORT_NATURAL);
|
||||
break;
|
||||
case self::SORT_ASC:
|
||||
default:
|
||||
ksort(self::$pictures, SORT_NATURAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Affichage du template
|
||||
if (self::$pictures) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'name']),
|
||||
'view' => 'gallery',
|
||||
'showPageContent' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'showPageContent']),
|
||||
'vendor' => [
|
||||
'leaflet'
|
||||
],
|
||||
]);
|
||||
}
|
||||
// Pas d'image dans la galerie
|
||||
else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Liste des galeries
|
||||
else {
|
||||
// Construction du tableau exploitable par leaflet regroupant les images des galleries.
|
||||
$galleries = $this->getData(['module', $this->getUrl(0)], 'content');
|
||||
// Boucle sur les contenus de galeries
|
||||
foreach ($galleries as $galleryId => $galleriesContent) {
|
||||
// echo "<pre>";var_dump( $galleriesContent );
|
||||
}
|
||||
// Affichage du template
|
||||
if (self::$galleries) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index',
|
||||
'vendor' => [
|
||||
'leaflet'
|
||||
|
@ -33,33 +33,6 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryAddSort', $module::$sort, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort']),
|
||||
'label' => 'Tri des images',
|
||||
'help' => 'Tri manuel : déplacez le images dans le tableau ci-dessous. L\'ordre est sauvegardé automatiquement.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col7 verticalAlignBottom">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('galleryAddFullscreen', true, 'Mode plein écran automatique' , [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullScreen']),
|
||||
'help' => 'A l\'ouverture de la galerie, la première image est affichée en plein écran.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('galleryAddShowPageContent', true, 'Afficher le contenu de la page avec la galerie' , [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'showPageContent']),
|
||||
'help' => 'Le contenu de la page est toujours affiché dans la liste des galeries. Quand une seule galerie est disponible, il est possible de l\'afficher directement, cette option est utile dans ce cas précis.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php if($module::$galleries): ?>
|
||||
<?php echo template::table([1, 4, 5, 1, 1], $module::$galleries, ['#','Nom', 'Dossier cible', '', ''], ['id' => 'galleryTable'],$module::$galleriesId); ?>
|
||||
<?php echo template::table([5, 5, 1, 1], $module::$galleries, ['Nom', 'Dossier cible', '', ''], ['id' => 'galleryTable'],$module::$galleriesId); ?>
|
||||
<?php echo template::hidden('galleryConfigFilterResponse'); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune galerie'); ?>
|
||||
|
Loading…
Reference in New Issue
Block a user