forked from ZwiiCMS-Team/ZwiiCMS
[9.2.22] Tri des images dans la galerie
This commit is contained in:
parent
108e0d3fbf
commit
8a746b3661
@ -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) {
|
||||
|
@ -34,6 +34,14 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('galleryEditOrder', $module::$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.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user