@ -22,6 +22,12 @@ class gallery extends common {
'index' => self::GROUP_VISITOR
];
public static $order = [
'asc' => 'Tri alphabétique naturel',
'dsc' => 'Tri alphabétique naturel inverse',
'none' => 'Aucun tri',
];
public static $directories = [];
public static $firstPictures = [];
@ -38,7 +44,7 @@ class gallery extends common {
public function config() {
// Liste des galeries
$galleries = $this->getData(['module', $this->getUrl(0)]);
if($galleries) {
if($galleries) {
ksort($galleries,SORT_NATURAL);
foreach($galleries as $galleryId => $gallery) {
// Erreur dossier vide
@ -183,7 +189,8 @@ class gallery extends common {
'config' => [
'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true),
'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true),
'homePicture' => $homePictures[$file]
'homePicture' => $homePictures[$file],
'order' => $this->getInput('galleryEditOrder')
],
'legend' => $legends
]]);
@ -249,7 +256,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;
}
}
// Affichage du template
if(self::$pictures) {