forked from ZwiiCMS-Team/ZwiiCMS
Merge branch '10600' into 11000
This commit is contained in:
commit
d7991f702e
@ -1643,7 +1643,7 @@ class common {
|
||||
){
|
||||
if(class_exists($parent)) {
|
||||
$module = new $moduleId;
|
||||
$module->initCSS($parent);
|
||||
$module->update($parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,12 +149,15 @@ class gallery extends common {
|
||||
*/
|
||||
private function update() {
|
||||
|
||||
// Mise à jour d'une version inférieure
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) {
|
||||
// Mise à jour d'une version inférieure, la gallery existe mais pas content
|
||||
if ($this->getData(['module', $this->getUrl(0)]) &&
|
||||
$this->getData(['module', $this->getUrl(0), 'content']) === NULL ) {
|
||||
|
||||
// Changement de l'arborescence dans module.json
|
||||
$data = $this->getData(['module', $this->getUrl(0)]);
|
||||
$this->deleteData(['module', $this->getUrl(0)]);
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $data]);
|
||||
|
||||
// Effacer les fichiers CSS de l'ancienne version
|
||||
if (file_exists('module/gallery/view/index/index.css')) {
|
||||
unlink('module/gallery/view/index/index.css');
|
||||
@ -162,42 +165,35 @@ class gallery extends common {
|
||||
if (file_exists('module/gallery/view/gallery/gallery.css')) {
|
||||
unlink('module/gallery/view/gallery/gallery.css');
|
||||
}
|
||||
// Stockage des données du thème de la gallery
|
||||
$data = $this->getData(['theme','gallery']);
|
||||
$this->deleteData(['theme','gallery']);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', $data]);
|
||||
// Stockage des données du thème de la gallery existant
|
||||
if (is_array($this->getData(['theme','gallery']))) {
|
||||
$data = $this->getData(['theme','gallery']);
|
||||
$this->deleteData(['theme','gallery']);
|
||||
$this->setData(['module', $this->getUrl(0), 'theme', $data]);
|
||||
// Nom de la feuille de style
|
||||
$this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $moduleId . '.css']);
|
||||
} else {
|
||||
// Theme par défaut
|
||||
$this->init($this->geturl(0));
|
||||
}
|
||||
// Nouvelle version
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.0']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisation du thème d'un nouveau module
|
||||
* Initialisation séparément les éléments absents
|
||||
* Thème
|
||||
* Config
|
||||
* Content
|
||||
*/
|
||||
private function initCSS($moduleId) {
|
||||
private function init($moduleId) {
|
||||
// Variable commune
|
||||
$fileCSS = self::DATADIRECTORY . $moduleId . '.css' ;
|
||||
// Check la présence de la config
|
||||
if ( $this->getData(['module', $moduleId, 'config']) === null ) {
|
||||
// Check la présence du thème
|
||||
if ( $this->getData(['module', $moduleId, 'theme']) === null ) {
|
||||
require_once('module/gallery/ressource/defaultdata.php');
|
||||
$this->setData(['module', $moduleId, 'config', [
|
||||
'style' => $fileCSS,
|
||||
'thumbAlign' => theme::$defaultData['thumbAlign'],
|
||||
'thumbWidth' => theme::$defaultData['thumbWidth'],
|
||||
'thumbHeight' => theme::$defaultData['thumbHeight'],
|
||||
'thumbMargin' => theme::$defaultData['thumbMargin'],
|
||||
'thumbBorder' => theme::$defaultData['thumbBorder'],
|
||||
'thumbOpacity' => theme::$defaultData['thumbOpacity'],
|
||||
'thumbBorderColor' => theme::$defaultData['thumbBorderColor'],
|
||||
'thumbRadius' => theme::$defaultData['thumbRadius'],
|
||||
'thumbShadows' => theme::$defaultData['thumbShadows'],
|
||||
'thumbShadowsColor'=> theme::$defaultData['thumbShadowsColor'],
|
||||
'legendHeight' => theme::$defaultData['legendHeight'],
|
||||
'legendAlign' => theme::$defaultData['legendAlign'],
|
||||
'legendTextColor' => theme::$defaultData['legendTextColor'],
|
||||
'legendBgColor' => theme::$defaultData['legendBgColor'],
|
||||
'versionData' => theme::$defaultData['versionData']
|
||||
]]);
|
||||
$this->setData(['module', $moduleId, 'theme', theme::$defaultTheme]);
|
||||
}
|
||||
// Check la présence de la feuille de style
|
||||
if ( !file_exists(self::DATADIRECTORY . $moduleId . '.css')) {
|
||||
@ -206,30 +202,40 @@ class gallery extends common {
|
||||
mkdir (self::DATADIRECTORY, 0777, true);
|
||||
}
|
||||
// Nom de la feuille de style
|
||||
$this->setData(['module', $moduleId, 'config', 'style', $fileCSS]);
|
||||
$this->setData(['module', $moduleId, 'theme', 'style', $fileCSS]);
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$content = file_get_contents('module/gallery/ressource/vartheme.css');
|
||||
$themeCss = file_get_contents('module/gallery/ressource/theme.css');
|
||||
|
||||
// Injection des variables
|
||||
$content = str_replace('#thumbAlign#',$this->getData(['module', $moduleId, 'config', 'thumbAlign']),$content );
|
||||
$content = str_replace('#thumbWidth#',$this->getData(['module', $moduleId, 'config', 'thumbWidth']),$content );
|
||||
$content = str_replace('#thumbHeight#',$this->getData(['module', $moduleId, 'config', 'thumbHeight']),$content );
|
||||
$content = str_replace('#thumbMargin#',$this->getData(['module', $moduleId, 'config', 'thumbMargin']),$content );
|
||||
$content = str_replace('#thumbBorder#',$this->getData(['module', $moduleId, 'config', 'thumbBorder']),$content );
|
||||
$content = str_replace('#thumbBorderColor#',$this->getData(['module', $moduleId, 'config', 'thumbBorderColor']),$content );
|
||||
$content = str_replace('#thumbOpacity#',$this->getData(['module', $moduleId, 'config', 'thumbOpacity']),$content );
|
||||
$content = str_replace('#thumbShadows#',$this->getData(['module', $moduleId, 'config', 'thumbShadows']),$content );
|
||||
$content = str_replace('#thumbShadowsColor#',$this->getData(['module', $moduleId, 'config', 'thumbShadowsColor']),$content );
|
||||
$content = str_replace('#thumbRadius#',$this->getData(['module', $moduleId, 'config', 'thumbRadius']),$content );
|
||||
$content = str_replace('#legendAlign#',$this->getData(['module', $moduleId, 'config', 'legendAlign']),$content );
|
||||
$content = str_replace('#legendHeight#',$this->getData(['module', $moduleId, 'config', 'legendHeight']),$content );
|
||||
$content = str_replace('#legendTextColor#',$this->getData(['module', $moduleId, 'config', 'legendTextColor']),$content );
|
||||
$content = str_replace('#legendBgColor#',$this->getData(['module', $moduleId, 'config', 'legendBgColor']),$content );
|
||||
$content = str_replace('#thumbAlign#',$this->getData(['module', $moduleId, 'theme', 'thumbAlign']),$content );
|
||||
$content = str_replace('#thumbWidth#',$this->getData(['module', $moduleId, 'theme', 'thumbWidth']),$content );
|
||||
$content = str_replace('#thumbHeight#',$this->getData(['module', $moduleId, 'theme', 'thumbHeight']),$content );
|
||||
$content = str_replace('#thumbMargin#',$this->getData(['module', $moduleId, 'theme', 'thumbMargin']),$content );
|
||||
$content = str_replace('#thumbBorder#',$this->getData(['module', $moduleId, 'theme', 'thumbBorder']),$content );
|
||||
$content = str_replace('#thumbBorderColor#',$this->getData(['module', $moduleId, 'theme', 'thumbBorderColor']),$content );
|
||||
$content = str_replace('#thumbOpacity#',$this->getData(['module', $moduleId, 'theme', 'thumbOpacity']),$content );
|
||||
$content = str_replace('#thumbShadows#',$this->getData(['module', $moduleId, 'theme', 'thumbShadows']),$content );
|
||||
$content = str_replace('#thumbShadowsColor#',$this->getData(['module', $moduleId, 'theme', 'thumbShadowsColor']),$content );
|
||||
$content = str_replace('#thumbRadius#',$this->getData(['module', $moduleId, 'theme', 'thumbRadius']),$content );
|
||||
$content = str_replace('#legendAlign#',$this->getData(['module', $moduleId, 'theme', 'legendAlign']),$content );
|
||||
$content = str_replace('#legendHeight#',$this->getData(['module', $moduleId, 'theme', 'legendHeight']),$content );
|
||||
$content = str_replace('#legendTextColor#',$this->getData(['module', $moduleId, 'theme', 'legendTextColor']),$content );
|
||||
$content = str_replace('#legendBgColor#',$this->getData(['module', $moduleId, 'theme', 'legendBgColor']),$content );
|
||||
// Ecriture de la feuille de style
|
||||
file_put_contents(self::DATADIRECTORY . $moduleId . '.css' , $content . $themeCss);
|
||||
}
|
||||
// Check Config
|
||||
if ( $this->getData(['module', $moduleId, 'config']) === null ) {
|
||||
require_once('module/gallery/ressource/defaultdata.php');
|
||||
$this->setData(['module', $moduleId, 'config', theme::$defaultData]);
|
||||
}
|
||||
|
||||
// Contenu vide de la galerie
|
||||
if (!is_array($this->getData(['module', $this->getUrl(0), 'content'])) ) {
|
||||
$this->setData(['module', $this->getUrl(0), 'content', array() ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -244,16 +250,16 @@ class gallery extends common {
|
||||
for($i=0;$i<count($data);$i++) {
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $data[$i], [
|
||||
'config' => [
|
||||
'name' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','name']),
|
||||
'directory' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','directory']),
|
||||
'homePicture' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','homePicture']),
|
||||
'sort' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','sort']),
|
||||
'name' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','name']),
|
||||
'directory' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','directory']),
|
||||
'homePicture' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','homePicture']),
|
||||
'sort' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','sort']),
|
||||
'position'=> $i,
|
||||
'fullScreen' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','fullScreen'])
|
||||
'fullScreen' => $this->getData(['module',$this->getUrl(0), 'content',$data[$i],'config','fullScreen'])
|
||||
|
||||
],
|
||||
'legend' => $this->getData(['module',$this->getUrl(0),$data[$i],'legend']),
|
||||
'positions' => $this->getData(['module',$this->getUrl(0),$data[$i],'positions'])
|
||||
'legend' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'legend']),
|
||||
'positions' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'positions'])
|
||||
]]);
|
||||
}
|
||||
}
|
||||
@ -291,12 +297,14 @@ class gallery extends common {
|
||||
*/
|
||||
public function config() {
|
||||
|
||||
// Initialisation du thème d'un nouveau module
|
||||
$this->initCss($this->getUrl(0));
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Initialisation d'un nouveau module
|
||||
if ($this->getData(['module', $this->getUrl(0)]) === null) {
|
||||
$this->init($this->getUrl(0));
|
||||
}
|
||||
|
||||
//Affichage de la galerie triée
|
||||
$g = $this->getData(['module', $this->getUrl(0), 'content']);
|
||||
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
|
||||
@ -576,10 +584,15 @@ class gallery extends common {
|
||||
* Accueil (deux affichages en un pour éviter une url à rallonge)
|
||||
*/
|
||||
public function index() {
|
||||
// Initialisation du thème du nouveau module
|
||||
$this->initCss($this->getUrl(0));
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Initialisation d'un nouveau module
|
||||
if ($this->getData(['module', $this->getUrl(0)]) === null) {
|
||||
$this->init($this->getUrl(0));
|
||||
}
|
||||
|
||||
// Images d'une galerie
|
||||
if($this->getUrl(1)) {
|
||||
// La galerie n'existe pas
|
||||
@ -638,7 +651,7 @@ class gallery extends common {
|
||||
'showBarEditButton' => true,
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(1), 'config', 'name']),
|
||||
'view' => 'gallery',
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'config', 'style'])
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'theme', 'style'])
|
||||
]);
|
||||
}
|
||||
// Pas d'image dans la galerie
|
||||
@ -701,7 +714,7 @@ class gallery extends common {
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index',
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'config', 'style'])
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'theme', 'style'])
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -727,7 +740,7 @@ class gallery extends common {
|
||||
}
|
||||
$fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '.css' ;
|
||||
// Fin feuille de style
|
||||
$this->getData(['module', $this->getUrl(0), 'config', [
|
||||
$this->getData(['module', $this->getUrl(0), 'theme', [
|
||||
'thumbAlign' => $this->getinput('galleryThemeThumbAlign'),
|
||||
'thumbWidth' => $this->getinput('galleryThemeThumbWidth'),
|
||||
'thumbHeight' => $this->getinput('galleryThemeThumbHeight'),
|
||||
@ -743,9 +756,7 @@ class gallery extends common {
|
||||
'legendTextColor' => $this->getinput('galleryThemeLegendTextColor'),
|
||||
'legendBgColor' => $this->getinput('galleryThemeLegendBgColor'),
|
||||
'style' => $fileCSS,
|
||||
'version' => $this->getData(['module', $this->getUrl(0), 'config', 'version'])
|
||||
]
|
||||
]);
|
||||
]]);
|
||||
// Création des fichiers CSS
|
||||
$content = file_get_contents('module/gallery/ressource/vartheme.css');
|
||||
$themeCss = file_get_contents('module/gallery/ressource/theme.css');
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
class theme extends gallery {
|
||||
public static $defaultData = [
|
||||
public static $defaultTheme = [
|
||||
'thumbAlign' => 'center',
|
||||
'thumbWidth' => '18em',
|
||||
'thumbHeight' => '15em',
|
||||
@ -14,7 +14,9 @@ class theme extends gallery {
|
||||
'legendHeight' => '.375em',
|
||||
'legendAlign' => 'center',
|
||||
'legendTextColor' => 'rgba(255, 255, 255, 1)',
|
||||
'legendBgColor' => 'rgba(0, 0, 0, .6)',
|
||||
'versionData' => '3.0'
|
||||
'legendBgColor' => 'rgba(0, 0, 0, .6)'
|
||||
];
|
||||
public static $defaultData = [
|
||||
'versionData' => '3.0'
|
||||
];
|
||||
}
|
||||
|
@ -38,22 +38,22 @@
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort']),
|
||||
'label' => 'Tri des images',
|
||||
'help' => 'Tri manuel : déplacez le images dans le tableau ci-dessous. L\'ordre est sauvegardé automatiquement.'
|
||||
]); ?>
|
||||
]); ?>
|
||||
</div>
|
||||
<div clas="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('galleryEditFullscreen', true, 'Mode plein écran automatique' , [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullScreen']),
|
||||
'help' => 'A l\'ouverture de la galerie, la première image est affichée en plein écran.'
|
||||
]); ?>
|
||||
</div>
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php if($module::$pictures): ?>
|
||||
<?php echo template::table([1, 4, 1, 5, 1], $module::$pictures, ['','Image', 'Couverture','Légende',''],['id' => 'galleryTable'], $module::$picturesId ); ?>
|
||||
<?php echo template::hidden('galleryEditFormResponse'); ?>
|
||||
<?php echo template::hidden('galleryEditFormGalleryName',['value' => $this->getUrl(2)]); ?>
|
||||
<?php echo template::hidden('galleryEditFormGalleryName',['value' => $this->getUrl(2)]); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune image.'); ?>
|
||||
<?php endif; ?>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div class="colPicture">
|
||||
<a
|
||||
href="<?php echo helper::baseUrl(false) . $picture; ?>"
|
||||
<?php if ( $picture === $this->getdata(['module',$this->getUrl(0),$this->getUrl(1),'config','homePicture']) ) {
|
||||
<?php if ( $picture === $this->getdata(['module',$this->getUrl(0),'content',$this->getUrl(1),'config','homePicture']) ) {
|
||||
echo 'id="homePicture"'; } ?>
|
||||
class="galleryGalleryPicture"
|
||||
style="background-image:url('<?php echo helper::baseUrl(false) . $module::$thumbs[$picture]; ?>')"
|
||||
|
@ -25,25 +25,25 @@
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeThumbWidth', $module::$galleryThemeSizeWidth, [
|
||||
'label' => 'Largeur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbWidth'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeThumbHeight', $module::$galleryThemeSizeHeight, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbHeight'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbHeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbAlign', $module::$galleryThemeFlexAlign, [
|
||||
'label' => 'Alignement',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbAlign'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::select('galleryThemeThumbMargin', $module::$galleryThemeMargin, [
|
||||
'label' => 'Marge',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbMargin'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbMargin'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -51,7 +51,7 @@
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbBorder', $module::$galleryThemeBorder, [
|
||||
'label' => 'Bordure',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbBorder'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbBorder'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
@ -59,13 +59,13 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur de la bordure',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','thumbBorderColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'theme','thumbBorderColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbRadius', $module::$galleryThemeRadius, [
|
||||
'label' => 'Arrondi des angles',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbRadius'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbRadius'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -73,7 +73,7 @@
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbShadows', $module::$galleryThemeShadows, [
|
||||
'label' => 'Ombre',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbShadows'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbShadows'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
@ -81,13 +81,13 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur de l\'ombre',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','thumbShadowsColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'theme','thumbShadowsColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbOpacity', $module::$galleryThemeOpacity, [
|
||||
'label' => 'Opacité au survol',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbOpacity'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbOpacity'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -108,7 +108,7 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Texte',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','legendTextColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'theme','legendTextColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
@ -116,19 +116,19 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Fond',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','legendBgColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'theme','legendBgColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeLegendHeight', $module::$galleryThemeLegendHeight, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','legendHeight'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','legendHeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeLegendAlign', $module::$galleryThemeAlign, [
|
||||
'label' => 'Alignement',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','legendAlign'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme','legendAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -44,7 +44,7 @@ class news extends common {
|
||||
public static $users = [];
|
||||
|
||||
// Nombre d'objets par page
|
||||
public static $ItemsList = [
|
||||
public static $itemsList = [
|
||||
4 => '4 articles',
|
||||
8 => '8 articles',
|
||||
12 => '12 articles',
|
||||
@ -52,7 +52,7 @@ class news extends common {
|
||||
22 => '22 articles'
|
||||
];
|
||||
// Nombre de colone par page
|
||||
public static $Columns = [
|
||||
public static $columns = [
|
||||
12 => '1 Colonne',
|
||||
6 => '2 Colonnes',
|
||||
4 => '3 Colonnes',
|
||||
@ -60,10 +60,18 @@ class news extends common {
|
||||
];
|
||||
public static $nbrCol = 1;
|
||||
|
||||
public static $ItemsHeight = [
|
||||
'200px' => 'Petit',
|
||||
'300px' => 'Moyen',
|
||||
'400px' => 'Grand'
|
||||
public static $itemsHeight = [
|
||||
'200px' => 'Petite',
|
||||
'300px' => 'Moyenne',
|
||||
'400px' => 'Grande',
|
||||
'auto' => 'Article complet'
|
||||
];
|
||||
|
||||
public static $itemsBlur = [
|
||||
'100%' => 'Aucun',
|
||||
'90%' => 'Faible',
|
||||
'75%' => 'Modéré',
|
||||
'60%' => 'Important',
|
||||
];
|
||||
|
||||
// Signature de l'article
|
||||
@ -165,34 +173,44 @@ class news extends common {
|
||||
*/
|
||||
public function config() {
|
||||
|
||||
// Initialisation du thème du nouveau module
|
||||
$this->initCss($this->getUrl(0));
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Initialisation d'un nouveau module
|
||||
if ($this->getData(['module', $this->getUrl(0)]) === null) {
|
||||
$this->init($this->getUrl(0));
|
||||
}
|
||||
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
|
||||
// Générer la feuille de CSS
|
||||
// Générer la feuille de CSS
|
||||
$style = '.newsContent {height:' . $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT) . ';}';
|
||||
$style .= '.newsBlur {background: linear-gradient(#333 ' . $this->getInput('newsConfigItemsBlur',helper::FILTER_STRING_SHORT) . ',#FFF );';
|
||||
$style .= ' background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;}';
|
||||
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATADIRECTORY)) {
|
||||
mkdir (self::DATADIRECTORY, 0777, true);
|
||||
}
|
||||
|
||||
$success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '.css' , $style );
|
||||
|
||||
// Fin feuille de style
|
||||
|
||||
$this->setData(['module', $this->getUrl(0), 'theme',[
|
||||
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '.css' : '',
|
||||
'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT),
|
||||
'itemsBlur' => $this->getInput('newsConfigItemsBlur',helper::FILTER_STRING_SHORT)
|
||||
]]);
|
||||
|
||||
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
|
||||
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
|
||||
'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
||||
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '.css' : ''
|
||||
]]);
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
@ -338,11 +356,15 @@ class news extends common {
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
// Initialisation du thème du nouveau module
|
||||
$this->initCss($this->getUrl(0));
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Initialisation d'un nouveau module
|
||||
if ($this->getData(['module', $this->getUrl(0)]) === null) {
|
||||
$this->init($this->getUrl(0));
|
||||
}
|
||||
|
||||
|
||||
// Affichage d'un article
|
||||
if(
|
||||
$this->getUrl(1)
|
||||
@ -395,7 +417,7 @@ class news extends common {
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'view' => 'index',
|
||||
'style' => $this->getData(['module', $this->getUrl(0),'config', 'style'])
|
||||
'style' => $this->getData(['module', $this->getUrl(0),'theme', 'style'])
|
||||
]);
|
||||
|
||||
}
|
||||
@ -428,40 +450,41 @@ class news extends common {
|
||||
* Appelée par les fonctions index et config
|
||||
*/
|
||||
private function update() {
|
||||
|
||||
// Version 3.0
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 16]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'itemsperCol', 6]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','3.0']);
|
||||
if ($this->getData(['module', $this->getUrl(0), 'config']) === NULL ) {
|
||||
// Données config et theme absentes du précédent module
|
||||
$this->init($this->getUrl(0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisation du thème d'un nouveau module
|
||||
*/
|
||||
private function initCSS($moduleId) {
|
||||
private function init($moduleId) {
|
||||
// Variable commune
|
||||
$fileCSS = self::DATADIRECTORY . $moduleId . '.css' ;
|
||||
|
||||
if ( $this->getData(['module', $moduleId, 'config', 'itemsHeight']) === null ) {
|
||||
|
||||
$this->setData(['module', $moduleId, 'config', 'itemsHeight', '200px']);
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$style = '.newsContent {height: 200px;}';
|
||||
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATADIRECTORY)) {
|
||||
mkdir (self::DATADIRECTORY, 0777, true);
|
||||
}
|
||||
|
||||
// Sauver la feuille de style
|
||||
$success = file_put_contents(self::DATADIRECTORY .$moduleId . '.css' , $style );
|
||||
|
||||
// Nom de la feuille de style
|
||||
$this->setData(['module', $moduleId, 'config', 'style', self::DATADIRECTORY .$moduleId]);
|
||||
// Fin feuille de style
|
||||
// Données du module
|
||||
require_once('module/news/ressource/defaultdata.php');
|
||||
$this->setData(['module', $moduleId, 'config',init::$defaultData ]);
|
||||
// Données de thème
|
||||
$this->setData(['module', $moduleId, 'theme',init::$defaultTheme ]);
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$style = '.newsContent {height: ' . $this->getData([ 'module', $moduleId, 'theme', 'itemsHeight' ]) .';}';
|
||||
$style .= '.newsBlur {background: linear-gradient(#333 ' . $this->getData([ 'module', $moduleId, 'theme', 'itemsBlur' ]) . ',#FFF );';
|
||||
$style .= ' background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;}';
|
||||
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATADIRECTORY)) {
|
||||
mkdir (self::DATADIRECTORY, 0777, true);
|
||||
}
|
||||
|
||||
// Sauver la feuille de style
|
||||
file_put_contents(self::DATADIRECTORY .$moduleId . '.css' , $style );
|
||||
|
||||
// Stocker le nom de la feuille de style
|
||||
$this->setData(['module', $moduleId, 'theme', 'style', self::DATADIRECTORY . $moduleId . '.css']);
|
||||
}
|
||||
}
|
||||
|
14
module/news/ressource/defaultdata.php
Normal file
14
module/news/ressource/defaultdata.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class init extends search {
|
||||
public static $defaultData = [
|
||||
'feeds' => false,
|
||||
'feedsLabel' => '',
|
||||
'itemsperPage' => 8,
|
||||
'itemsperCol' => 12,
|
||||
'versionData' => '3.0'
|
||||
];
|
||||
public static $defaultTheme = [
|
||||
'itemsHeight' => '200px',
|
||||
'itemsBlur' => '0%'
|
||||
];
|
||||
}
|
@ -37,25 +37,32 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Block ajouté pour le sélecteur -->
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigItemsperCol', $module::$Columns, [
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsConfigItemsperCol', $module::$columns, [
|
||||
'label' => 'Pagination',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']),
|
||||
'help' => 'Nombre de colonnes par page'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigItemsperPage', $module::$ItemsList, [
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsConfigItemsperPage', $module::$itemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigItemsHeight', $module::$ItemsHeight, [
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsConfigItemsHeight', $module::$itemsHeight, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsHeight'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'itemsHeight']),
|
||||
'help' => 'Limite la hauteur de l\'article, cette option est utile lorsque la pagination en colonnes est activée.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsConfigItemsBlur', $module::$itemsBlur, [
|
||||
'label' => 'Effet flou',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'itemsBlur']),
|
||||
'help' => 'Effet appliqué en bas de l\'article afin d\'éviter une coupure brutale quand la hauteur de l\'article n\'est pas définie sur Article Complet'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -23,22 +23,19 @@
|
||||
}*/
|
||||
.newsContent {
|
||||
overflow: hidden; /* les dépassements seront masqués */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.newsBlur {
|
||||
background: linear-gradient(#333 70%,#FFF );
|
||||
background-clip: text;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
.newsContent {
|
||||
position: relative;
|
||||
clear: left;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
/*
|
||||
.newsBlur {
|
||||
background: linear-gradient(#333 90%,#FFF );
|
||||
background-clip: text;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}*/
|
||||
|
||||
|
||||
.newsSignature {
|
||||
margin-right: 10px;
|
||||
|
@ -5,8 +5,9 @@ class init extends search {
|
||||
'resultHideContent' => false,
|
||||
'placeHolder' => 'Un ou plusieurs mots-clés séparés par un espace ou par +',
|
||||
'submitText' => 'Rechercher',
|
||||
'keywordColor' => 'rgba(229, 229, 1, 1)',
|
||||
'versionData' => '2.0',
|
||||
'style' => ''
|
||||
'versionData' => '2.0'
|
||||
];
|
||||
public static $defaultTheme = [
|
||||
'keywordColor' => 'rgba(229, 229, 1, 1)'
|
||||
];
|
||||
}
|
@ -52,65 +52,86 @@ class search extends common {
|
||||
*/
|
||||
private function update() {
|
||||
|
||||
// Version 2.0
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '2.0', '<') ) {
|
||||
|
||||
// Données de l'instance
|
||||
// Déplacement des données d'une version ultérieure
|
||||
if ($this->getData(['module', $this->getUrl(0), 'previewLength']) ) {
|
||||
$data = $this->getData(['module', $this->getUrl(0)]);
|
||||
// Feuille de style
|
||||
$fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '.css' ;
|
||||
$this->setData(['module', $this->getUrl(0), 'config', [
|
||||
'submitText' => $this->getData(['module', $this->getUrl(0), 'submitText']),
|
||||
'placeHolder' => $this->getData(['module', $this->getUrl(0), 'placeHolder']),
|
||||
'resultHideContent' => $this->getData(['module', $this->getUrl(0), 'resultHideContent']),
|
||||
'previewLength' => $this->getData(['module', $this->getUrl(0), 'previewLength']),
|
||||
'keywordColor' => $this->getData(['module', $this->getUrl(0), 'keywordColor']),
|
||||
'style' => self::DATADIRECTORY . $this->getUrl(0) . '.css',
|
||||
'versionData' => '2.0'
|
||||
]]);
|
||||
$this->setData(['module', $this->getUrl(0), 'theme', [
|
||||
'keywordColor' => $this->getData(['module', $this->getUrl(0), 'keywordColor']),
|
||||
'style' => $fileCSS
|
||||
]]);
|
||||
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATADIRECTORY)) {
|
||||
mkdir (self::DATADIRECTORY, 0777, true);
|
||||
}
|
||||
// Générer la feuille de CSS
|
||||
$style = '.keywordColor {background: ' . $this->getData(['module', $this->getUrl(0), 'theme', 'keywordColor']) . ';}';
|
||||
// Sauver la feuille de style
|
||||
$success = file_put_contents( $fileCSS, $style);
|
||||
// Nettoyage des données précédentes
|
||||
$this->deleteData(['module', $this->getUrl(0), 'submitText']);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'placeHolder']);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'resultHideContent']);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'previewLength']);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'keywordColor']);
|
||||
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '2.0']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisation du thème du module
|
||||
* Appelée par les fonctions index et config
|
||||
* Initialisation du module
|
||||
*/
|
||||
private function initCss($moduleId){
|
||||
// Création des valeurs de réglage par défaut
|
||||
if ( !is_array($this->getData(['module',$moduleId, 'config']) ) ) {
|
||||
require_once('module/search/ressource/defaultdata.php');
|
||||
private function init($moduleId){
|
||||
// Variable commune
|
||||
$fileCSS = self::DATADIRECTORY . $moduleId . '.css' ;
|
||||
|
||||
// Sauver les données par défaut
|
||||
init::$defaultData['style'] = self::DATADIRECTORY . $moduleId . '.css';
|
||||
$this->setData(['module', $moduleId, 'config', init::$defaultData]);
|
||||
// Données du module
|
||||
require_once('module/search/ressource/defaultdata.php');
|
||||
$this->setData(['module', $moduleId, 'config',init::$defaultData ]);
|
||||
// Données de thème
|
||||
$this->setData(['module', $moduleId, 'theme',init::$defaultTheme ]);
|
||||
|
||||
$style = '.searchItem {background:' . $this->getData(['module', $moduleId, 'config', 'keywordColor']). ';}';
|
||||
// Générer la feuille de CSS
|
||||
$style = '.keywordColor {background: ' . $this->getData([ 'module', $moduleId, 'theme', 'keywordColor' ]) . ';}';
|
||||
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATADIRECTORY )) {
|
||||
mkdir (self::DATADIRECTORY , 0777, true);
|
||||
}
|
||||
$success = file_put_contents(self::DATADIRECTORY . $moduleId . '.css' , $style );
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATADIRECTORY)) {
|
||||
mkdir (self::DATADIRECTORY, 0777, true);
|
||||
}
|
||||
|
||||
// Sauver la feuille de style
|
||||
file_put_contents(self::DATADIRECTORY .$moduleId . '.css' , $style );
|
||||
|
||||
// Stocker le nom de la feuille de style
|
||||
$this->setData(['module', $moduleId, 'theme', 'style', self::DATADIRECTORY . $moduleId . '.css']);
|
||||
}
|
||||
|
||||
|
||||
// Configuration vide
|
||||
public function config() {
|
||||
|
||||
// Initialisation d'un nouveau module
|
||||
$this->initCss($this->getUrl(0));
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Initialisation d'un nouveau module
|
||||
if ($this->getData(['module', $this->getUrl(0)]) === null) {
|
||||
$this->init($this->getUrl(0));
|
||||
}
|
||||
|
||||
if($this->isPost()) {
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$style = '.searchItem {background:' . $this->getInput('searchKeywordColor') . ';}';
|
||||
$style = '.keywordColor {background:' . $this->getInput('searchKeywordColor') . ';}';
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATADIRECTORY)) {
|
||||
mkdir (self::DATADIRECTORY , 0777, true);
|
||||
@ -125,9 +146,11 @@ class search extends common {
|
||||
'placeHolder' => $this->getInput('searchPlaceHolder'),
|
||||
'resultHideContent' => $this->getInput('searchResultHideContent',helper::FILTER_BOOLEAN),
|
||||
'previewLength' => $this->getInput('searchPreviewLength',helper::FILTER_INT),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
$this->setData(['module', $this->getUrl(0), 'theme',[
|
||||
'keywordColor' => $this->getInput('searchKeywordColor'),
|
||||
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '.css' : '',
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
|
||||
|
||||
@ -151,12 +174,14 @@ class search extends common {
|
||||
|
||||
public function index() {
|
||||
|
||||
// Initialisation d'un nouveau module
|
||||
$this->initCss($this->getUrl(0));
|
||||
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Initialisation d'un nouveau module
|
||||
if ($this->getData(['module', $this->getUrl(0)]) === null) {
|
||||
$this->init($this->getUrl(0));
|
||||
}
|
||||
|
||||
if($this->isPost()) {
|
||||
//Initialisations variables
|
||||
$success = true;
|
||||
@ -307,7 +332,7 @@ class search extends common {
|
||||
'view' => 'index',
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => !$this->getData(['module', $this->getUrl(0), 'config', 'resultHideContent']),
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'config', 'style'])
|
||||
'style' => $this->getData(['module', $this->getUrl(0), 'theme', 'style'])
|
||||
]);
|
||||
} else {
|
||||
// Valeurs en sortie, affichage du formulaire
|
||||
@ -356,7 +381,7 @@ class search extends common {
|
||||
// Découper l'aperçu
|
||||
$t = substr($contenu, $d ,$this->getData(['module',$this->getUrl(0), 'config', 'previewLength']));
|
||||
// Applique une mise en évidence
|
||||
$t = preg_replace($keywords, '<span class= "searchItem">\1</span>',$t);
|
||||
$t = preg_replace($keywords, '<span class= "keywordColor">\1</span>',$t);
|
||||
// Sauver résultat
|
||||
$resultat .= '<p class="searchResult">'.$t.'...</p>';
|
||||
$resultat .= '<p class="searchTitle">' . count($matches[0]) . (count($matches[0]) === 1 ? ' correspondance<p>' : ' correspondances<p>');
|
||||
|
@ -59,7 +59,7 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence, le placer tout à la gauche pour un surlignement invisible.',
|
||||
'label' => 'Surlignement',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'keywordColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'theme', 'keywordColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user