From 229ef395db21d20d57a03cab0fefb6e1fd4abd75 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 16 Apr 2020 14:15:49 +0200 Subject: [PATCH] =?UTF-8?q?2.11=20=20gestion=20des=20images=20supprim?= =?UTF-8?q?=C3=A9es=20ou=20ajout=C3=A9es=20au=20dossier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/gallery/gallery.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 1ec04ad7..306e9535 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -47,7 +47,7 @@ class gallery extends common { public static $thumbs = []; - const GALLERY_VERSION = '2.10'; + const GALLERY_VERSION = '2.11'; /** @@ -233,7 +233,7 @@ class gallery extends common { // Soumission du formulaire if($this->isPost()) { /** - * $picturesPosition contien un tableau avec les images triées + * $picturesPosition contient un tableau avec les images triées */ $picturesPosition = []; if ($this->getInput('galleryEditFormResponse') && @@ -324,10 +324,19 @@ class gallery extends common { case self::SORT_HAND: $positions = $this->getdata(['module',$this->getUrl(0), $this->getUrl(2),'position']); if ($positions) { - foreach ($positions as $position => $name) { - $tempPictures [] = self::$pictures[$position]; - $tempPicturesId [] = $position; - } + 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; }