Simplification

This commit is contained in:
Fred Tempez 2024-08-08 06:55:52 +02:00
parent 891a1e00b1
commit ab68cbf934
2 changed files with 5 additions and 38 deletions

View File

@ -246,7 +246,6 @@ class geogallery extends common
) {
// légendes
foreach ((array) $this->getInput('legend', null) as $file => $legend) {
// Image de couverture par défaut si non définie
$legends[str_replace('.', '', $file)] = helper::filter($legend, helper::FILTER_STRING_SHORT);
}
// Données géographiques
@ -322,50 +321,21 @@ class geogallery extends common
template::text('legend[' . $fileInfos->getFilename() . ']', [
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'legend', str_replace('.', '', $fileInfos->getFilename())])
]),
template::text('gpslong[' . $fileInfos->getFilename() . ']', [
/*template::text('gpslong[' . $fileInfos->getFilename() . ']', [
'value' => $longitude,
'readonly' => true,
]),
template::text('gpslat[' . $fileInfos->getFilename() . ']', [
]),*/
$longitude,
/* template::text('gpslat[' . $fileInfos->getFilename() . ']', [
'value' => $latitude,
'readonly' => true,
]),
*/$latitude,
'<a href="' . str_replace('source', 'thumb', $directory) . '/' . self::THUMBS_SEPARATOR . $fileInfos->getFilename() . '" rel="data-lity" data-lity=""><img src="' . str_replace('source', 'thumb', $directory) . '/' . $fileInfos->getFilename() . '"></a>',
];
self::$picturesId[] = str_replace('.', '', $fileInfos->getFilename());
}
}
// Tri des images
switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) {
case self::SORT_HAND:
$positions = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'position']);
if ($positions) {
foreach ($positions as $key => $value) {
if (array_key_exists($key, self::$pictures)) {
$tempPictures[$key] = self::$pictures[$key];
$tempPicturesId[] = $key;
}
}
// Images ayant été ajoutées dans le dossier mais non triées
foreach (self::$pictures as $key => $value) {
if (!array_key_exists($key, $tempPictures)) {
$tempPictures[$key] = self::$pictures[$key];
$tempPicturesId[] = $key;
}
}
self::$pictures = $tempPictures;
self::$picturesId = $tempPicturesId;
}
break;
case self::SORT_ASC:
ksort(self::$pictures, SORT_NATURAL);
sort(self::$picturesId, SORT_NATURAL);
break;
case self::SORT_DSC:
krsort(self::$pictures, SORT_NATURAL);
rsort(self::$picturesId, SORT_NATURAL);
break;
}
}
// Valeurs en sortie
$this->addOutput([

View File

@ -21,9 +21,6 @@
<div class="col12">
<?php if ($module::$pictures): ?>
<?php echo template::table([3, 4, 2, 2, 1], $module::$pictures, ['Image', 'Légende', 'Longitude', 'Latitude', 'Miniature'], ['id' => 'galleryTable'], $module::$picturesId); ?>
<?php echo template::hidden('galleryEditFormResponse'); ?>
<?php echo template::hidden('galleryEditSort', ['value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])]); ?>
<?php echo template::hidden('galleryEditFormGalleryName', ['value' => $this->getUrl(2)]); ?>
<?php else: ?>
<?php echo template::speech('Aucune image.'); ?>
<?php endif; ?>