Mono galerie avec fullscreen ok
This commit is contained in:
parent
041b232dc6
commit
8e17734144
@ -42,6 +42,8 @@ class gallery extends common {
|
|||||||
|
|
||||||
public static $thumbs = [];
|
public static $thumbs = [];
|
||||||
|
|
||||||
|
public static $config = [];
|
||||||
|
|
||||||
public static $actions = [
|
public static $actions = [
|
||||||
'config' => self::GROUP_MODERATOR,
|
'config' => self::GROUP_MODERATOR,
|
||||||
'delete' => self::GROUP_MODERATOR,
|
'delete' => self::GROUP_MODERATOR,
|
||||||
@ -600,11 +602,14 @@ class gallery extends common {
|
|||||||
|
|
||||||
// Mise à jour des données de module
|
// Mise à jour des données de module
|
||||||
$this->update();
|
$this->update();
|
||||||
|
// Une seule galerie, bifurquer sur celle-ci
|
||||||
|
$gallery = count($this->getData(['module', $this->getUrl(0), 'content'])) === 1
|
||||||
|
? array_key_first($this->getData(['module', $this->getUrl(0), 'content']))
|
||||||
|
: $this->getUrl(1);
|
||||||
// Images d'une galerie
|
// Images d'une galerie
|
||||||
if($this->getUrl(1)) {
|
if($gallery) {
|
||||||
// La galerie n'existe pas
|
// La galerie n'existe pas
|
||||||
if($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1)]) === null) {
|
if($this->getData(['module', $this->getUrl(0), 'content', $gallery]) === null) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'access' => false
|
'access' => false
|
||||||
@ -613,13 +618,17 @@ class gallery extends common {
|
|||||||
// La galerie existe
|
// La galerie existe
|
||||||
else {
|
else {
|
||||||
// Images de la galerie
|
// Images de la galerie
|
||||||
$directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'config', 'directory']);
|
$directory = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'directory']);
|
||||||
|
// Définir les options
|
||||||
|
self::$config['homePicture'] = $this->getData(['module',$this->getUrl(0),'content', $gallery,'config','homePicture']);
|
||||||
|
self::$config['fullScreen'] = $this->getData(['module',$this->getUrl(0),'content', $gallery,'config','fullScreen']) === true ? 'fullScreen' : '';
|
||||||
|
self::$config['mono'] = count($this->getData(['module', $this->getUrl(0), 'content'])) === 1;
|
||||||
if(is_dir($directory)) {
|
if(is_dir($directory)) {
|
||||||
$iterator = new DirectoryIterator($directory);
|
$iterator = new DirectoryIterator($directory);
|
||||||
foreach($iterator as $fileInfos) {
|
foreach($iterator as $fileInfos) {
|
||||||
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
|
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
|
||||||
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'legend', str_replace('.','',$fileInfos->getFilename())]);
|
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'legend', str_replace('.','',$fileInfos->getFilename())]);
|
||||||
$picturesSort[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'positions', str_replace('.','',$fileInfos->getFilename())]);
|
$picturesSort[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'positions', str_replace('.','',$fileInfos->getFilename())]);
|
||||||
// Créer la miniature si manquante
|
// Créer la miniature si manquante
|
||||||
if (!file_exists( str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) {
|
if (!file_exists( str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) {
|
||||||
$this->makeThumb($fileInfos->getPathname(),
|
$this->makeThumb($fileInfos->getPathname(),
|
||||||
@ -630,10 +639,11 @@ class gallery extends common {
|
|||||||
self::$thumbs[$directory . '/' . $fileInfos->getFilename()] = file_exists( str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))
|
self::$thumbs[$directory . '/' . $fileInfos->getFilename()] = file_exists( str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))
|
||||||
? str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())
|
? str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())
|
||||||
: str_replace('source','thumb',$directory) . '/' . strtolower($fileInfos->getFilename());
|
: str_replace('source','thumb',$directory) . '/' . strtolower($fileInfos->getFilename());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Tri des images par ordre alphabétique
|
// Tri des images par ordre alphabétique
|
||||||
switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'config', 'sort'])) {
|
switch ($this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'sort'])) {
|
||||||
case self::SORT_HAND:
|
case self::SORT_HAND:
|
||||||
asort($picturesSort);
|
asort($picturesSort);
|
||||||
if ($picturesSort) {
|
if ($picturesSort) {
|
||||||
@ -657,7 +667,7 @@ class gallery extends common {
|
|||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'showBarEditButton' => true,
|
'showBarEditButton' => true,
|
||||||
'title' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'config', 'name']),
|
'title' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'name']),
|
||||||
'view' => 'gallery',
|
'view' => 'gallery',
|
||||||
'style' => $this->getData(['module', $this->getUrl(0), 'theme', 'style'])
|
'style' => $this->getData(['module', $this->getUrl(0), 'theme', 'style'])
|
||||||
]);
|
]);
|
||||||
|
@ -24,9 +24,8 @@ var b = new SimpleLightbox('.galleryGalleryPicture', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
// Démarre en mode plein écran
|
// Démarre en mode plein écran
|
||||||
var fullscreen = <?php echo json_encode($this->getData(['module',$this->getUrl(0),'content',$this->getUrl(1),'config','fullScreen'])); ?>;
|
if ( $("#pictureContainer").hasClass("fullScreen") ) {
|
||||||
if ( fullscreen === true) {
|
|
||||||
$('a#homePicture')[0].click();
|
$('a#homePicture')[0].click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
<?php if ( $module::$config['mono'] !== true): ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col2">
|
<div class="col2">
|
||||||
<?php echo template::button('galleryGalleryBack', [
|
<?php echo template::button('galleryGalleryBack', [
|
||||||
@ -8,13 +10,13 @@
|
|||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row galleryRow">
|
<?php endif; ?>
|
||||||
|
<div id="pictureContainer" class="row galleryRow <?php echo ($module::$config['fullScreen']);?> ">
|
||||||
<?php foreach($module::$pictures as $picture => $legend): ?>
|
<?php foreach($module::$pictures as $picture => $legend): ?>
|
||||||
<div class="colPicture">
|
<div class="colPicture">
|
||||||
<a
|
<a
|
||||||
href="<?php echo helper::baseUrl(false) . $picture; ?>"
|
href="<?php echo helper::baseUrl(false) . $picture; ?>"
|
||||||
<?php if ( strpos($picture, $this->getData(['module',$this->getUrl(0),'content',$this->getUrl(1),'config','homePicture'])) > 0) {
|
<?php if ( strpos($picture, $module::$config['homePicture']) > 1) { echo 'id="homePicture"'; } ?>
|
||||||
echo 'id="homePicture"'; } ?>
|
|
||||||
class="galleryGalleryPicture"
|
class="galleryGalleryPicture"
|
||||||
style="background-image:url('<?php echo helper::baseUrl(false) . $module::$thumbs[$picture]; ?>')"
|
style="background-image:url('<?php echo helper::baseUrl(false) . $module::$thumbs[$picture]; ?>')"
|
||||||
data-caption="<?php echo $legend; ?>"
|
data-caption="<?php echo $legend; ?>"
|
||||||
|
Loading…
Reference in New Issue
Block a user