Thème lié au cours

This commit is contained in:
Fred Tempez 2023-10-04 07:14:35 +02:00
parent 0181843682
commit 928c4337c4
9 changed files with 243 additions and 132 deletions

View File

@ -915,6 +915,10 @@ class layout extends common
'href' => helper::baseUrl() . 'course', 'href' => helper::baseUrl() . 'course',
'help' => 'Cours' 'help' => 'Cours'
]) . '</li>'; ]) . '</li>';
$leftItems .= '<li>' . template::ico('brush', [
'help' => 'Thème',
'href' => helper::baseUrl() . 'theme'
]) . '</li>';
} }
// Liste des pages // Liste des pages
if ($this->getUser('group') >= self::GROUP_EDITOR) { if ($this->getUser('group') >= self::GROUP_EDITOR) {
@ -1043,10 +1047,6 @@ class layout extends common
]) . '</li>'; ]) . '</li>';
} }
if ($this->getUser('group') >= self::GROUP_ADMIN) { if ($this->getUser('group') >= self::GROUP_ADMIN) {
$rightItems .= '<li>' . template::ico('brush', [
'help' => 'Thème',
'href' => helper::baseUrl() . 'theme'
]) . '</li>';
$rightItems .= '<li>' . template::ico('puzzle', [ $rightItems .= '<li>' . template::ico('puzzle', [
'help' => 'Modules', 'help' => 'Modules',
'href' => helper::baseUrl() . 'plugin' 'href' => helper::baseUrl() . 'plugin'

View File

@ -65,9 +65,9 @@ class core extends common
chmod(self::DATA_DIR . 'custom.css', 0755); chmod(self::DATA_DIR . 'custom.css', 0755);
} }
// Crée le fichier de personnalisation // Crée le fichier de personnalisation
if (file_exists(self::DATA_DIR . 'theme.css') === false) { if (file_exists(self::DATA_DIR . self::$siteContent . '/theme.css') === false) {
file_put_contents(self::DATA_DIR . 'theme.css', ''); file_put_contents(self::DATA_DIR . self::$siteContent . '/theme.css', '');
chmod(self::DATA_DIR . 'theme.css', 0755); chmod(self::DATA_DIR . self::$siteContent . '/theme.css', 0755);
} }
// Crée le fichier de personnalisation de l'administration // Crée le fichier de personnalisation de l'administration
if (file_exists(self::DATA_DIR . 'admin.css') === false) { if (file_exists(self::DATA_DIR . 'admin.css') === false) {
@ -76,7 +76,7 @@ class core extends common
} }
// Check la version rafraichissement du theme // Check la version rafraichissement du theme
$cssVersion = preg_split('/\*+/', file_get_contents(self::DATA_DIR . 'theme.css')); $cssVersion = preg_split('/\*+/', file_get_contents(self::DATA_DIR . self::$siteContent . '/theme.css'));
if (empty($cssVersion[1]) or $cssVersion[1] !== md5(json_encode($this->getData(['theme'])))) { if (empty($cssVersion[1]) or $cssVersion[1] !== md5(json_encode($this->getData(['theme'])))) {
// Version // Version
$css = '/*' . md5(json_encode($this->getData(['theme']))) . '*/'; $css = '/*' . md5(json_encode($this->getData(['theme']))) . '*/';
@ -318,7 +318,7 @@ class core extends common
file_put_contents(self::DATA_DIR . 'font/font.html', $fontFile); file_put_contents(self::DATA_DIR . 'font/font.html', $fontFile);
// Enregistre la personnalisation // Enregistre la personnalisation
file_put_contents(self::DATA_DIR . 'theme.css', $css); file_put_contents(self::DATA_DIR . self::$siteContent . '/theme.css', $css);
// Effacer le cache pour tenir compte de la couleur de fond TinyMCE // Effacer le cache pour tenir compte de la couleur de fond TinyMCE
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT"); header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");

View File

@ -220,7 +220,6 @@ class common
'course' => '', 'course' => '',
'core' => '', 'core' => '',
'font' => '', 'font' => '',
'theme' => '',
'user' => '', 'user' => '',
'language' => '', 'language' => '',
'profil' => '', 'profil' => '',
@ -231,6 +230,7 @@ class common
private $contentFiles = [ private $contentFiles = [
'page' => '', 'page' => '',
'module' => '', 'module' => '',
'theme' => '',
]; ];
public static $fontsWebSafe = [ public static $fontsWebSafe = [

View File

@ -14,7 +14,7 @@
<?php $layout->showFonts(); ?> <?php $layout->showFonts(); ?>
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/blank.css"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/blank.css">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>theme.css?<?php echo md5_file(self::DATA_DIR.'theme.css'); ?>"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR . self::$siteContent; ?>/theme.css?<?php echo md5_file(self::DATA_DIR. self::$siteContent . '/theme.css'); ?>">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR.'custom.css'); ?>"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR.'custom.css'); ?>">
</head> </head>
<body> <body>

View File

@ -14,7 +14,7 @@
<?php $layout->showFonts(); ?> <?php $layout->showFonts(); ?>
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/light.css"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/light.css">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>theme.css?<?php echo md5_file(self::DATA_DIR.'theme.css'); ?>"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR . self::$siteContent; ?>/theme.css?<?php echo md5_file(self::DATA_DIR. self::$siteContent . '/theme.css'); ?>">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR.'custom.css'); ?>"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR.'custom.css'); ?>">
</head> </head>
<body> <body>

View File

@ -14,7 +14,7 @@
<?php $layout->showVendor(); ?> <?php $layout->showVendor(); ?>
<?php $layout->showFonts(); ?> <?php $layout->showFonts(); ?>
<link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css?<?php echo md5_file('core/layout/common.css'); ?>"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false); ?>core/layout/common.css?<?php echo md5_file('core/layout/common.css'); ?>">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>theme.css?<?php echo md5_file(self::DATA_DIR . 'theme.css'); ?>"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR . self::$siteContent; ?>/theme.css?<?php echo md5_file(self::DATA_DIR . self::$siteContent . '/theme.css'); ?>">
<link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR . 'custom.css'); ?>"> <link rel="stylesheet" href="<?php echo helper::baseUrl(false) . self::DATA_DIR; ?>custom.css?<?php echo md5_file(self::DATA_DIR . 'custom.css'); ?>">
<!-- Détection RSS --> <!-- Détection RSS -->
<?php if (($this->getData(['page', $this->getUrl(0), 'moduleId']) === 'blog' <?php if (($this->getData(['page', $this->getUrl(0), 'moduleId']) === 'blog'

View File

@ -175,116 +175,6 @@ class init extends common
] ]
], ],
'user' => [], 'user' => [],
'theme' => [
'body' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
'image' => '',
'imageAttachment' => 'scroll',
'imageRepeat' => 'no-repeat',
'imagePosition' => 'top center',
'imageSize' => 'auto',
'toTopbackgroundColor' => 'rgba(33, 34, 35, .8)',
'toTopColor' => 'rgba(255, 255, 255, 1)'
],
'footer' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'georgia',
'fontSize' => '.8em',
'fontWeight' => 'normal',
'height' => '5px',
'loginLink' => true,
'margin' => true,
'position' => 'site',
'textColor' => 'rgba(33, 34, 35, 1)',
'copyrightPosition' => 'right',
'copyrightAlign' => 'right',
'text' => '<p>Pied de page personnalisé</p>',
'textPosition' => 'left',
'textAlign' => 'left',
'textTransform' => 'none',
'socialsPosition' => 'center',
'socialsAlign' => 'center',
'displayVersion' => true,
'displaySiteMap' => true,
'displayCopyright' => false,
'displayCookie' => false,
'displayLegal' => false,
'displaySearch' => false,
'memberBar' => true,
'template' => '3'
],
'header' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'font' => 'arial',
'fontSize' => '2em',
'fontWeight' => 'normal',
'height' => '150px',
'image' => 'banniere960.jpg',
'imagePosition' => 'center center',
'imageRepeat' => 'no-repeat',
'margin' => false,
'position' => 'site',
'textAlign' => 'center',
'textColor' => 'rgba(255, 255, 255, 1)',
'textHide' => false,
'textTransform' => 'none',
'linkHomePage' => true,
'imageContainer' => 'auto',
'tinyHidden' => true,
'feature' => 'wallpaper',
'featureContent' => '<p>Bannière vide</p>',
'width' => 'container'
],
'menu' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'backgroundColorSub' => 'rgba(32, 59, 82, 1)',
'font' => 'arial',
'fontSize' => '1em',
'fontWeight' => 'normal',
'height' => '15px 10px',
'loginLink' => false,
'margin' => false,
'position' => 'site-second',
'textAlign' => 'left',
'textColor' => 'rgba(255, 255, 255, 1)',
'textTransform' => 'none',
'fixed' => false,
'activeColorAuto' => true,
'activeColor' => 'rgba(255, 255, 255, 1)',
'activeTextColor' => 'rgba(255, 255, 255, 1)',
'radius' => '0px',
'memberBar' => false,
'burgerLogo' => '',
'burgerContent' => 'title',
'width' => 'container'
],
'site' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'radius' => '0px',
'shadow' => '0px 0px 0px',
'width' => '960px'
],
'block' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
'borderColor' => 'rgba(236, 239, 241, 1)'
],
'text' => [
'font' => 'georgia',
'fontSize' => '13px',
'textColor' => 'rgba(33, 34, 35, 1)',
'linkColor' => 'rgba(74, 105, 189, 1)'
],
'title' => [
'font' => 'arial',
'fontWeight' => 'normal',
'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none'
],
'button' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)'
],
'version' => 0
],
'admin' => [ 'admin' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)', 'backgroundColor' => 'rgba(255, 255, 255, 1)',
'fontText' => 'georgia', 'fontText' => 'georgia',
@ -865,6 +755,116 @@ class init extends common
'js' => '' 'js' => ''
] ]
], ],
'theme' => [
'body' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
'image' => '',
'imageAttachment' => 'scroll',
'imageRepeat' => 'no-repeat',
'imagePosition' => 'top center',
'imageSize' => 'auto',
'toTopbackgroundColor' => 'rgba(33, 34, 35, .8)',
'toTopColor' => 'rgba(255, 255, 255, 1)'
],
'footer' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'georgia',
'fontSize' => '.8em',
'fontWeight' => 'normal',
'height' => '5px',
'loginLink' => true,
'margin' => true,
'position' => 'site',
'textColor' => 'rgba(33, 34, 35, 1)',
'copyrightPosition' => 'right',
'copyrightAlign' => 'right',
'text' => '<p>Pied de page personnalisé</p>',
'textPosition' => 'left',
'textAlign' => 'left',
'textTransform' => 'none',
'socialsPosition' => 'center',
'socialsAlign' => 'center',
'displayVersion' => true,
'displaySiteMap' => true,
'displayCopyright' => false,
'displayCookie' => false,
'displayLegal' => false,
'displaySearch' => false,
'memberBar' => true,
'template' => '3'
],
'header' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'font' => 'arial',
'fontSize' => '2em',
'fontWeight' => 'normal',
'height' => '150px',
'image' => 'banniere960.jpg',
'imagePosition' => 'center center',
'imageRepeat' => 'no-repeat',
'margin' => false,
'position' => 'site',
'textAlign' => 'center',
'textColor' => 'rgba(255, 255, 255, 1)',
'textHide' => false,
'textTransform' => 'none',
'linkHomePage' => true,
'imageContainer' => 'auto',
'tinyHidden' => true,
'feature' => 'wallpaper',
'featureContent' => '<p>Bannière vide</p>',
'width' => 'container'
],
'menu' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'backgroundColorSub' => 'rgba(32, 59, 82, 1)',
'font' => 'arial',
'fontSize' => '1em',
'fontWeight' => 'normal',
'height' => '15px 10px',
'loginLink' => false,
'margin' => false,
'position' => 'site-second',
'textAlign' => 'left',
'textColor' => 'rgba(255, 255, 255, 1)',
'textTransform' => 'none',
'fixed' => false,
'activeColorAuto' => true,
'activeColor' => 'rgba(255, 255, 255, 1)',
'activeTextColor' => 'rgba(255, 255, 255, 1)',
'radius' => '0px',
'memberBar' => false,
'burgerLogo' => '',
'burgerContent' => 'title',
'width' => 'container'
],
'site' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'radius' => '0px',
'shadow' => '0px 0px 0px',
'width' => '960px'
],
'block' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
'borderColor' => 'rgba(236, 239, 241, 1)'
],
'text' => [
'font' => 'georgia',
'fontSize' => '13px',
'textColor' => 'rgba(33, 34, 35, 1)',
'linkColor' => 'rgba(74, 105, 189, 1)'
],
'title' => [
'font' => 'arial',
'fontWeight' => 'normal',
'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none'
],
'button' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)'
],
'version' => 0
],
'module' => [ 'module' => [
'contact' => [ 'contact' => [
'config' => [ 'config' => [
@ -1009,7 +1009,118 @@ class init extends common
'js' => '' 'js' => ''
], ],
], ],
'module' => [] 'theme' => [
'body' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
'image' => '',
'imageAttachment' => 'scroll',
'imageRepeat' => 'no-repeat',
'imagePosition' => 'top center',
'imageSize' => 'auto',
'toTopbackgroundColor' => 'rgba(33, 34, 35, .8)',
'toTopColor' => 'rgba(255, 255, 255, 1)'
],
'footer' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'georgia',
'fontSize' => '.8em',
'fontWeight' => 'normal',
'height' => '5px',
'loginLink' => true,
'margin' => true,
'position' => 'site',
'textColor' => 'rgba(33, 34, 35, 1)',
'copyrightPosition' => 'right',
'copyrightAlign' => 'right',
'text' => '<p>Pied de page personnalisé</p>',
'textPosition' => 'left',
'textAlign' => 'left',
'textTransform' => 'none',
'socialsPosition' => 'center',
'socialsAlign' => 'center',
'displayVersion' => true,
'displaySiteMap' => true,
'displayCopyright' => false,
'displayCookie' => false,
'displayLegal' => false,
'displaySearch' => false,
'memberBar' => true,
'template' => '3'
],
'header' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'font' => 'arial',
'fontSize' => '2em',
'fontWeight' => 'normal',
'height' => '150px',
'image' => 'banniere960.jpg',
'imagePosition' => 'center center',
'imageRepeat' => 'no-repeat',
'margin' => false,
'position' => 'site',
'textAlign' => 'center',
'textColor' => 'rgba(255, 255, 255, 1)',
'textHide' => false,
'textTransform' => 'none',
'linkHomePage' => true,
'imageContainer' => 'auto',
'tinyHidden' => true,
'feature' => 'wallpaper',
'featureContent' => '<p>Bannière vide</p>',
'width' => 'container'
],
'menu' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'backgroundColorSub' => 'rgba(32, 59, 82, 1)',
'font' => 'arial',
'fontSize' => '1em',
'fontWeight' => 'normal',
'height' => '15px 10px',
'loginLink' => false,
'margin' => false,
'position' => 'site-second',
'textAlign' => 'left',
'textColor' => 'rgba(255, 255, 255, 1)',
'textTransform' => 'none',
'fixed' => false,
'activeColorAuto' => true,
'activeColor' => 'rgba(255, 255, 255, 1)',
'activeTextColor' => 'rgba(255, 255, 255, 1)',
'radius' => '0px',
'memberBar' => false,
'burgerLogo' => '',
'burgerContent' => 'title',
'width' => 'container'
],
'site' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'radius' => '0px',
'shadow' => '0px 0px 0px',
'width' => '960px'
],
'block' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
'borderColor' => 'rgba(236, 239, 241, 1)'
],
'text' => [
'font' => 'georgia',
'fontSize' => '13px',
'textColor' => 'rgba(33, 34, 35, 1)',
'linkColor' => 'rgba(74, 105, 189, 1)'
],
'title' => [
'font' => 'arial',
'fontWeight' => 'normal',
'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none'
],
'button' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)'
],
'version' => 0
],
'module' => [
],
]; ];
public static $courseContent = [ public static $courseContent = [

View File

@ -1043,8 +1043,8 @@ class theme extends common
// Archive de thème ? // Archive de thème ?
if ( if (
file_exists(self::TEMP_DIR . $tempFolder . '/site/data/custom.css') file_exists(self::TEMP_DIR . $tempFolder . '/site/data/custom.css')
and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.css') and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/' . self::$siteContent . '/theme.css')
and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.json') and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/' . self::$siteContent . '/theme.json')
) { ) {
$modele = 'theme'; $modele = 'theme';
} }
@ -1064,9 +1064,9 @@ class theme extends common
// Un remplacement nécessite la régénération de la feuille de style // Un remplacement nécessite la régénération de la feuille de style
if ( if (
$c > 0 $c > 0
and file_exists(self::DATA_DIR . 'theme.css') and file_exists(self::DATA_DIR . self::$siteContent . 'theme.css')
) { ) {
unlink(self::DATA_DIR . 'theme.css'); unlink(self::DATA_DIR . self::$siteContent . 'theme.css');
} }
} }
if ($modele = 'admin') { if ($modele = 'admin') {
@ -1192,7 +1192,7 @@ class theme extends common
break; break;
case 'theme': case 'theme':
$zip->addFile(self::DATA_DIR . 'theme.json', self::DATA_DIR . 'theme.json'); $zip->addFile(self::DATA_DIR . 'theme.json', self::DATA_DIR . 'theme.json');
$zip->addFile(self::DATA_DIR . 'theme.css', self::DATA_DIR . 'theme.css'); $zip->addFile(self::DATA_DIR . self::$siteContent . 'theme.css', self::DATA_DIR . self::$siteContent . 'theme.css');
$zip->addFile(self::DATA_DIR . 'custom.css', self::DATA_DIR . 'custom.css'); $zip->addFile(self::DATA_DIR . 'custom.css', self::DATA_DIR . 'custom.css');
// Traite l'image dans le body // Traite l'image dans le body
if ($this->getData(['theme', 'body', 'image']) !== '') { if ($this->getData(['theme', 'body', 'image']) !== '') {

View File

@ -94,8 +94,8 @@ tinymce.init({
content_css: [ content_css: [
baseUrl + "core/layout/common.css", baseUrl + "core/layout/common.css",
baseUrl + "core/vendor/tinymce/content.css", baseUrl + "core/vendor/tinymce/content.css",
baseUrl + "site/data/theme.css", baseUrl + "site/data/home/theme.css",
baseUrl + "site/data/custom.css" baseUrl + "site/data/home/custom.css"
], ],
// Classe à ajouter à la balise body dans l'iframe // Classe à ajouter à la balise body dans l'iframe
body_class: "editorWysiwyg", body_class: "editorWysiwyg",
@ -277,7 +277,7 @@ tinymce.init({
content_css: [ content_css: [
baseUrl + "core/layout/common.css", baseUrl + "core/layout/common.css",
baseUrl + "core/vendor/tinymce/content.css", baseUrl + "core/vendor/tinymce/content.css",
baseUrl + "site/data/theme.css", baseUrl + "site/data/home/theme.css",
baseUrl + "site/data/custom.css" baseUrl + "site/data/custom.css"
], ],
// Classe à ajouter à la balise body dans l'iframe // Classe à ajouter à la balise body dans l'iframe