093 Personnalisation administration : reste à faire la couleur des blocs et l'aperçu.

This commit is contained in:
Fred Tempez 2020-05-16 22:15:16 +02:00
parent 85423bbf2c
commit e1f4a6dc8c
6 changed files with 226 additions and 13 deletions

View File

@ -1525,7 +1525,7 @@ class core extends common {
$cssVersion = preg_split('/\*+/', file_get_contents(self::DATA_DIR.'admin.css'));
if(empty($cssVersion[1]) OR $cssVersion[1] !== md5(json_encode($this->getData(['admin'])))) {
// Version
$css = '/*' . md5(json_encode($this->getData(['theme','admin']))) . '*/';
$css = '/*' . md5(json_encode($this->getData(['admin']))) . '*/';
$css .= '#site{background-color:' . $this->getData(['admin','backgroundColor']) . ';}';
$css .= 'body, .row > div {font:' . $this->getData(['admin','fontSize']) . ' "' . $this->getData(['admin','font']) . '", sans-serif;}';
$css .= 'body h1, h2, h3, h4, h5, h6 {font-family:' . $this->getData(['admin','fontTitle' ]) . ', sans-serif;color:' . $this->getData(['admin','colorTitle' ]) . ';}';

View File

@ -24,7 +24,9 @@ class theme extends common {
'index' => self::GROUP_ADMIN,
'menu' => self::GROUP_ADMIN,
'reset' => self::GROUP_ADMIN,
'resetAdmin' => self::GROUP_ADMIN,
'site' => self::GROUP_ADMIN,
'admin' => self::GROUP_ADMIN,
'manage' => self::GROUP_ADMIN,
'export' => self::GROUP_ADMIN,
'save' => self::GROUP_ADMIN
@ -238,6 +240,42 @@ class theme extends common {
'4' => 'Trois lignes superposées'
];
/**
* Thème des écrans d'administration
*/
public function admin() {
// Soumission du formulaire
if($this->isPost()) {
$this->setData(['admin', [
'backgroundColor' => $this->getInput('themeAdminBackgroundColor'),
'colorTitle' => $this->getInput('themeAdmincolorTitle'),
'colorText' => $this->getInput('themeAdmincolorText'),
'colorButtonText' => $this->getInput('themeAdmincolorButtonText'),
'backgroundColorButton' => $this->getInput('themeAdmincolorButton'),
'backgroundColorButtonGrey' => $this->getInput('themeAdmincolorGrey'),
'backgroundColorButtonRed' => $this->getInput('themeAdmincolorRed'),
'backgroundColorButtonGreen'=> $this->getInput('themeAdmincolorGreen'),
'font' => $this->getInput('themeFont'),
'fontSize' => $this->getInput('themeTextFontSize'),
'fontTitle' => $this->getInput('themeFontTitle')
]]);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées',
'redirect' => helper::baseUrl() . 'theme/admin',
'state' => true
]);
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Administration',
'view' => 'admin',
'vendor' => [
'tinycolorpicker'
],
]);
}
/**
* Mode avancé
*/
@ -497,6 +535,20 @@ class theme extends common {
]);
}
/**
* Réinitialisation de la personnalisation avancée
*/
public function resetAdmin() {
// Supprime le fichier de personnalisation avancée
unlink(self::DATA_DIR.'admin.json');
// Valeurs en sortie
$this->addOutput([
'notification' => 'Thème réinitialisé',
'redirect' => helper::baseUrl() . 'theme/admin',
'state' => true
]);
}
/**
* Options du site
*/

View File

@ -0,0 +1,16 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.com/
*/
/* Thème administration */
@import url("site/data/admin.css");

View File

@ -0,0 +1,130 @@
<?php echo template::formOpen('configAdminForm'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('configAdminBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'theme',
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::button('configAdminReset', [
'class' => 'buttonRed',
'href' => helper::baseUrl() . 'theme/resetAdmin',
'value' => 'Réinitialiser'
]); ?>
</div>
<div class="col2">
<?php echo template::submit('configAdminSubmit',[
'value' => 'valider',
'ico' => 'check'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Couleurs</h4>
<div class="row">
<div class="col3">
<?php echo template::text('themeAdminBackgroundColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Arrière-plan',
'value' => $this->getData(['admin', 'backgroundColor'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('themeAdmincolorTitle', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Titres',
'value' => $this->getData(['admin', 'colorTitle'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('themeAdmincolorText', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Texte',
'value' => $this->getData(['admin', 'colorText'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('themeAdmincolorButtonText', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Texte des boutons',
'value' => $this->getData(['admin', 'colorButtonText'])
]); ?>
</div>
</div>
<div class="row">
<div class="col3">
<?php echo template::text('themeAdmincolorButton', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Bouton standard',
'value' => $this->getData(['admin', 'backgroundColorButton'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('themeAdmincolorGrey', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Bouton retour',
'value' => $this->getData(['admin', 'backgroundColorButtonGrey'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('themeAdmincolorRed', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Bouton effacement',
'value' => $this->getData(['admin', 'backgroundColorButtonRed'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('themeAdmincolorGreen', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Bouton validation',
'value' => $this->getData(['admin', 'backgroundColorButtonGreen'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Mise en forme du texte</h4>
<div class="row">
<div class="col4">
<?php echo template::select('themeFont', $module::$fonts, [
'label' => 'Police du texte',
'selected' => $this->getData(['admin', 'font']),
'fonts' => true
]); ?>
</div>
<div class="col4">
<?php echo template::select('themeTextFontSize', $module::$siteFontSizes, [
'label' => 'Taille',
'selected' => $this->getData(['admin', 'fontSize'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('themeFontTitle', $module::$fonts, [
'label' => 'Police des titres',
'selected' => $this->getData(['admin', 'fontTitle']),
'fonts' => true
]); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -33,6 +33,7 @@ nav li ul {
#themeShowAll,
#themeBack,
#themeManage,
#themeAdmin,
#themeAdvanced {
position: relative;
z-index: 11;

View File

@ -5,7 +5,7 @@
): ?>
<?php echo template::speech('Cliquez sur une zone afin d\'accéder à ses options de personnalisation. Vous pouvez également afficher les zones cachées à l\'aide du bouton ci-dessous.'); ?>
<div class="row">
<div class="col2 offset2">
<div class="col2 offset1">
<?php echo template::button('themeBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl(false),
@ -13,13 +13,6 @@
'value' => 'Accueil'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeManage', [
'ico' => 'upload',
'href' => helper::baseUrl() . $this->getUrl(0) . '/manage',
'value' => 'Thèmes'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeAdvanced', [
'ico' => 'code',
@ -27,6 +20,20 @@
'value' => 'Éditeur CSS'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeManage', [
'ico' => 'upload',
'href' => helper::baseUrl() . $this->getUrl(0) . '/manage',
'value' => 'Importer'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeAdmin', [
'ico' => 'pencil',
'href' => helper::baseUrl() . $this->getUrl(0) . '/admin',
'value' => 'Administration'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeShowAll', [
'ico' => 'eye',
@ -37,7 +44,7 @@
<?php else: ?>
<?php echo template::speech('Cliquez sur une zone afin d\'accéder à ses options de personnalisation.'); ?>
<div class="row">
<div class="col2 offset3">
<div class="col2 offset2">
<?php echo template::button('themeBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl(false),
@ -45,11 +52,18 @@
'value' => 'Accueil'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeAdmin', [
'ico' => 'pencil',
'href' => helper::baseUrl() . $this->getUrl(0) . '/admin',
'value' => 'Administration'
]); ?>
</div>
<div class="col2">
<?php echo template::button('themeManage', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/manage',
'ico' => 'upload',
'value' => 'Thèmes'
'value' => 'Importer'
]); ?>
</div>
<div class="col2">