|
|
@ -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,14 +164,15 @@ 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();
|
|
|
|
|
|
|
|
|
|
|
|
$versionData = $this->getData(['module',$this->getUrl(0),'config', 'versionData' ]);
|
|
|
|
$versionData = $this->getData(['module', $this->getUrl(0), 'config', 'versionData']);
|
|
|
|
// Mise à jour 3.1
|
|
|
|
// Mise à jour 3.1
|
|
|
|
if (version_compare($versionData, '3.1', '<') ) {
|
|
|
|
if (version_compare($versionData, '3.1', '<')) {
|
|
|
|
if (is_dir(self::DATADIRECTORY . 'pages/')) {
|
|
|
|
if (is_dir(self::DATADIRECTORY . 'pages/')) {
|
|
|
|
// Déplacer les données du dossier Pages
|
|
|
|
// Déplacer les données du dossier Pages
|
|
|
|
$this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0));
|
|
|
|
$this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0));
|
|
|
@ -179,7 +181,7 @@ class gallery extends common {
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', 'style', str_replace('pages/', '', $style)]);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', 'style', str_replace('pages/', '', $style)]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Mettre à jour la version
|
|
|
|
// Mettre à jour la version
|
|
|
|
$this->setData(['module',$this->getUrl(0),'config', 'versionData', '3.1' ]);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.1']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -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)]);
|
|
|
@ -208,9 +213,9 @@ class gallery extends common {
|
|
|
|
unlink('module/gallery/view/gallery/gallery.css');
|
|
|
|
unlink('module/gallery/view/gallery/gallery.css');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Stockage des données du thème de la gallery existant
|
|
|
|
// Stockage des données du thème de la gallery existant
|
|
|
|
if (is_array($this->getData(['theme','gallery']))) {
|
|
|
|
if (is_array($this->getData(['theme', 'gallery']))) {
|
|
|
|
$data = $this->getData(['theme','gallery']);
|
|
|
|
$data = $this->getData(['theme', 'gallery']);
|
|
|
|
$this->deleteData(['theme','gallery']);
|
|
|
|
$this->deleteData(['theme', 'gallery']);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', $data]);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', $data]);
|
|
|
|
// Nom de la feuille de style
|
|
|
|
// Nom de la feuille de style
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']);
|
|
|
@ -218,10 +223,10 @@ class gallery extends common {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Variable commune
|
|
|
|
// Variable commune
|
|
|
|
$fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ;
|
|
|
|
$fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css';
|
|
|
|
|
|
|
|
|
|
|
|
// Check la présence des données de thème
|
|
|
|
// Check la présence des données de thème
|
|
|
|
if ( $this->getData(['module', $this->getUrl(0), 'theme']) === null ) {
|
|
|
|
if ($this->getData(['module', $this->getUrl(0), 'theme']) === null) {
|
|
|
|
require_once('module/gallery/ressource/defaultdata.php');
|
|
|
|
require_once('module/gallery/ressource/defaultdata.php');
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', theme::$defaultTheme]);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', theme::$defaultTheme]);
|
|
|
|
// Nom de la feuille de style
|
|
|
|
// Nom de la feuille de style
|
|
|
@ -229,50 +234,52 @@ class gallery extends common {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check la présence de la feuille de style
|
|
|
|
// Check la présence de la feuille de style
|
|
|
|
if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) {
|
|
|
|
if (!file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) {
|
|
|
|
// Dossier de l'instance
|
|
|
|
// Dossier de l'instance
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Générer la feuille de CSS
|
|
|
|
// Générer la feuille de 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');
|
|
|
|
|
|
|
|
|
|
|
|
// Injection des variables
|
|
|
|
// Injection des variables
|
|
|
|
$content = str_replace('#thumbAlign#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbAlign']),$content );
|
|
|
|
$content = str_replace('#thumbAlign#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbAlign']), $content);
|
|
|
|
$content = str_replace('#thumbWidth#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbWidth']),$content );
|
|
|
|
$content = str_replace('#thumbWidth#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbWidth']), $content);
|
|
|
|
$content = str_replace('#thumbHeight#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbHeight']),$content );
|
|
|
|
$content = str_replace('#thumbHeight#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbHeight']), $content);
|
|
|
|
$content = str_replace('#thumbMargin#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbMargin']),$content );
|
|
|
|
$content = str_replace('#thumbMargin#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbMargin']), $content);
|
|
|
|
$content = str_replace('#thumbBorder#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbBorder']),$content );
|
|
|
|
$content = str_replace('#thumbBorder#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbBorder']), $content);
|
|
|
|
$content = str_replace('#thumbBorderColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbBorderColor']),$content );
|
|
|
|
$content = str_replace('#thumbBorderColor#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbBorderColor']), $content);
|
|
|
|
$content = str_replace('#thumbOpacity#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbOpacity']),$content );
|
|
|
|
$content = str_replace('#thumbOpacity#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbOpacity']), $content);
|
|
|
|
$content = str_replace('#thumbShadows#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbShadows']),$content );
|
|
|
|
$content = str_replace('#thumbShadows#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbShadows']), $content);
|
|
|
|
$content = str_replace('#thumbShadowsColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbShadowsColor']),$content );
|
|
|
|
$content = str_replace('#thumbShadowsColor#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbShadowsColor']), $content);
|
|
|
|
$content = str_replace('#thumbRadius#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbRadius']),$content );
|
|
|
|
$content = str_replace('#thumbRadius#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbRadius']), $content);
|
|
|
|
$content = str_replace('#legendAlign#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendAlign']),$content );
|
|
|
|
$content = str_replace('#legendAlign#', $this->getData(['module', $this->getUrl(0), 'theme', 'legendAlign']), $content);
|
|
|
|
$content = str_replace('#legendHeight#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendHeight']),$content );
|
|
|
|
$content = str_replace('#legendHeight#', $this->getData(['module', $this->getUrl(0), 'theme', 'legendHeight']), $content);
|
|
|
|
$content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendTextColor']),$content );
|
|
|
|
$content = str_replace('#legendTextColor#', $this->getData(['module', $this->getUrl(0), 'theme', 'legendTextColor']), $content);
|
|
|
|
$content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendBgColor']),$content );
|
|
|
|
$content = str_replace('#legendBgColor#', $this->getData(['module', $this->getUrl(0), 'theme', 'legendBgColor']), $content);
|
|
|
|
|
|
|
|
|
|
|
|
// Ecriture de la feuille de style
|
|
|
|
// Ecriture de la feuille de style
|
|
|
|
file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $content . $themeCss);
|
|
|
|
file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $content . $themeCss);
|
|
|
|
// Nom de la feuille de style
|
|
|
|
// Nom de la feuille de style
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 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]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Contenu vide de la galerie
|
|
|
|
// Contenu vide de la galerie
|
|
|
|
if (!is_array($this->getData(['module', $this->getUrl(0), 'content'])) ) {
|
|
|
|
if (!is_array($this->getData(['module', $this->getUrl(0), 'content']))) {
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'content', array() ]);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'content', array()]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -281,25 +288,30 @@ 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']) ){
|
|
|
|
{
|
|
|
|
$data = explode('&',$_POST['response']);
|
|
|
|
if (isset($_POST['response'])) {
|
|
|
|
$data = str_replace('galleryTable%5B%5D=','',$data);
|
|
|
|
$data = explode('&', $_POST['response']);
|
|
|
|
for($i=0;$i<count($data);$i++) {
|
|
|
|
$data = str_replace('galleryTable%5B%5D=', '', $data);
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'content', $data[$i], [
|
|
|
|
for ($i = 0; $i < count($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']),
|
|
|
|
'homePicture' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','homePicture']),
|
|
|
|
'homePicture' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'homePicture']),
|
|
|
|
'sort' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','sort']),
|
|
|
|
'sort' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'sort']),
|
|
|
|
'position'=> $i,
|
|
|
|
'position' => $i,
|
|
|
|
'fullScreen' => $this->getData(['module',$this->getUrl(0), 'content',$data[$i],'config','fullScreen']),
|
|
|
|
'fullScreen' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'fullScreen']),
|
|
|
|
'showPageContent' => $this->getData(['module',$this->getUrl(0), 'content',$data[$i],'config','showPageContent'])
|
|
|
|
'showPageContent' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'showPageContent'])
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'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,25 +320,31 @@ 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']),
|
|
|
|
'homePicture' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','homePicture']),
|
|
|
|
'homePicture' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'homePicture']),
|
|
|
|
'sort' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','sort']),
|
|
|
|
'sort' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'sort']),
|
|
|
|
'position' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','position']),
|
|
|
|
'position' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'position']),
|
|
|
|
'fullScreen' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','fullScreen'])
|
|
|
|
'fullScreen' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'fullScreen'])
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'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,25 +352,26 @@ 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();
|
|
|
|
|
|
|
|
|
|
|
|
//Affichage de la galerie triée
|
|
|
|
//Affichage de la galerie triée
|
|
|
|
$g = $this->getData(['module', $this->getUrl(0), 'content']);
|
|
|
|
$g = $this->getData(['module', $this->getUrl(0), 'content']);
|
|
|
|
$p = helper::arrayColumn(helper::arrayColumn($g,'config'),'position');
|
|
|
|
$p = helper::arrayColumn(helper::arrayColumn($g, 'config'), 'position');
|
|
|
|
asort($p,SORT_NUMERIC);
|
|
|
|
asort($p, SORT_NUMERIC);
|
|
|
|
$galleries = [];
|
|
|
|
$galleries = [];
|
|
|
|
foreach ($p as $positionId => $item) {
|
|
|
|
foreach ($p as $positionId => $item) {
|
|
|
|
$galleries [$positionId] = $g[$positionId];
|
|
|
|
$galleries[$positionId] = $g[$positionId];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Traitement de l'affichage
|
|
|
|
// Traitement de l'affichage
|
|
|
|
if($galleries) {
|
|
|
|
if ($galleries) {
|
|
|
|
foreach($galleries as $galleryId => $gallery) {
|
|
|
|
foreach ($galleries as $galleryId => $gallery) {
|
|
|
|
// Erreur dossier vide
|
|
|
|
// Erreur dossier vide
|
|
|
|
if(is_dir($gallery['config']['directory'])) {
|
|
|
|
if (is_dir($gallery['config']['directory'])) {
|
|
|
|
if(count(scandir($gallery['config']['directory'])) === 2) {
|
|
|
|
if (count(scandir($gallery['config']['directory'])) === 2) {
|
|
|
|
$gallery['config']['directory'] = '<span class="galleryConfigError">' . $gallery['config']['directory'] . ' (dossier vide)</span>';
|
|
|
|
$gallery['config']['directory'] = '<span class="galleryConfigError">' . $gallery['config']['directory'] . ' (dossier vide)</span>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -365,7 +384,7 @@ class gallery extends common {
|
|
|
|
$gallery['config']['position'] + 1,
|
|
|
|
$gallery['config']['position'] + 1,
|
|
|
|
$gallery['config']['name'],
|
|
|
|
$gallery['config']['name'],
|
|
|
|
$gallery['config']['directory'],
|
|
|
|
$gallery['config']['directory'],
|
|
|
|
template::button('galleryConfigEdit' . $galleryId , [
|
|
|
|
template::button('galleryConfigEdit' . $galleryId, [
|
|
|
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'],
|
|
|
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'],
|
|
|
|
'value' => template::ico('pencil'),
|
|
|
|
'value' => template::ico('pencil'),
|
|
|
|
'help' => 'Configuration de la galerie '
|
|
|
|
'help' => 'Configuration de la galerie '
|
|
|
@ -395,26 +414,29 @@ 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);
|
|
|
|
$success = false;
|
|
|
|
$success = false;
|
|
|
|
if ($galleryId ) {
|
|
|
|
if ($galleryId) {
|
|
|
|
$galleryId = helper::increment($this->getInput('galleryAddName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0), 'content']));
|
|
|
|
$galleryId = helper::increment($this->getInput('galleryAddName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0), 'content']));
|
|
|
|
$homePicture = '';
|
|
|
|
$homePicture = '';
|
|
|
|
// définir une vignette par défaut
|
|
|
|
// définir une vignette par défaut
|
|
|
|
$directory = $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true);
|
|
|
|
$directory = $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true);
|
|
|
|
$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(
|
|
|
|
str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
|
|
|
$fileInfos->getPathname(),
|
|
|
|
self::THUMBS_WIDTH);
|
|
|
|
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
|
|
|
|
|
|
|
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,10 +496,11 @@ 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) {
|
|
|
|
// Valeurs en sortie
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
$this->addOutput([
|
|
|
|
'access' => false
|
|
|
|
'access' => false
|
|
|
@ -501,18 +529,20 @@ 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,
|
|
|
|
'content' => galleriesHelper::scanDir(self::FILE_DIR.'source')
|
|
|
|
'content' => galleriesHelper::scanDir(self::FILE_DIR . 'source')
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* É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
|
|
|
@ -522,46 +552,50 @@ class gallery extends common {
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Soumission du formulaire
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
if ($this->isPost()) {
|
|
|
|
|
|
|
|
|
|
|
|
// légendes
|
|
|
|
// légendes
|
|
|
|
foreach((array) $this->getInput('legend', null) as $file => $legend) {
|
|
|
|
foreach ((array) $this->getInput('legend', null) as $file => $legend) {
|
|
|
|
// Image de couverture par défaut si non définie
|
|
|
|
// Image de couverture par défaut si non définie
|
|
|
|
$homePicture = $file;
|
|
|
|
$homePicture = $file;
|
|
|
|
$file = str_replace('.','',$file);
|
|
|
|
$file = str_replace('.', '', $file);
|
|
|
|
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
|
|
|
|
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Photo de la page de garde de l'album définie dans form
|
|
|
|
// Photo de la page de garde de l'album définie dans form
|
|
|
|
if (is_array($this->getInput('homePicture', null)) ) {
|
|
|
|
if (is_array($this->getInput('homePicture', null))) {
|
|
|
|
// Extrait la couverture sélectionnée
|
|
|
|
// Extrait la couverture sélectionnée
|
|
|
|
$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
|
|
|
|
'name' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name']),
|
|
|
|
'name' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name']),
|
|
|
|
'directory' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']),
|
|
|
|
'directory' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']),
|
|
|
|
'sort' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config','sort']),
|
|
|
|
'sort' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort']),
|
|
|
|
'position' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config', 'position']),
|
|
|
|
'position' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'position']),
|
|
|
|
'fullScreen' =>$this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullScreen']),
|
|
|
|
'fullScreen' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullScreen']),
|
|
|
|
'showPageContent' =>$this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'showPageContent'])
|
|
|
|
'showPageContent' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'showPageContent'])
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'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'],
|
|
|
|
'notification' => helper::translate('Modifications enregistrées'),
|
|
|
|
'notification' => helper::translate('Modifications enregistrées'),
|
|
|
|
'state' => true
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 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) {
|
|
|
|
// Valeurs en sortie
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
$this->addOutput([
|
|
|
|
'access' => false
|
|
|
|
'access' => false
|
|
|
@ -571,47 +605,49 @@ class gallery extends common {
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// Met en forme le tableau
|
|
|
|
// Met en forme le tableau
|
|
|
|
$directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']);
|
|
|
|
$directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']);
|
|
|
|
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(
|
|
|
|
str_replace('source','thumb',$fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()),
|
|
|
|
$fileInfos->getPathname(),
|
|
|
|
122);
|
|
|
|
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()),
|
|
|
|
|
|
|
|
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,
|
|
|
|
$fileInfos->getFilename(),
|
|
|
|
$fileInfos->getFilename(),
|
|
|
|
template::checkbox( 'homePicture[' . $fileInfos->getFilename() . ']', true, '', [
|
|
|
|
template::checkbox('homePicture[' . $fileInfos->getFilename() . ']', true, '', [
|
|
|
|
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config', 'homePicture']) === $fileInfos->getFilename() ? true : false,
|
|
|
|
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'homePicture']) === $fileInfos->getFilename() ? true : false,
|
|
|
|
'class' => 'homePicture'
|
|
|
|
'class' => 'homePicture'
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
template::text('legend[' . $fileInfos->getFilename() . ']', [
|
|
|
|
template::text('legend[' . $fileInfos->getFilename() . ']', [
|
|
|
|
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'legend', str_replace('.','',$fileInfos->getFilename())])
|
|
|
|
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'legend', str_replace('.', '', $fileInfos->getFilename())])
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
'<a href="' . str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . $fileInfos->getFilename() .'" rel="data-lity" data-lity=""><img src="'. str_replace('source','thumb',$directory) . '/' . $fileInfos->getFilename() . '"></a>'
|
|
|
|
'<a href="' . str_replace('source', 'thumb', $directory) . '/' . self::THUMBS_SEPARATOR . $fileInfos->getFilename() . '" rel="data-lity" data-lity=""><img src="' . str_replace('source', 'thumb', $directory) . '/' . $fileInfos->getFilename() . '"></a>'
|
|
|
|
];
|
|
|
|
];
|
|
|
|
self::$picturesId [] = str_replace('.','',$fileInfos->getFilename());
|
|
|
|
self::$picturesId[] = str_replace('.', '', $fileInfos->getFilename());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Tri des images
|
|
|
|
// Tri des images
|
|
|
|
switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) {
|
|
|
|
switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) {
|
|
|
|
case self::SORT_HAND:
|
|
|
|
case self::SORT_HAND:
|
|
|
|
$positions = $this->getData(['module',$this->getUrl(0),'content', $this->getUrl(2),'positions']);
|
|
|
|
$positions = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions']);
|
|
|
|
if ($positions) {
|
|
|
|
if ($positions) {
|
|
|
|
foreach ($positions as $key => $value) {
|
|
|
|
foreach ($positions as $key => $value) {
|
|
|
|
if (array_key_exists($key,self::$pictures)) {
|
|
|
|
if (array_key_exists($key, self::$pictures)) {
|
|
|
|
$tempPictures[$key] = self::$pictures[$key];
|
|
|
|
$tempPictures[$key] = self::$pictures[$key];
|
|
|
|
$tempPicturesId [] = $key;
|
|
|
|
$tempPicturesId[] = $key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Images ayant été ajoutées dans le dossier mais non triées
|
|
|
|
// Images ayant été ajoutées dans le dossier mais non triées
|
|
|
|
foreach (self::$pictures as $key => $value) {
|
|
|
|
foreach (self::$pictures as $key => $value) {
|
|
|
|
if (!array_key_exists($key,$tempPictures)) {
|
|
|
|
if (!array_key_exists($key, $tempPictures)) {
|
|
|
|
$tempPictures[$key] = self::$pictures[$key];
|
|
|
|
$tempPictures[$key] = self::$pictures[$key];
|
|
|
|
$tempPicturesId [] = $key;
|
|
|
|
$tempPicturesId[] = $key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
self::$pictures = $tempPictures;
|
|
|
|
self::$pictures = $tempPictures;
|
|
|
@ -619,12 +655,12 @@ class gallery extends common {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case self::SORT_ASC:
|
|
|
|
case self::SORT_ASC:
|
|
|
|
ksort(self::$pictures,SORT_NATURAL);
|
|
|
|
ksort(self::$pictures, SORT_NATURAL);
|
|
|
|
sort(self::$picturesId,SORT_NATURAL);
|
|
|
|
sort(self::$picturesId, SORT_NATURAL);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case self::SORT_DSC:
|
|
|
|
case self::SORT_DSC:
|
|
|
|
krsort(self::$pictures,SORT_NATURAL);
|
|
|
|
krsort(self::$pictures, SORT_NATURAL);
|
|
|
|
rsort(self::$picturesId,SORT_NATURAL);
|
|
|
|
rsort(self::$picturesId, SORT_NATURAL);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -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();
|
|
|
@ -651,9 +688,9 @@ class gallery extends common {
|
|
|
|
count($this->getData(['module', $this->getUrl(0), 'content'])) === 1
|
|
|
|
count($this->getData(['module', $this->getUrl(0), 'content'])) === 1
|
|
|
|
? array_key_first($this->getData(['module', $this->getUrl(0), 'content']))
|
|
|
|
? array_key_first($this->getData(['module', $this->getUrl(0), 'content']))
|
|
|
|
: $this->getUrl(1);
|
|
|
|
: $this->getUrl(1);
|
|
|
|
if($gallery) {
|
|
|
|
if ($gallery) {
|
|
|
|
// La galerie n'existe pas
|
|
|
|
// La galerie n'existe pas
|
|
|
|
if($this->getData(['module', $this->getUrl(0), 'content', $gallery]) === 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
|
|
|
@ -664,29 +701,46 @@ class gallery extends common {
|
|
|
|
// Images de la galerie
|
|
|
|
// Images de la galerie
|
|
|
|
$directory = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'directory']);
|
|
|
|
$directory = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'directory']);
|
|
|
|
// 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';
|
|
|
|
|
|
|
|
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']));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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'
|
|
|
|
? 'displayNone'
|
|
|
|
:$this->getData(['module', $this->getUrl(0), 'config','backPosition']) ;
|
|
|
|
: self::$config['backPositionTop'];
|
|
|
|
self::$config['backAlign'] = 'textAlign' . ucfirst($this->getData(['module', $this->getUrl(0), 'config','backAlign'])) ;
|
|
|
|
self::$config['backPositionBottom'] = ($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) === true
|
|
|
|
if(is_dir($directory) ) {
|
|
|
|
&& count($this->getData(['module', $this->getUrl(0), 'content'])) === 1)
|
|
|
|
|
|
|
|
? 'displayNone'
|
|
|
|
|
|
|
|
: self::$config['backPositionBottom'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
|
|
|
$fileInfos->getPathname(),
|
|
|
|
self::THUMBS_WIDTH);
|
|
|
|
str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
|
|
|
|
|
|
|
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()))
|
|
|
|
? 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());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -702,16 +756,16 @@ class gallery extends common {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case self::SORT_DSC:
|
|
|
|
case self::SORT_DSC:
|
|
|
|
krsort(self::$pictures,SORT_NATURAL);
|
|
|
|
krsort(self::$pictures, SORT_NATURAL);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case self::SORT_ASC:
|
|
|
|
case self::SORT_ASC:
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
ksort(self::$pictures,SORT_NATURAL);
|
|
|
|
ksort(self::$pictures, SORT_NATURAL);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Affichage du template
|
|
|
|
// Affichage du template
|
|
|
|
if(self::$pictures) {
|
|
|
|
if (self::$pictures) {
|
|
|
|
// Valeurs en sortie
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
$this->addOutput([
|
|
|
|
'showBarEditButton' => true,
|
|
|
|
'showBarEditButton' => true,
|
|
|
@ -737,41 +791,45 @@ class gallery extends common {
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// Tri des galeries suivant l'ordre défini
|
|
|
|
// Tri des galeries suivant l'ordre défini
|
|
|
|
$g = $this->getData(['module', $this->getUrl(0), 'content']);
|
|
|
|
$g = $this->getData(['module', $this->getUrl(0), 'content']);
|
|
|
|
$p = helper::arrayColumn(helper::arrayColumn($g,'config'),'position');
|
|
|
|
$p = helper::arrayColumn(helper::arrayColumn($g, 'config'), 'position');
|
|
|
|
asort($p,SORT_NUMERIC);
|
|
|
|
asort($p, SORT_NUMERIC);
|
|
|
|
$galleries = [];
|
|
|
|
$galleries = [];
|
|
|
|
foreach ($p as $positionId => $item) {
|
|
|
|
foreach ($p as $positionId => $item) {
|
|
|
|
$galleries [$positionId] = $g[$positionId];
|
|
|
|
$galleries[$positionId] = $g[$positionId];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Construire le tableau
|
|
|
|
// Construire le tableau
|
|
|
|
foreach((array) $galleries as $galleryId => $gallery) {
|
|
|
|
foreach ((array) $galleries as $galleryId => $gallery) {
|
|
|
|
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(
|
|
|
|
str_replace('source','thumb',$gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']),
|
|
|
|
$gallery['config']['directory'] . '/' . str_replace(self::THUMBS_SEPARATOR, '', $gallery['config']['homePicture']),
|
|
|
|
self::THUMBS_WIDTH);
|
|
|
|
str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']),
|
|
|
|
|
|
|
|
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']))
|
|
|
|
? 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'])
|
|
|
|
: str_replace('source','thumb',$gallery['config']['directory']) . '/' . strtolower($gallery['config']['homePicture']);
|
|
|
|
: str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . strtolower($gallery['config']['homePicture']);
|
|
|
|
} 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(
|
|
|
|
str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
|
|
|
|
$fileInfos->getPath() . '/' . $fileInfos->getFilename(),
|
|
|
|
self::THUMBS_WIDTH);
|
|
|
|
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()))
|
|
|
|
self::THUMBS_WIDTH
|
|
|
|
? str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())
|
|
|
|
);
|
|
|
|
: str_replace('source','thumb',$fileInfos->getPath()) . '/' . 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()) . '/' . strtolower($fileInfos->getFilename());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue(1);
|
|
|
|
continue(1);
|
|
|
@ -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
|
|
|
@ -803,12 +862,15 @@ class gallery extends common {
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Soumission du formulaire
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
if ($this->isPost()) {
|
|
|
|
// Dossier de l'instance
|
|
|
|
// Dossier de l'instance
|
|
|
|
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,25 +887,26 @@ 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');
|
|
|
|
// Injection des variables
|
|
|
|
// Injection des variables
|
|
|
|
$content = str_replace('#thumbAlign#',$this->getinput('galleryThemeThumbAlign'),$content );
|
|
|
|
$content = str_replace('#thumbAlign#', $this->getinput('galleryThemeThumbAlign'), $content);
|
|
|
|
$content = str_replace('#thumbWidth#',$this->getinput('galleryThemeThumbWidth'),$content );
|
|
|
|
$content = str_replace('#thumbWidth#', $this->getinput('galleryThemeThumbWidth'), $content);
|
|
|
|
$content = str_replace('#thumbHeight#',$this->getinput('galleryThemeThumbHeight'),$content );
|
|
|
|
$content = str_replace('#thumbHeight#', $this->getinput('galleryThemeThumbHeight'), $content);
|
|
|
|
$content = str_replace('#thumbMargin#',$this->getinput('galleryThemeThumbMargin'),$content );
|
|
|
|
$content = str_replace('#thumbMargin#', $this->getinput('galleryThemeThumbMargin'), $content);
|
|
|
|
$content = str_replace('#thumbBorder#',$this->getinput('galleryThemeThumbBorder'),$content );
|
|
|
|
$content = str_replace('#thumbBorder#', $this->getinput('galleryThemeThumbBorder'), $content);
|
|
|
|
$content = str_replace('#thumbBorderColor#',$this->getinput('galleryThemeThumbBorderColor'),$content );
|
|
|
|
$content = str_replace('#thumbBorderColor#', $this->getinput('galleryThemeThumbBorderColor'), $content);
|
|
|
|
$content = str_replace('#thumbOpacity#',$this->getinput('galleryThemeThumbOpacity'),$content );
|
|
|
|
$content = str_replace('#thumbOpacity#', $this->getinput('galleryThemeThumbOpacity'), $content);
|
|
|
|
$content = str_replace('#thumbShadows#',$this->getinput('galleryThemeThumbShadows'),$content );
|
|
|
|
$content = str_replace('#thumbShadows#', $this->getinput('galleryThemeThumbShadows'), $content);
|
|
|
|
$content = str_replace('#thumbShadowsColor#',$this->getinput('galleryThemeThumbShadowsColor'),$content );
|
|
|
|
$content = str_replace('#thumbShadowsColor#', $this->getinput('galleryThemeThumbShadowsColor'), $content);
|
|
|
|
$content = str_replace('#thumbRadius#',$this->getinput('galleryThemeThumbRadius'),$content );
|
|
|
|
$content = str_replace('#thumbRadius#', $this->getinput('galleryThemeThumbRadius'), $content);
|
|
|
|
$content = str_replace('#legendAlign#',$this->getinput('galleryThemeLegendAlign'),$content );
|
|
|
|
$content = str_replace('#legendAlign#', $this->getinput('galleryThemeLegendAlign'), $content);
|
|
|
|
$content = str_replace('#legendHeight#',$this->getinput('galleryThemeLegendHeight'),$content );
|
|
|
|
$content = str_replace('#legendHeight#', $this->getinput('galleryThemeLegendHeight'), $content);
|
|
|
|
$content = str_replace('#legendTextColor#',$this->getinput('galleryThemeLegendTextColor'),$content );
|
|
|
|
$content = str_replace('#legendTextColor#', $this->getinput('galleryThemeLegendTextColor'), $content);
|
|
|
|
$content = str_replace('#legendBgColor#',$this->getinput('galleryThemeLegendBgColor'),$content );
|
|
|
|
$content = str_replace('#legendBgColor#', $this->getinput('galleryThemeLegendBgColor'), $content);
|
|
|
|
$success = is_int(file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $content . $themeCss));
|
|
|
|
$success = is_int(file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $content . $themeCss));
|
|
|
|
// Valeurs en sortie
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
$this->addOutput([
|
|
|
@ -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
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -879,14 +943,19 @@ class gallery extends common {
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Soumission du formulaire
|
|
|
|
// Soumission du formulaire
|
|
|
|
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([
|
|
|
@ -915,19 +984,19 @@ class gallery extends common {
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Soumission du formulaire
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
if ($this->isPost()) {
|
|
|
|
|
|
|
|
|
|
|
|
// Le nom de la galerie est vide c'est le nom dans l'url qui est pris en compte
|
|
|
|
// Le nom de la galerie est vide c'est le nom dans l'url qui est pris en compte
|
|
|
|
$galleryId = !empty($this->getInput('galleryEditName')) ? $this->getInput('galleryEditName', helper::FILTER_ID, true) : $this->getUrl(3);
|
|
|
|
$galleryId = !empty($this->getInput('galleryEditName')) ? $this->getInput('galleryEditName', helper::FILTER_ID, true) : $this->getUrl(3);
|
|
|
|
|
|
|
|
|
|
|
|
// Sauvegarde des Valeurs non affectées par ce formulaire
|
|
|
|
// Sauvegarde des Valeurs non affectées par ce formulaire
|
|
|
|
$homePicture = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'homePicture']);
|
|
|
|
$homePicture = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'homePicture']);
|
|
|
|
$position = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3),'config','position']);
|
|
|
|
$position = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'position']);
|
|
|
|
$legend = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'legend']);
|
|
|
|
$legend = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'legend']);
|
|
|
|
$positions = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'positions']);
|
|
|
|
$positions = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'positions']);
|
|
|
|
|
|
|
|
|
|
|
|
// Le nom de la galerie n'est pas celui dans la BDD
|
|
|
|
// Le nom de la galerie n'est pas celui dans la BDD
|
|
|
|
if($galleryId !== $this->getUrl(3)) {
|
|
|
|
if ($galleryId !== $this->getUrl(3)) {
|
|
|
|
// Incrémente le nouvel id de la galerie
|
|
|
|
// Incrémente le nouvel id de la galerie
|
|
|
|
$galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0), 'content']));
|
|
|
|
$galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0), 'content']));
|
|
|
|
// Supprime l'ancienne galerie
|
|
|
|
// Supprime l'ancienne galerie
|
|
|
@ -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),
|
|
|
@ -943,17 +1016,18 @@ class gallery extends common {
|
|
|
|
'fullScreen' => $this->getInput('galleryEditFullscreen', helper::FILTER_BOOLEAN),
|
|
|
|
'fullScreen' => $this->getInput('galleryEditFullscreen', helper::FILTER_BOOLEAN),
|
|
|
|
'showPageContent' => $this->getInput('galleryEditShowPageContent', helper::FILTER_BOOLEAN),
|
|
|
|
'showPageContent' => $this->getInput('galleryEditShowPageContent', helper::FILTER_BOOLEAN),
|
|
|
|
// Données lues à partir du formulaire edit de la galerie avec la liste des images
|
|
|
|
// Données lues à partir du formulaire edit de la galerie avec la liste des images
|
|
|
|
'homePicture' =>$homePicture,
|
|
|
|
'homePicture' => $homePicture,
|
|
|
|
'position' => $position
|
|
|
|
'position' => $position
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'legend' => $legend,
|
|
|
|
'legend' => $legend,
|
|
|
|
'positions' => $positions
|
|
|
|
'positions' => $positions
|
|
|
|
]]);
|
|
|
|
]
|
|
|
|
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
$this->addOutput([
|
|
|
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'] ,
|
|
|
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'],
|
|
|
|
'notification' => helper::translate('Modifications enregistrées'),
|
|
|
|
'notification' => helper::translate('Modifications enregistrées'),
|
|
|
|
'state' => true
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
]);
|
|
|
@ -962,7 +1036,7 @@ class gallery extends common {
|
|
|
|
self::$formOptionSelect = 'gallery';
|
|
|
|
self::$formOptionSelect = 'gallery';
|
|
|
|
// Valeurs en sortie
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => sprintf(helper::translate('Options de la galerie %s'), ucfirst( $this->getUrl(3)) ),
|
|
|
|
'title' => sprintf(helper::translate('Options de la galerie %s'), ucfirst($this->getUrl(3))),
|
|
|
|
'view' => 'option'
|
|
|
|
'view' => 'option'
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -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()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|