From ec5fd877da11e5ecfac4831d6e1e7c67d4ba8398 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 22 Feb 2020 23:07:12 +0100 Subject: [PATCH] [9.2.22] Ajustement tri des images --- module/gallery/gallery.php | 12 +++++++++++- module/gallery/view/edit/edit.php | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 3fc1deaa..7f4d6857 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -221,7 +221,17 @@ class gallery extends common { } } // Tri des images par ordre alphabétique - ksort(self::$pictures,SORT_NATURAL); + switch ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'config', 'order'])) { + case 'none': + break; + case 'dsc': + krsort(self::$pictures,SORT_NATURAL); + break; + case 'asc': + default: + ksort(self::$pictures,SORT_NATURAL); + break; + } } // Valeurs en sortie $this->addOutput([ diff --git a/module/gallery/view/edit/edit.php b/module/gallery/view/edit/edit.php index 3655e5d0..3994556e 100644 --- a/module/gallery/view/edit/edit.php +++ b/module/gallery/view/edit/edit.php @@ -37,6 +37,7 @@
$this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'order']), 'label' => 'Tri des images', 'help' => 'Les images sont triées par nom de fichier grâce à la méthode naturelle qui donne de meilleurs résultats lorsque les images sont numérotées.' ]); ?>