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