Améliorations

This commit is contained in:
Fred Tempez 2024-08-08 11:33:55 +02:00
parent dfed3ecf11
commit 0fbf9ef188
3 changed files with 34 additions and 75 deletions

View File

@ -49,12 +49,8 @@ class geogallery extends common
'config' => self::GROUP_EDITOR, 'config' => self::GROUP_EDITOR,
'delete' => self::GROUP_EDITOR, 'delete' => self::GROUP_EDITOR,
'dirs' => self::GROUP_EDITOR, 'dirs' => self::GROUP_EDITOR,
'sortGalleries' => self::GROUP_EDITOR,
'sortPictures' => self::GROUP_EDITOR,
'edit' => self::GROUP_EDITOR, 'edit' => self::GROUP_EDITOR,
'add' => self::GROUP_EDITOR, 'add' => self::GROUP_EDITOR,
'theme' => self::GROUP_EDITOR,
'option' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];
@ -66,7 +62,7 @@ class geogallery extends common
private function update() private function update()
{ {
$versionData = $this->getData(['module', $this->getUrl(0), 'config', 'versionData']); //$versionData = $this->getData(['module', $this->getUrl(0), 'config', 'versionData']);
} }
@ -373,6 +369,7 @@ class geogallery extends common
self::THUMBS_WIDTH self::THUMBS_WIDTH
); );
} }
$exif = exif_read_data($fileInfos->getPath() . '/' . $fileInfos->getFilename()); $exif = exif_read_data($fileInfos->getPath() . '/' . $fileInfos->getFilename());
// Vérifier si les données EXIF contiennent des informations de géolocalisation // Vérifier si les données EXIF contiennent des informations de géolocalisation
@ -416,12 +413,20 @@ class geogallery extends common
// Calculer la distance maximale au centre pour déterminer le niveau de zoom // Calculer la distance maximale au centre pour déterminer le niveau de zoom
$maxDistance = 0; $maxDistance = 0;
foreach (self::$galleries as $coordinate) { foreach (self::$galleries as $coordinate) {
if (
is_numeric($centerLat)
&& is_numeric($centerLong)
&& $coordinate["lat"]
&& $coordinate["long"]
) {
$distance = $this->haversineGreatCircleDistance($centerLat, $centerLong, $coordinate["lat"], $coordinate["long"]); $distance = $this->haversineGreatCircleDistance($centerLat, $centerLong, $coordinate["lat"], $coordinate["long"]);
if ($distance > $maxDistance) { if ($distance > $maxDistance) {
$maxDistance = $distance; $maxDistance = $distance;
} }
} }
}
$zoomLevel = $this->getZoomLevel($maxDistance); $zoomLevel = $this->getZoomLevel($maxDistance);
self::$galleriesCenter = array( self::$galleriesCenter = array(
@ -443,44 +448,6 @@ class geogallery extends common
} }
} }
/**
* Thème de la galerie
*/
public function theme()
{
// Soumission du formulaire
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
$this->isPost()
) {
// Dossier de l'instance
if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) {
mkdir(self::DATADIRECTORY . $this->getUrl(0), 0755, true);
}
$this->setData([
'module',
$this->getUrl(0),
'theme',
[
]
]);
$success = true;
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl() . '/theme',
'notification' => $success ? 'Modifications enregistrées' : 'Modifications non enregistrées !',
'state' => $success
]);
}
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Thème'),
'view' => 'theme',
'vendor' => [
'tinycolorpicker'
]
]);
}
// Fonction pour convertir les coordonnées GPS au format décimal // Fonction pour convertir les coordonnées GPS au format décimal
private function gps_decimal($coordinate, $hemisphere) private function gps_decimal($coordinate, $hemisphere)

View File

@ -13,22 +13,10 @@
*/ */
#map { #map {
height: 400px; height: 500px;
}
.lity-wrap {
width: auto !important;
height: auto !important;
max-width: 90%;
max-height: 90%;
display: flex;
align-items: center;
justify-content: center;
}
.lity-content img {
width: auto; width: auto;
max-width: 100%; }
height: auto; .leaflet-popup-content {
max-height: 100%; text-align: center;
font-weight: bold;
} }

View File

@ -35,5 +35,9 @@ const objOptions = JSON.parse(jsonOptions);
obj.forEach(function(location) { obj.forEach(function(location) {
var marker = L.marker([location.lat, location.long], {title: location.label}); var marker = L.marker([location.lat, location.long], {title: location.label});
marker.addTo(map); marker.addTo(map);
marker.bindPopup('<p>' + location.label + '</p><a href="' + location.img + '" data-lity><img src="' + location.thumb + '" alt="Thumbnail" class="thumbnail"></a>'); marker.bindPopup('<p>' + location.label + '</p><a href="' + location.img + '" data-lity><img src="' + location.thumb + '" alt="Thumbnail" class="thumbnail"></a>',{
minWidth: 150,
maxWidth: 150,
minHeight: 150
});
}); });