Cosmétique

This commit is contained in:
Fred Tempez 2020-04-08 21:10:13 +02:00
parent 179f27270c
commit 193843ae14
4 changed files with 49 additions and 49 deletions

View File

@ -44,31 +44,6 @@ class gallery extends common {
const GALLERY_VERSION = '2.1';
/**
* Tri des galeries
*/
private function sortGallery() {
// Traitement du tri
$data = explode('&',($this->getInput('galleryConfigFilterResponse')));
$data = str_replace('galleryTable%5B%5D=','',$data);
for($i=0;$i<count($data);$i++) {
$this->setData(['module', $this->getUrl(0), $data[$i], [
'config' => [
'name' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','name']),
'directory' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','directory']),
'homePicture' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','homePicture']),
'sort' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','sort']),
'position' => $i
],
'legend' => $this->getData(['module',$this->getUrl(0),$data[$i],'legend'])
]]);
}
$this->saveData();
// Valeurs en sortie
// Recharge la page
header('Refresh: 0;url='. helper::baseUrl() . $this->getUrl() );
}
/**
* Configuration
@ -115,10 +90,32 @@ class gallery extends common {
}
}
// Soumission du formulaire
if($this->isPost()) {
// Tri de la galerie
if ($this->getInput('galleryConfigFilterResponse')) {
self::sortGallery();
$data = explode('&',($this->getInput('galleryConfigFilterResponse')));
$data = str_replace('galleryTable%5B%5D=','',$data);
for($i=0;$i<count($data);$i++) {
$this->setData(['module', $this->getUrl(0), $data[$i], [
'config' => [
'name' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','name']),
'directory' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','directory']),
'homePicture' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','homePicture']),
'sort' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','sort']),
'position' => $i
],
'legend' => $this->getData(['module',$this->getUrl(0),$data[$i],'legend'])
]]);
}
$this->saveData();
// Valeurs en sortie
$this->addOutput([
'title' => 'Configuration du module',
'view' => 'config',
'vendor' => [
'tablednd'
]
]);
} else {
$galleryId = helper::increment($this->getInput('galleryConfigName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0)]));
// La première image est celle de la couverture de l'album

View File

@ -26,7 +26,7 @@ $( document ).ready(function() {
// Activer le bouton de tri uniquement après un tri
$("#galleryTable").click(function() {
if ($("#galleryEditFilterResponse").val() != "") {
if ($("#galleryConfigFilterResponse").val() != "") {
$(":input[type='submit']").prop('disabled', false);
}
});

View File

@ -12,7 +12,7 @@
<div class="row">
<div class="col12">
<div class="block">
<h4>Nouvelle galerie</h4>
<h4>Ajouter une galerie</h4>
<div class="row">
<div class="col4">
<?php echo template::text('galleryConfigName', [
@ -46,6 +46,15 @@
</div>
<?php echo template::formClose(); ?>
<?php echo template::formOpen('galleryConfigFilterForm'); ?>
<div class="row">
<div class="col12">
<div class="block">
<h4>Galeries installées</h4>
<div class="col2 offset10">
<?php echo template::submit('galleryConfigFilterSubmit', [
'disabled' => true
]); ?>
</div>
<?php if($module::$galleries): ?>
<?php echo template::table([1, 4, 5, 1, 1], $module::$galleries, ['','Nom', 'Dossier cible', '', ''], ['id' => 'galleryTable'],$module::$galleriesId); ?>
<?php echo template::hidden('galleryConfigFilterResponse'); ?>
@ -55,15 +64,9 @@
<?php else: ?>
<?php echo template::speech('Aucune galerie.'); ?>
<?php endif; ?>
<div class="row">
<div class="col2 offset10">
<?php echo template::submit('galleryConfigFilterSubmit', [
'value' => 'Trier',
'disabled' => true
]); ?>
</div>
<div class="moduleVersion">Version
<?php echo $module::GALLERY_VERSION; ?>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::GALLERY_VERSION; ?>
</div>

View File

@ -54,8 +54,8 @@
<?php else: ?>
<?php echo template::speech('Aucune galerie.'); ?>
<?php endif; ?>
<div class="moduleVersion">Version
<?php echo $module::GALLERY_VERSION; ?>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::GALLERY_VERSION; ?>
</div>