forked from ZwiiCMS-Team/ZwiiCMS
Fix positionnement des boutons de retour
This commit is contained in:
parent
d7bf8fb9b0
commit
edac937b35
@ -1,5 +1,6 @@
|
|||||||
# Version 3.8
|
# Version 3.8
|
||||||
- Version compare null, dataversion not initialize
|
- Version compare null, dataversion not initialize
|
||||||
|
- Bug de positionnement des boutons de retour
|
||||||
# Version 3.7
|
# Version 3.7
|
||||||
- Multilinguisme
|
- Multilinguisme
|
||||||
# Version 3.61
|
# Version 3.61
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
* @link http://zwiicms.fr/
|
* @link http://zwiicms.fr/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class gallery extends common {
|
class gallery extends common
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
const VERSION = '3.8';
|
const VERSION = '3.8';
|
||||||
@ -146,11 +147,11 @@ class gallery extends common {
|
|||||||
];
|
];
|
||||||
|
|
||||||
public static $galleryOptionBackPosition = [
|
public static $galleryOptionBackPosition = [
|
||||||
'displayNone' => 'Masqué',
|
'none' => 'Masqué',
|
||||||
'top' => 'Au-dessus',
|
'top' => 'Au-dessus',
|
||||||
|
'both' => 'Au-dessus et en dessous',
|
||||||
'bottom' => 'En dessous',
|
'bottom' => 'En dessous',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $galleryOptionBackAlign = [
|
public static $galleryOptionBackAlign = [
|
||||||
'left' => 'A gauche',
|
'left' => 'A gauche',
|
||||||
'center' => 'Au centre',
|
'center' => 'Au centre',
|
||||||
@ -163,7 +164,8 @@ class gallery extends common {
|
|||||||
* Mise à jour du module
|
* Mise à jour du module
|
||||||
* Appelée par les fonctions index et config
|
* Appelée par les fonctions index et config
|
||||||
*/
|
*/
|
||||||
private function update() {
|
private function update()
|
||||||
|
{
|
||||||
|
|
||||||
// Initialisation du module, créer les données si elles sont manquantes.
|
// Initialisation du module, créer les données si elles sont manquantes.
|
||||||
$this->init();
|
$this->init();
|
||||||
@ -189,11 +191,14 @@ class gallery extends common {
|
|||||||
* Config
|
* Config
|
||||||
* Content
|
* Content
|
||||||
*/
|
*/
|
||||||
private function init() {
|
private function init()
|
||||||
|
{
|
||||||
|
|
||||||
// Mise à jour d'une version inférieure, la gallery existe mais pas la variable content
|
// Mise à jour d'une version inférieure, la gallery existe mais pas la variable content
|
||||||
if ($this->getData(['module', $this->getUrl(0)]) &&
|
if (
|
||||||
$this->getData(['module', $this->getUrl(0), 'content']) === NULL ) {
|
$this->getData(['module', $this->getUrl(0)]) &&
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'content']) === NULL
|
||||||
|
) {
|
||||||
|
|
||||||
// Changement de l'arborescence dans module.json
|
// Changement de l'arborescence dans module.json
|
||||||
$data = $this->getData(['module', $this->getUrl(0)]);
|
$data = $this->getData(['module', $this->getUrl(0)]);
|
||||||
@ -261,12 +266,14 @@ class gallery extends common {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check la présence de la config
|
// Check la présence de la config
|
||||||
require_once('module/gallery/ressource/defaultdata.php');
|
|
||||||
if ( is_null($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']))
|
if (
|
||||||
|
is_null($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']))
|
||||||
|| is_null($this->getData(['module', $this->getUrl(0), 'config', 'backPosition']))
|
|| is_null($this->getData(['module', $this->getUrl(0), 'config', 'backPosition']))
|
||||||
|| is_null($this->getData(['module', $this->getUrl(0), 'config', 'backAlign']))
|
|| is_null($this->getData(['module', $this->getUrl(0), 'config', 'backAlign']))
|
||||||
|| is_null($this->getData(['module', $this->getUrl(0), 'config', 'versionData']))
|
|| is_null($this->getData(['module', $this->getUrl(0), 'config', 'versionData']))
|
||||||
) {
|
) {
|
||||||
|
require_once('module/gallery/ressource/defaultdata.php');
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]);
|
$this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,12 +288,16 @@ class gallery extends common {
|
|||||||
* Tri de la liste des galeries
|
* Tri de la liste des galeries
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function sortGalleries() {
|
public function sortGalleries()
|
||||||
|
{
|
||||||
if (isset($_POST['response'])) {
|
if (isset($_POST['response'])) {
|
||||||
$data = explode('&', $_POST['response']);
|
$data = explode('&', $_POST['response']);
|
||||||
$data = str_replace('galleryTable%5B%5D=', '', $data);
|
$data = str_replace('galleryTable%5B%5D=', '', $data);
|
||||||
for ($i = 0; $i < count($data); $i++) {
|
for ($i = 0; $i < count($data); $i++) {
|
||||||
$this->setData(['module', $this->getUrl(0), 'content', $data[$i], [
|
$this->setData([
|
||||||
|
'module', $this->getUrl(0),
|
||||||
|
'content', $data[$i],
|
||||||
|
[
|
||||||
'config' => [
|
'config' => [
|
||||||
'name' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'name']),
|
'name' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'name']),
|
||||||
'directory' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'directory']),
|
'directory' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'directory']),
|
||||||
@ -299,7 +310,8 @@ class gallery extends common {
|
|||||||
],
|
],
|
||||||
'legend' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'legend']),
|
'legend' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'legend']),
|
||||||
'positions' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'positions'])
|
'positions' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'positions'])
|
||||||
]]);
|
]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,13 +320,18 @@ class gallery extends common {
|
|||||||
* Tri de la liste des images
|
* Tri de la liste des images
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function sortPictures() {
|
public function sortPictures()
|
||||||
|
{
|
||||||
if (isset($_POST['response'])) {
|
if (isset($_POST['response'])) {
|
||||||
$galleryName = $_POST['gallery'];
|
$galleryName = $_POST['gallery'];
|
||||||
$data = explode('&', $_POST['response']);
|
$data = explode('&', $_POST['response']);
|
||||||
$data = str_replace('galleryTable%5B%5D=', '', $data);
|
$data = str_replace('galleryTable%5B%5D=', '', $data);
|
||||||
// Sauvegarder
|
// Sauvegarder
|
||||||
$this->setData(['module', $this->getUrl(0), 'content', $galleryName, [
|
$this->setData([
|
||||||
|
'module', $this->getUrl(0),
|
||||||
|
'content',
|
||||||
|
$galleryName,
|
||||||
|
[
|
||||||
'config' => [
|
'config' => [
|
||||||
'name' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'name']),
|
'name' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'name']),
|
||||||
'directory' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'directory']),
|
'directory' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'directory']),
|
||||||
@ -326,7 +343,8 @@ class gallery extends common {
|
|||||||
],
|
],
|
||||||
'legend' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'legend']),
|
'legend' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'legend']),
|
||||||
'positions' => array_flip($data)
|
'positions' => array_flip($data)
|
||||||
]]);
|
]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +352,8 @@ class gallery extends common {
|
|||||||
/**
|
/**
|
||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
public function config() {
|
public function config()
|
||||||
|
{
|
||||||
|
|
||||||
// Mise à jour des données de module
|
// Mise à jour des données de module
|
||||||
$this->update();
|
$this->update();
|
||||||
@ -395,7 +414,8 @@ class gallery extends common {
|
|||||||
/**
|
/**
|
||||||
* Ajout d'une galerie
|
* Ajout d'une galerie
|
||||||
*/
|
*/
|
||||||
public function add() {
|
public function add()
|
||||||
|
{
|
||||||
// Soumission du formulaire d'ajout d'une galerie
|
// Soumission du formulaire d'ajout d'une galerie
|
||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
$galleryId = $this->getInput('galleryAddName', null, true);
|
$galleryId = $this->getInput('galleryAddName', null, true);
|
||||||
@ -408,13 +428,15 @@ class gallery extends common {
|
|||||||
$iterator = new DirectoryIterator($directory);
|
$iterator = new DirectoryIterator($directory);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
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())) {
|
||||||
$i += 1;
|
$i += 1;
|
||||||
// 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(),
|
||||||
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
||||||
self::THUMBS_WIDTH);
|
self::THUMBS_WIDTH
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Miniatures
|
// Miniatures
|
||||||
$homePicture = strtolower($fileInfos->getFilename());
|
$homePicture = strtolower($fileInfos->getFilename());
|
||||||
@ -423,7 +445,11 @@ class gallery extends common {
|
|||||||
}
|
}
|
||||||
// Le dossier de la galerie est vide
|
// Le dossier de la galerie est vide
|
||||||
if ($i > 0) {
|
if ($i > 0) {
|
||||||
$this->setData(['module', $this->getUrl(0), 'content', $galleryId, [
|
$this->setData([
|
||||||
|
'module', $this->getUrl(0),
|
||||||
|
'content',
|
||||||
|
$galleryId,
|
||||||
|
[
|
||||||
'config' => [
|
'config' => [
|
||||||
'name' => $this->getInput('galleryAddName'),
|
'name' => $this->getInput('galleryAddName'),
|
||||||
'directory' => $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true),
|
'directory' => $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true),
|
||||||
@ -435,7 +461,8 @@ class gallery extends common {
|
|||||||
],
|
],
|
||||||
'legend' => [],
|
'legend' => [],
|
||||||
'positions' => []
|
'positions' => []
|
||||||
]]);
|
]
|
||||||
|
]);
|
||||||
$success = true;
|
$success = true;
|
||||||
} else {
|
} else {
|
||||||
self::$inputNotices['galleryAddDirectory'] = "Le dossier sélectionné ne contient aucune image";
|
self::$inputNotices['galleryAddDirectory'] = "Le dossier sélectionné ne contient aucune image";
|
||||||
@ -469,7 +496,8 @@ class gallery extends common {
|
|||||||
/**
|
/**
|
||||||
* Suppression
|
* Suppression
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
public function delete()
|
||||||
|
{
|
||||||
// $url prend l'adresse sans le token
|
// $url prend l'adresse sans le token
|
||||||
// La galerie n'existe pas
|
// La galerie n'existe pas
|
||||||
if ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null) {
|
if ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null) {
|
||||||
@ -501,7 +529,8 @@ class gallery extends common {
|
|||||||
/**
|
/**
|
||||||
* Liste des dossiers
|
* Liste des dossiers
|
||||||
*/
|
*/
|
||||||
public function dirs() {
|
public function dirs()
|
||||||
|
{
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'display' => self::DISPLAY_JSON,
|
'display' => self::DISPLAY_JSON,
|
||||||
@ -512,7 +541,8 @@ class gallery extends common {
|
|||||||
/**
|
/**
|
||||||
* Édition
|
* Édition
|
||||||
*/
|
*/
|
||||||
public function edit() {
|
public function edit()
|
||||||
|
{
|
||||||
// Jeton incorrect
|
// Jeton incorrect
|
||||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -538,7 +568,10 @@ class gallery extends common {
|
|||||||
$homePicture = array_keys($this->getInput('homePicture', null))[0];
|
$homePicture = array_keys($this->getInput('homePicture', null))[0];
|
||||||
}
|
}
|
||||||
// Sauvegarder
|
// Sauvegarder
|
||||||
$this->setData(['module', $this->getUrl(0), 'content', $this->getUrl(2), [
|
$this->setData([
|
||||||
|
'module', $this->getUrl(0),
|
||||||
|
'content', $this->getUrl(2),
|
||||||
|
[
|
||||||
'config' => [
|
'config' => [
|
||||||
'homePicture' => $homePicture,
|
'homePicture' => $homePicture,
|
||||||
// Données mises à jour par les options
|
// Données mises à jour par les options
|
||||||
@ -552,7 +585,8 @@ class gallery extends common {
|
|||||||
],
|
],
|
||||||
'legend' => $legends,
|
'legend' => $legends,
|
||||||
'positions' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions'])
|
'positions' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions'])
|
||||||
]]);
|
]
|
||||||
|
]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(2) . '/' . $_SESSION['csrf'],
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(2) . '/' . $_SESSION['csrf'],
|
||||||
@ -574,12 +608,14 @@ class gallery extends common {
|
|||||||
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())) {
|
||||||
// Créer la miniature RFM si manquante
|
// Créer la miniature RFM si manquante
|
||||||
if (!file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()))) {
|
if (!file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()))) {
|
||||||
$this->makeThumb($fileInfos->getPathname(),
|
$this->makeThumb(
|
||||||
|
$fileInfos->getPathname(),
|
||||||
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()),
|
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()),
|
||||||
122);
|
122
|
||||||
|
);
|
||||||
}
|
}
|
||||||
self::$pictures[str_replace('.', '', $fileInfos->getFilename())] = [
|
self::$pictures[str_replace('.', '', $fileInfos->getFilename())] = [
|
||||||
$this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions', str_replace('.', '', $fileInfos->getFilename())]) + 1,
|
$this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions', str_replace('.', '', $fileInfos->getFilename())]) + 1,
|
||||||
@ -642,7 +678,8 @@ class gallery extends common {
|
|||||||
/**
|
/**
|
||||||
* Accueil (deux affichages en un pour éviter une url à rallonge)
|
* Accueil (deux affichages en un pour éviter une url à rallonge)
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
// Mise à jour des données de module
|
// Mise à jour des données de module
|
||||||
$this->update();
|
$this->update();
|
||||||
@ -666,22 +703,39 @@ class gallery extends common {
|
|||||||
// Définir les options
|
// Définir les options
|
||||||
self::$config['homePicture'] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'homePicture']);
|
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['fullScreen'] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'fullScreen']) === true ? 'fullScreen' : '';
|
||||||
self::$config['backPosition'] = ( $this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) === true &&
|
self::$config['backPositionTop'] = ( $this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'top'||
|
||||||
count($this->getData(['module', $this->getUrl(0), 'content'])) === 1 )
|
$this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'both' )
|
||||||
? 'displayNone'
|
? ''
|
||||||
:$this->getData(['module', $this->getUrl(0), 'config','backPosition']) ;
|
: 'displayNone';
|
||||||
|
self::$config['backPositionBottom'] = ( $this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'bottom'||
|
||||||
|
$this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'both' )
|
||||||
|
? ''
|
||||||
|
: 'displayNone';
|
||||||
self::$config['backAlign'] = 'textAlign' . ucfirst($this->getData(['module', $this->getUrl(0), 'config', 'backAlign']));
|
self::$config['backAlign'] = 'textAlign' . ucfirst($this->getData(['module', $this->getUrl(0), 'config', 'backAlign']));
|
||||||
|
|
||||||
|
// Annulation de l'apparition des boutons si la galerie est unique
|
||||||
|
self::$config['backPositionTop'] = ($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) === true
|
||||||
|
&& count($this->getData(['module', $this->getUrl(0), 'content'])) === 1)
|
||||||
|
? 'displayNone'
|
||||||
|
: self::$config['backPositionTop'];
|
||||||
|
self::$config['backPositionBottom'] = ($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) === true
|
||||||
|
&& count($this->getData(['module', $this->getUrl(0), 'content'])) === 1)
|
||||||
|
? 'displayNone'
|
||||||
|
: self::$config['backPositionBottom'];
|
||||||
|
|
||||||
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', $gallery, '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', $gallery, '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(),
|
||||||
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
||||||
self::THUMBS_WIDTH);
|
self::THUMBS_WIDTH
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Définir la Miniature
|
// Définir la Miniature
|
||||||
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()))
|
||||||
@ -748,16 +802,18 @@ class gallery extends common {
|
|||||||
if (is_dir($gallery['config']['directory'])) {
|
if (is_dir($gallery['config']['directory'])) {
|
||||||
$iterator = new DirectoryIterator($gallery['config']['directory']);
|
$iterator = new DirectoryIterator($gallery['config']['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::$galleries[$galleryId] = $gallery;
|
self::$galleries[$galleryId] = $gallery;
|
||||||
// L'image de couverture est-elle supprimée ?
|
// L'image de couverture est-elle supprimée ?
|
||||||
if (file_exists($gallery['config']['directory'] . '/' . $gallery['config']['homePicture'])) {
|
if (file_exists($gallery['config']['directory'] . '/' . $gallery['config']['homePicture'])) {
|
||||||
// Créer la miniature si manquante
|
// Créer la miniature si manquante
|
||||||
if (!file_exists(str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']))) {
|
if (!file_exists(str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']))) {
|
||||||
$this->makeThumb($gallery['config']['directory'] . '/' . str_replace(self::THUMBS_SEPARATOR ,'',$gallery['config']['homePicture']),
|
$this->makeThumb(
|
||||||
|
$gallery['config']['directory'] . '/' . str_replace(self::THUMBS_SEPARATOR, '', $gallery['config']['homePicture']),
|
||||||
str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']),
|
str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']),
|
||||||
self::THUMBS_WIDTH);
|
self::THUMBS_WIDTH
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Définir l'image de couverture
|
// Définir l'image de couverture
|
||||||
self::$firstPictures[$galleryId] = file_exists(str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']))
|
self::$firstPictures[$galleryId] = file_exists(str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']))
|
||||||
@ -766,9 +822,11 @@ class gallery extends common {
|
|||||||
} else {
|
} else {
|
||||||
// homePicture contient une image invalide, supprimée ou déplacée
|
// homePicture contient une image invalide, supprimée ou déplacée
|
||||||
// Définir l'image de couverture, première image disponible
|
// Définir l'image de couverture, première image disponible
|
||||||
$this->makeThumb($fileInfos->getPath() . '/' . $fileInfos->getFilename(),
|
$this->makeThumb(
|
||||||
|
$fileInfos->getPath() . '/' . $fileInfos->getFilename(),
|
||||||
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
||||||
self::THUMBS_WIDTH);
|
self::THUMBS_WIDTH
|
||||||
|
);
|
||||||
self::$firstPictures[$galleryId] = file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))
|
self::$firstPictures[$galleryId] = file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))
|
||||||
? str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())
|
? str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())
|
||||||
: str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename());
|
: str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename());
|
||||||
@ -793,7 +851,8 @@ class gallery extends common {
|
|||||||
/**
|
/**
|
||||||
* Thème de la galerie
|
* Thème de la galerie
|
||||||
*/
|
*/
|
||||||
public function theme() {
|
public function theme()
|
||||||
|
{
|
||||||
// Jeton incorrect
|
// Jeton incorrect
|
||||||
if ($this->getUrl(2) !== $_SESSION['csrf']) {
|
if ($this->getUrl(2) !== $_SESSION['csrf']) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -808,7 +867,10 @@ class gallery extends common {
|
|||||||
if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) {
|
if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) {
|
||||||
mkdir(self::DATADIRECTORY . $this->getUrl(0), 0755, true);
|
mkdir(self::DATADIRECTORY . $this->getUrl(0), 0755, true);
|
||||||
}
|
}
|
||||||
$this->setData(['module', $this->getUrl(0), 'theme', [
|
$this->setData([
|
||||||
|
'module', $this->getUrl(0),
|
||||||
|
'theme',
|
||||||
|
[
|
||||||
'thumbAlign' => $this->getinput('galleryThemeThumbAlign', helper::FILTER_STRING_SHORT),
|
'thumbAlign' => $this->getinput('galleryThemeThumbAlign', helper::FILTER_STRING_SHORT),
|
||||||
'thumbWidth' => $this->getinput('galleryThemeThumbWidth', helper::FILTER_STRING_SHORT),
|
'thumbWidth' => $this->getinput('galleryThemeThumbWidth', helper::FILTER_STRING_SHORT),
|
||||||
'thumbHeight' => $this->getinput('galleryThemeThumbHeight', helper::FILTER_STRING_SHORT),
|
'thumbHeight' => $this->getinput('galleryThemeThumbHeight', helper::FILTER_STRING_SHORT),
|
||||||
@ -825,7 +887,8 @@ class gallery extends common {
|
|||||||
'legendBgColor' => $this->getinput('galleryThemeLegendBgColor', helper::FILTER_STRING_SHORT),
|
'legendBgColor' => $this->getinput('galleryThemeLegendBgColor', helper::FILTER_STRING_SHORT),
|
||||||
'showUniqueGallery' => $this->getinput('galleryThemeShowUniqueGallery', helper::FILTER_BOOLEAN),
|
'showUniqueGallery' => $this->getinput('galleryThemeShowUniqueGallery', helper::FILTER_BOOLEAN),
|
||||||
'style' => self::DATADIRECTORY . $this->getUrl(0) . '/theme.css',
|
'style' => self::DATADIRECTORY . $this->getUrl(0) . '/theme.css',
|
||||||
]]);
|
]
|
||||||
|
]);
|
||||||
// Création des fichiers CSS
|
// Création des fichiers CSS
|
||||||
$content = file_get_contents('module/gallery/ressource/vartheme.css');
|
$content = file_get_contents('module/gallery/ressource/vartheme.css');
|
||||||
$themeCss = file_get_contents('module/gallery/ressource/theme.css');
|
$themeCss = file_get_contents('module/gallery/ressource/theme.css');
|
||||||
@ -865,7 +928,8 @@ class gallery extends common {
|
|||||||
/**
|
/**
|
||||||
* Option de configuration de la galerie
|
* Option de configuration de la galerie
|
||||||
*/
|
*/
|
||||||
public function option() {
|
public function option()
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Options applicables à toutes les galeries du module
|
* Options applicables à toutes les galeries du module
|
||||||
*/
|
*/
|
||||||
@ -882,11 +946,16 @@ class gallery extends common {
|
|||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
|
|
||||||
// Sauver la configuration de la galerie
|
// Sauver la configuration de la galerie
|
||||||
$this->setData(['module', $this->getUrl(0), 'config', [
|
$this->setData([
|
||||||
|
'module', $this->getUrl(0),
|
||||||
|
'config',
|
||||||
|
[
|
||||||
'showUniqueGallery' => $this->getinput('galleriesOptionShowUniqueGallery', helper::FILTER_BOOLEAN),
|
'showUniqueGallery' => $this->getinput('galleriesOptionShowUniqueGallery', helper::FILTER_BOOLEAN),
|
||||||
'backPosition' => $this->getinput('galleryOptionBackPosition', null),
|
'backPosition' => $this->getinput('galleryOptionBackPosition'),
|
||||||
'backAlign' => $this->getinput('galleryOptionBackAlign', null)
|
'backAlign' => $this->getinput('galleryOptionBackAlign'),
|
||||||
]]);
|
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -935,7 +1004,11 @@ class gallery extends common {
|
|||||||
}
|
}
|
||||||
// Sauvegarder
|
// Sauvegarder
|
||||||
if ($this->getInput('galleryEditName')) {
|
if ($this->getInput('galleryEditName')) {
|
||||||
$this->setData(['module', $this->getUrl(0), 'content', $galleryId, [
|
$this->setData([
|
||||||
|
'module', $this->getUrl(0),
|
||||||
|
'content',
|
||||||
|
$galleryId,
|
||||||
|
[
|
||||||
'config' => [
|
'config' => [
|
||||||
'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true),
|
'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true),
|
||||||
'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true),
|
'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true),
|
||||||
@ -949,7 +1022,8 @@ class gallery extends common {
|
|||||||
],
|
],
|
||||||
'legend' => $legend,
|
'legend' => $legend,
|
||||||
'positions' => $positions
|
'positions' => $positions
|
||||||
]]);
|
]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -976,18 +1050,20 @@ class gallery extends common {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class galleriesHelper extends helper {
|
class galleriesHelper extends helper
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan le contenu d'un dossier et de ses sous-dossiers
|
* Scan le contenu d'un dossier et de ses sous-dossiers
|
||||||
* @param string $dir Dossier à scanner
|
* @param string $dir Dossier à scanner
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function scanDir($dir) {
|
public static function scanDir($dir)
|
||||||
|
{
|
||||||
$dirContent = [];
|
$dirContent = [];
|
||||||
$iterator = new DirectoryIterator($dir);
|
$iterator = new DirectoryIterator($dir);
|
||||||
foreach ($iterator as $fileInfos) {
|
foreach ($iterator as $fileInfos) {
|
||||||
if($fileInfos->isDot() === false AND $fileInfos->isDir()) {
|
if ($fileInfos->isDot() === false and $fileInfos->isDir()) {
|
||||||
$dirContent[] = $dir . '/' . $fileInfos->getBasename();
|
$dirContent[] = $dir . '/' . $fileInfos->getBasename();
|
||||||
$dirContent = array_merge($dirContent, self::scanDir($dir . '/' . $fileInfos->getBasename()));
|
$dirContent = array_merge($dirContent, self::scanDir($dir . '/' . $fileInfos->getBasename()));
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,3 @@
|
|||||||
* @link http://zwiicms.fr/
|
* @link http://zwiicms.fr/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#topBackPosition.bottom {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bottomBackPosition.top{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
|
<div class="row <?php echo $module::$config['backAlign'] . ' ' . $module::$config['backPositionTop'];?>">
|
||||||
<div id="topBackPosition" class="row <?php echo $module::$config['backPosition'] . ' ' . $module::$config['backAlign'];?>">
|
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('galleryGalleryBack', [
|
<?php echo template::button('galleryGalleryBack', [
|
||||||
'class' => 'buttonGrey',
|
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0),
|
'href' => helper::baseUrl() . $this->getUrl(0),
|
||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
@ -25,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="bottomBackPosition" class="row <?php echo $module::$config['backPosition'] . ' ' . $module::$config['backAlign'];?>">
|
<div class="row <?php echo $module::$config['backAlign'] . ' ' . $module::$config['backPositionBottom'];?>">
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php echo template::button('galleryGalleryBack', [
|
<?php echo template::button('galleryGalleryBack', [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0),
|
'href' => helper::baseUrl() . $this->getUrl(0),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user