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'; 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 * Configuration
@ -115,10 +90,32 @@ class gallery extends common {
} }
} }
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
// Tri de la galerie
if ($this->getInput('galleryConfigFilterResponse')) { 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 { } else {
$galleryId = helper::increment($this->getInput('galleryConfigName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0)])); $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 // 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 // Activer le bouton de tri uniquement après un tri
$("#galleryTable").click(function() { $("#galleryTable").click(function() {
if ($("#galleryEditFilterResponse").val() != "") { if ($("#galleryConfigFilterResponse").val() != "") {
$(":input[type='submit']").prop('disabled', false); $(":input[type='submit']").prop('disabled', false);
} }
}); });

View File

@ -12,7 +12,7 @@
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">
<h4>Nouvelle galerie</h4> <h4>Ajouter une galerie</h4>
<div class="row"> <div class="row">
<div class="col4"> <div class="col4">
<?php echo template::text('galleryConfigName', [ <?php echo template::text('galleryConfigName', [
@ -46,24 +46,27 @@
</div> </div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>
<?php echo template::formOpen('galleryConfigFilterForm'); ?> <?php echo template::formOpen('galleryConfigFilterForm'); ?>
<?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'); ?>
<?php echo template::hidden('galleryConfigFilterSubmit',[
'value' => false
]); ?>
<?php else: ?>
<?php echo template::speech('Aucune galerie.'); ?>
<?php endif; ?>
<div class="row"> <div class="row">
<div class="col2 offset10"> <div class="col12">
<?php echo template::submit('galleryConfigFilterSubmit', [ <div class="block">
'value' => 'Trier', <h4>Galeries installées</h4>
'disabled' => true <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'); ?>
<?php echo template::hidden('galleryConfigFilterSubmit',[
'value' => false
]); ?>
<?php else: ?>
<?php echo template::speech('Aucune galerie.'); ?>
<?php endif; ?>
</div>
<div class="moduleVersion">Version
<?php echo $module::GALLERY_VERSION; ?>
</div> </div>
</div> </div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::GALLERY_VERSION; ?>
</div>

View File

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