bug modif theme + init feuille de style
This commit is contained in:
parent
90ad9f29fb
commit
650ae755be
@ -149,15 +149,13 @@ class gallery extends common {
|
||||
*/
|
||||
private function update() {
|
||||
|
||||
// Installation des données de la galerie d'exemple
|
||||
// Installation des données par défaut
|
||||
$class = get_called_class();
|
||||
$moduleId = $this->getUrl(0);
|
||||
if ( $this->getData(['module', $this->getUrl(0), 'config',]) === null ) {
|
||||
require_once('module/gallery/ressource/defaultdata.php');
|
||||
$this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]);
|
||||
|
||||
// Générer la feuille de CSS du modèle par défaut
|
||||
$class = get_called_class();
|
||||
$moduleId = $this->getUrl(0);
|
||||
|
||||
// Dossier de l'instance
|
||||
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
|
||||
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
|
||||
@ -166,31 +164,31 @@ class gallery extends common {
|
||||
// Nom de la feuille de style
|
||||
$fileCSS = self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' ;
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'style', $fileCSS]);
|
||||
|
||||
if (!file_exists(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' )) {
|
||||
// Générer la feuille de CSS
|
||||
// Création des fichiers 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', $this->getUrl(0), 'config', 'thumbAlign']),$content );
|
||||
$content = str_replace('#thumbWidth#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbWidth']),$content );
|
||||
$content = str_replace('#thumbHeight#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbHeight']),$content );
|
||||
$content = str_replace('#thumbMargin#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbMargin']),$content );
|
||||
$content = str_replace('#thumbBorder#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbBorder']),$content );
|
||||
$content = str_replace('#thumbBorderColor#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbBorderColor']),$content );
|
||||
$content = str_replace('#thumbOpacity#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbOpacity']),$content );
|
||||
$content = str_replace('#thumbShadows#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbShadows']),$content );
|
||||
$content = str_replace('#thumbShadowsColor#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbShadowsColor']),$content );
|
||||
$content = str_replace('#thumbRadius#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbRadius']),$content );
|
||||
$content = str_replace('#legendAlign#',$this->getData(['module', $this->getUrl(0), 'config', 'legendAlign']),$content );
|
||||
$content = str_replace('#legendHeight#',$this->getData(['module', $this->getUrl(0), 'config', 'legendHeight']),$content );
|
||||
$content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendTextColor']),$content );
|
||||
$content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendBgColor']),$content );
|
||||
// Ecriture de la feuille de style
|
||||
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $content . $themeCss);
|
||||
}
|
||||
}
|
||||
|
||||
// Générer la feuille de CSS
|
||||
if (!file_exists(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.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', $this->getUrl(0), 'config', 'thumbAlign']),$content );
|
||||
$content = str_replace('#thumbWidth#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbWidth']),$content );
|
||||
$content = str_replace('#thumbHeight#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbHeight']),$content );
|
||||
$content = str_replace('#thumbMargin#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbMargin']),$content );
|
||||
$content = str_replace('#thumbBorder#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbBorder']),$content );
|
||||
$content = str_replace('#thumbBorderColor#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbBorderColor']),$content );
|
||||
$content = str_replace('#thumbOpacity#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbOpacity']),$content );
|
||||
$content = str_replace('#thumbShadows#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbShadows']),$content );
|
||||
$content = str_replace('#thumbShadowsColor#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbShadowsColor']),$content );
|
||||
$content = str_replace('#thumbRadius#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbRadius']),$content );
|
||||
$content = str_replace('#legendAlign#',$this->getData(['module', $this->getUrl(0), 'config', 'legendAlign']),$content );
|
||||
$content = str_replace('#legendHeight#',$this->getData(['module', $this->getUrl(0), 'config', 'legendHeight']),$content );
|
||||
$content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendTextColor']),$content );
|
||||
$content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendBgColor']),$content );
|
||||
// Ecriture de la feuille de style
|
||||
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $content . $themeCss);
|
||||
}
|
||||
|
||||
// Mise à jour d'une version inférieure
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) {
|
||||
// Changement de l'arborescence dans module.json
|
||||
|
@ -25,25 +25,25 @@
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeThumbWidth', $module::$galleryThemeSizeWidth, [
|
||||
'label' => 'Largeur',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbWidth'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeThumbHeight', $module::$galleryThemeSizeHeight, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbHeight'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbHeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbAlign', $module::$galleryThemeFlexAlign, [
|
||||
'label' => 'Alignement',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbAlign'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::select('galleryThemeThumbMargin', $module::$galleryThemeMargin, [
|
||||
'label' => 'Marge',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbMargin'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbMargin'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -51,7 +51,7 @@
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbBorder', $module::$galleryThemeBorder, [
|
||||
'label' => 'Bordure',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbBorder'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','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(['theme', 'gallery','thumbBorderColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','thumbBorderColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbRadius', $module::$galleryThemeRadius, [
|
||||
'label' => 'Arrondi des angles',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbRadius'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbRadius'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -73,7 +73,7 @@
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbShadows', $module::$galleryThemeShadows, [
|
||||
'label' => 'Ombre',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbShadows'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','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(['theme', 'gallery','thumbShadowsColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','thumbShadowsColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('galleryThemeThumbOpacity', $module::$galleryThemeOpacity, [
|
||||
'label' => 'Opacité au survol',
|
||||
'selected' => $this->getData(['theme', 'gallery','thumbOpacity'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','thumbOpacity'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -108,7 +108,7 @@
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Texte',
|
||||
'value' => $this->getData(['theme', 'gallery','legendTextColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','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(['theme', 'gallery','legendBgColor'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config','legendBgColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeLegendHeight', $module::$galleryThemeLegendHeight, [
|
||||
'label' => 'Hauteur',
|
||||
'selected' => $this->getData(['theme', 'gallery','legendHeight'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','legendHeight'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryThemeLegendAlign', $module::$galleryThemeAlign, [
|
||||
'label' => 'Alignement',
|
||||
'selected' => $this->getData(['theme', 'gallery','legendAlign'])
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config','legendAlign'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user