2018-04-02 08:29:19 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* @license GNU General Public License, version 3
|
2019-01-22 14:36:13 +01:00
|
|
|
* @link http://zwiicms.com/
|
|
|
|
* @copyright : Frédéric Tempez <frederic.tempez@outlook.com>
|
|
|
|
* @copyright Copyright (C) 2018-2019, Frédéric Tempez
|
2018-04-02 08:29:19 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
class theme extends common {
|
|
|
|
|
|
|
|
public static $actions = [
|
|
|
|
'advanced' => self::GROUP_ADMIN,
|
|
|
|
'body' => self::GROUP_ADMIN,
|
|
|
|
'footer' => self::GROUP_ADMIN,
|
|
|
|
'header' => self::GROUP_ADMIN,
|
|
|
|
'index' => self::GROUP_ADMIN,
|
|
|
|
'menu' => self::GROUP_ADMIN,
|
|
|
|
'reset' => self::GROUP_ADMIN,
|
2018-12-25 16:24:20 +01:00
|
|
|
'site' => self::GROUP_ADMIN,
|
|
|
|
'manage' => self::GROUP_ADMIN,
|
2018-12-25 18:38:17 +01:00
|
|
|
'export' => self::GROUP_ADMIN,
|
2018-12-28 16:52:58 +01:00
|
|
|
'save' => self::GROUP_ADMIN
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $aligns = [
|
|
|
|
'left' => 'À gauche',
|
|
|
|
'center' => 'Au centre',
|
|
|
|
'right' => 'À droite'
|
|
|
|
];
|
|
|
|
public static $attachments = [
|
|
|
|
'scroll' => 'Normale',
|
|
|
|
'fixed' => 'Fixe'
|
|
|
|
];
|
|
|
|
public static $fonts = [
|
|
|
|
'Abril+Fatface' => 'Abril Fatface',
|
|
|
|
'Arimo' => 'Arimo',
|
|
|
|
'Arvo' => 'Arvo',
|
|
|
|
'Berkshire+Swash' => 'Berkshire Swash',
|
|
|
|
'Cabin' => 'Cabin',
|
|
|
|
'Dancing+Script' => 'Dancing Script',
|
|
|
|
'Droid+Sans' => 'Droid Sans',
|
|
|
|
'Droid+Serif' => 'Droid Serif',
|
|
|
|
'Fira+Sans' => 'Fira Sans',
|
|
|
|
'Inconsolata' => 'Inconsolata',
|
|
|
|
'Indie+Flower' => 'Indie Flower',
|
|
|
|
'Josefin+Slab' => 'Josefin Slab',
|
|
|
|
'Lobster' => 'Lobster',
|
|
|
|
'Lora' => 'Lora',
|
|
|
|
'Lato' => 'Lato',
|
|
|
|
'Marvel' => 'Marvel',
|
|
|
|
'Old+Standard+TT' => 'Old Standard TT',
|
|
|
|
'Open+Sans' => 'Open Sans',
|
|
|
|
'Oswald' => 'Oswald',
|
|
|
|
'PT+Mono' => 'PT Mono',
|
|
|
|
'PT+Serif' => 'PT Serif',
|
|
|
|
'Raleway' => 'Raleway',
|
|
|
|
'Rancho' => 'Rancho',
|
|
|
|
'Roboto' => 'Roboto',
|
|
|
|
'Signika' => 'Signika',
|
|
|
|
'Ubuntu' => 'Ubuntu',
|
|
|
|
'Vollkorn' => 'Vollkorn'
|
|
|
|
];
|
2018-09-09 21:28:05 +02:00
|
|
|
public static $footerblocks = [
|
2018-09-22 19:09:20 +02:00
|
|
|
'hide' => 'Masqué',
|
|
|
|
'left' => 'Bloc Gauche',
|
|
|
|
'center' => 'Bloc Central',
|
|
|
|
'right' => 'Bloc Droite'
|
2018-09-09 21:28:05 +02:00
|
|
|
];
|
2018-04-02 08:29:19 +02:00
|
|
|
public static $fontWeights = [
|
|
|
|
'normal' => 'Normal',
|
|
|
|
'bold' => 'Gras'
|
|
|
|
];
|
|
|
|
public static $footerHeights = [
|
2019-01-19 23:37:36 +01:00
|
|
|
'0px' => 'Très petite',
|
2019-03-05 14:14:40 +01:00
|
|
|
'10px' => 'Petite',
|
|
|
|
'20px' => 'Moyenne',
|
|
|
|
'35px' => 'Grande',
|
|
|
|
'40px' => 'Très grande'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $footerPositions = [
|
|
|
|
'hide' => 'Cachée',
|
|
|
|
'site' => 'Dans le site',
|
|
|
|
'body' => 'En dessous du site'
|
|
|
|
];
|
2019-03-19 06:59:28 +01:00
|
|
|
public static $footerFontSizes = [
|
|
|
|
'.8em' => 'Très petite',
|
|
|
|
'.9em' => 'Petite',
|
|
|
|
'1em' => 'Normale',
|
|
|
|
'1.1em' => 'Moyenne',
|
|
|
|
'1.2em' => 'Grande',
|
|
|
|
'1.3em' => 'Très grande'
|
|
|
|
];
|
2018-04-02 08:29:19 +02:00
|
|
|
public static $headerFontSizes = [
|
|
|
|
'1.6em' => 'Très petite',
|
|
|
|
'1.8em' => 'Petite',
|
|
|
|
'2em' => 'Moyenne',
|
|
|
|
'2.2em' => 'Grande',
|
2018-11-14 18:51:29 +01:00
|
|
|
'2.4vmax' => 'Très grande'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $headerHeights = [
|
|
|
|
'100px' => 'Très petite (100 pixels)',
|
|
|
|
'150px' => 'Petite (150 pixels)',
|
|
|
|
'200px' => 'Moyenne (200 pixels)',
|
|
|
|
'300px' => 'Grande (300 pixels)',
|
|
|
|
'400px' => 'Très grande (400 pixels)'
|
|
|
|
];
|
|
|
|
public static $headerPositions = [
|
2019-03-12 09:30:22 +01:00
|
|
|
'body' => 'Au dessus du site',
|
2018-04-02 08:29:19 +02:00
|
|
|
'site' => 'Dans le site',
|
2019-03-12 09:30:22 +01:00
|
|
|
'hide' => 'Cachée'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
|
|
|
public static $imagePositions = [
|
|
|
|
'top left' => 'En haut à gauche',
|
|
|
|
'top center' => 'En haut au centre',
|
|
|
|
'top right' => 'En haut à droite',
|
|
|
|
'center left' => 'Au milieu à gauche',
|
|
|
|
'center center' => 'Au milieu au centre',
|
|
|
|
'center right' => 'Au milieu à droite',
|
|
|
|
'bottom left' => 'En bas à gauche',
|
|
|
|
'bottom center' => 'En bas au centre',
|
|
|
|
'bottom right' => 'En bas à droite'
|
|
|
|
];
|
|
|
|
public static $menuFontSizes = [
|
|
|
|
'.8em' => 'Très petite',
|
|
|
|
'.9em' => 'Petite',
|
|
|
|
'1em' => 'Normale',
|
|
|
|
'1.1em' => 'Moyenne',
|
|
|
|
'1.2em' => 'Grande',
|
|
|
|
'1.3em' => 'Très grande'
|
|
|
|
];
|
|
|
|
public static $menuHeights = [
|
|
|
|
'5px 10px' => 'Très petite',
|
|
|
|
'10px' => 'Petite',
|
|
|
|
'15px 10px' => 'Moyenne',
|
|
|
|
'20px 15px' => 'Grande',
|
|
|
|
'25px 15px' => 'Très grande'
|
|
|
|
];
|
2019-02-07 17:26:39 +01:00
|
|
|
public static $menuPositionsSite = [
|
|
|
|
'top' => 'En-dehors du site',
|
2019-03-12 09:30:22 +01:00
|
|
|
'site-first' => 'Avant la bannière',
|
|
|
|
'site-second' => 'Après la bannière',
|
2018-08-31 22:35:39 +02:00
|
|
|
'hide' => 'Caché'
|
2018-04-02 08:29:19 +02:00
|
|
|
];
|
2018-08-31 22:35:39 +02:00
|
|
|
public static $menuPositionsBody = [
|
2019-03-12 09:30:22 +01:00
|
|
|
'top' => 'En-dehors du site',
|
|
|
|
'body-first' => 'Avant la bannière',
|
|
|
|
'body-second' => 'Après la bannière',
|
2019-03-12 09:18:31 +01:00
|
|
|
'site' => 'Dans le site',
|
2018-08-31 22:35:39 +02:00
|
|
|
'hide' => 'Caché'
|
|
|
|
];
|
2018-04-02 08:29:19 +02:00
|
|
|
public static $radius = [
|
|
|
|
'0' => 'Aucun',
|
|
|
|
'5px' => 'Très léger',
|
|
|
|
'10px' => 'Léger',
|
|
|
|
'15px' => 'Moyen',
|
|
|
|
'25px' => 'Important',
|
|
|
|
'50px' => 'Très important'
|
|
|
|
];
|
|
|
|
public static $repeats = [
|
|
|
|
'no-repeat' => 'Ne pas répéter',
|
|
|
|
'repeat-x' => 'Sur l\'axe horizontal',
|
|
|
|
'repeat-y' => 'Sur l\'axe vertical',
|
|
|
|
'repeat' => 'Sur les deux axes'
|
|
|
|
];
|
|
|
|
public static $shadows = [
|
|
|
|
'0' => 'Aucune',
|
|
|
|
'1px 1px 5px' => 'Très légère',
|
|
|
|
'1px 1px 10px' => 'Légère',
|
|
|
|
'1px 1px 15px' => 'Moyenne',
|
|
|
|
'1px 1px 25px' => 'Importante',
|
|
|
|
'1px 1px 50px' => 'Très importante'
|
|
|
|
];
|
|
|
|
public static $siteFontSizes = [
|
|
|
|
'12px' => '12',
|
|
|
|
'13px' => '13',
|
|
|
|
'14px' => '14',
|
|
|
|
'15px' => '15',
|
|
|
|
'16px' => '16'
|
|
|
|
];
|
|
|
|
public static $sizes = [
|
|
|
|
'auto' => 'Automatique',
|
|
|
|
'cover' => 'Largeur adaptée au fond'
|
|
|
|
];
|
|
|
|
public static $textTransforms = [
|
|
|
|
'none' => 'Normaux',
|
|
|
|
'uppercase' => 'Majuscules'
|
|
|
|
];
|
|
|
|
public static $widths = [
|
|
|
|
'750px' => 'Petite (750 pixels)',
|
|
|
|
'960px' => 'Moyenne (960 pixels)',
|
|
|
|
'1170px' => 'Grande (1170 pixels)',
|
|
|
|
'100%' => 'Fluide (100%)'
|
|
|
|
];
|
2019-03-19 05:23:18 +01:00
|
|
|
public static $headerWide = [
|
|
|
|
'auto auto' => 'Automatique',
|
|
|
|
'contain' => 'Responsive (contain)',
|
|
|
|
'cover' => 'Responsive (cover)',
|
|
|
|
'100% 100%' => 'Image étirée',
|
2019-01-02 23:55:43 +01:00
|
|
|
];
|
2018-09-02 19:38:02 +02:00
|
|
|
|
2019-01-02 23:55:43 +01:00
|
|
|
|
2018-04-02 08:29:19 +02:00
|
|
|
/**
|
|
|
|
* Mode avancé
|
|
|
|
*/
|
|
|
|
public function advanced() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
// Enregistre le CSS
|
|
|
|
file_put_contents('site/data/custom.css', $this->getInput('themeAdvancedCss', null));
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme/advanced',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
2019-01-22 14:36:13 +01:00
|
|
|
'title' => 'Éditeur CSS',
|
2018-04-02 08:29:19 +02:00
|
|
|
'vendor' => [
|
|
|
|
'codemirror'
|
|
|
|
],
|
|
|
|
'view' => 'advanced'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options de l'arrière plan
|
|
|
|
*/
|
|
|
|
public function body() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
$this->setData(['theme', 'body', [
|
|
|
|
'backgroundColor' => $this->getInput('themeBodyBackgroundColor'),
|
|
|
|
'image' => $this->getInput('themeBodyImage'),
|
|
|
|
'imageAttachment' => $this->getInput('themeBodyImageAttachment'),
|
|
|
|
'imagePosition' => $this->getInput('themeBodyImagePosition'),
|
|
|
|
'imageRepeat' => $this->getInput('themeBodyImageRepeat'),
|
|
|
|
'imageSize' => $this->getInput('themeBodyImageSize')
|
|
|
|
]]);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation de l\'arrière plan',
|
|
|
|
'vendor' => [
|
|
|
|
'tinycolorpicker'
|
|
|
|
],
|
|
|
|
'view' => 'body'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options du pied de page
|
|
|
|
*/
|
|
|
|
public function footer() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
$this->setData(['theme', 'footer', [
|
|
|
|
'backgroundColor' => $this->getInput('themeFooterBackgroundColor'),
|
|
|
|
'copyrightAlign' => $this->getInput('themeFooterCopyrightAlign'),
|
|
|
|
'height' => $this->getInput('themeFooterHeight'),
|
|
|
|
'loginLink' => $this->getInput('themeFooterLoginLink'),
|
|
|
|
'margin' => $this->getInput('themeFooterMargin', helper::FILTER_BOOLEAN),
|
|
|
|
'position' => $this->getInput('themeFooterPosition'),
|
|
|
|
'socialsAlign' => $this->getInput('themeFooterSocialsAlign'),
|
|
|
|
'text' => $this->getInput('themeFooterText', null),
|
|
|
|
'textAlign' => $this->getInput('themeFooterTextAlign'),
|
2018-09-09 21:28:05 +02:00
|
|
|
'textColor' => $this->getInput('themeFooterTextColor'),
|
|
|
|
'copyrightPosition' => $this->getInput('themeFooterCopyrightPosition'),
|
|
|
|
'textPosition' => $this->getInput('themeFooterTextPosition'),
|
2019-03-19 06:59:28 +01:00
|
|
|
'socialsPosition' => $this->getInput('themeFooterSocialsPosition'),
|
|
|
|
'textTransform' => $this->getInput('themeFootererTextTransform'),
|
|
|
|
'font' => $this->getInput('themeFooterFont'),
|
|
|
|
'fontSize' => $this->getInput('themeFooterFontSize'),
|
|
|
|
'fontWeight' => $this->getInput('themeFooterFontWeight')
|
2018-04-02 08:29:19 +02:00
|
|
|
]]);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation du pied de page',
|
|
|
|
'vendor' => [
|
|
|
|
'tinycolorpicker'
|
|
|
|
],
|
|
|
|
'view' => 'footer'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options de la bannière
|
|
|
|
*/
|
|
|
|
public function header() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
2019-02-26 13:46:25 +01:00
|
|
|
// Si une image est positionnée, l'arrière en transparent.
|
2018-04-02 08:29:19 +02:00
|
|
|
$this->setData(['theme', 'header', [
|
2019-03-04 23:02:24 +01:00
|
|
|
'backgroundColor' => $this->getInput('themeHeaderBackgroundColor'),
|
2019-03-19 06:59:28 +01:00
|
|
|
'textTransform' => $this->getInput('themeHeaderTextTransform'),
|
2018-04-02 08:29:19 +02:00
|
|
|
'font' => $this->getInput('themeHeaderFont'),
|
|
|
|
'fontSize' => $this->getInput('themeHeaderFontSize'),
|
|
|
|
'fontWeight' => $this->getInput('themeHeaderFontWeight'),
|
|
|
|
'height' => $this->getInput('themeHeaderHeight'),
|
|
|
|
'image' => $this->getInput('themeHeaderImage'),
|
|
|
|
'imagePosition' => $this->getInput('themeHeaderImagePosition'),
|
|
|
|
'imageRepeat' => $this->getInput('themeHeaderImageRepeat'),
|
|
|
|
'margin' => $this->getInput('themeHeaderMargin', helper::FILTER_BOOLEAN),
|
|
|
|
'position' => $this->getInput('themeHeaderPosition'),
|
|
|
|
'textAlign' => $this->getInput('themeHeaderTextAlign'),
|
|
|
|
'textColor' => $this->getInput('themeHeaderTextColor'),
|
2019-03-19 06:59:28 +01:00
|
|
|
'textHide' => $this->getInput('themeHeaderTextHide', helper::FILTER_BOOLEAN),
|
2018-08-31 22:35:39 +02:00
|
|
|
'linkHome' => $this->getInput('themeHeaderlinkHome',helper::FILTER_BOOLEAN),
|
|
|
|
'imageContainer' => $this->getInput('themeHeaderImageContainer')
|
2018-04-02 08:29:19 +02:00
|
|
|
]]);
|
2019-01-22 13:46:35 +01:00
|
|
|
// Modification de la position du menu selon la position de la bannière
|
|
|
|
switch ($this->getInput('themeHeaderPosition')) {
|
|
|
|
case 'site' :
|
2019-03-07 23:23:32 +01:00
|
|
|
$position = str_replace ('body','site',$this->getData(['theme','menu','position']));
|
2019-01-22 13:46:35 +01:00
|
|
|
break;
|
|
|
|
case 'body' :
|
2019-03-16 15:14:04 +01:00
|
|
|
$position = str_replace ('site','body',$this->getData(['theme','menu','position']));
|
2019-01-22 13:46:35 +01:00
|
|
|
break;
|
2019-03-16 15:14:04 +01:00
|
|
|
default:
|
|
|
|
$position = $this->getData(['theme','menu','position']);
|
2019-01-22 13:46:35 +01:00
|
|
|
}
|
2019-03-07 23:23:32 +01:00
|
|
|
$this->setData(['theme', 'menu', [
|
|
|
|
'backgroundColor' => $this->getData(['theme', 'menu', 'backgroundColor']),
|
|
|
|
'font' => $this->getData(['theme', 'menu', 'font']),
|
|
|
|
'fontSize' => $this->getData(['theme', 'menu', 'fontSize']),
|
|
|
|
'fontWeight' => $this->getData(['theme', 'menu', 'fontWeight']),
|
|
|
|
'height' => $this->getData(['theme', 'menu', 'height']),
|
|
|
|
'loginLink' => $this->getData(['theme', 'menu', 'loginLink']),
|
|
|
|
'margin' => $this->getData(['theme', 'menu', 'margin']),
|
|
|
|
'position' => $position,
|
|
|
|
'textAlign' => $this->getData(['theme', 'menu', 'textAlign']),
|
|
|
|
'textColor' => $this->getData(['theme', 'menu', 'textColor']),
|
|
|
|
'textTransform' => $this->getData(['theme','menu','textTransform']),
|
|
|
|
'fixed' => $this->getData(['theme','menu','fixed'])
|
|
|
|
]]);
|
2018-04-02 08:29:19 +02:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation de la bannière',
|
|
|
|
'vendor' => [
|
|
|
|
'tinycolorpicker'
|
|
|
|
],
|
|
|
|
'view' => 'header'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Accueil de la personnalisation
|
|
|
|
*/
|
|
|
|
public function index() {
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation du thème',
|
|
|
|
'view' => 'index'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options du menu
|
|
|
|
*/
|
|
|
|
public function menu() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
$this->setData(['theme', 'menu', [
|
|
|
|
'backgroundColor' => $this->getInput('themeMenuBackgroundColor'),
|
2018-12-09 00:52:05 +01:00
|
|
|
'font' => $this->getInput('themeMenuFont'),
|
2018-04-02 08:29:19 +02:00
|
|
|
'fontSize' => $this->getInput('themeMenuFontSize'),
|
|
|
|
'fontWeight' => $this->getInput('themeMenuFontWeight'),
|
|
|
|
'height' => $this->getInput('themeMenuHeight'),
|
2019-02-22 22:53:51 +01:00
|
|
|
'loginLink' => $this->getInput('themeMenuLoginLink', helper::FILTER_BOOLEAN),
|
2018-04-02 08:29:19 +02:00
|
|
|
'margin' => $this->getInput('themeMenuMargin', helper::FILTER_BOOLEAN),
|
|
|
|
'position' => $this->getInput('themeMenuPosition'),
|
|
|
|
'textAlign' => $this->getInput('themeMenuTextAlign'),
|
|
|
|
'textColor' => $this->getInput('themeMenuTextColor'),
|
2018-04-07 23:31:15 +02:00
|
|
|
'textTransform' => $this->getInput('themeMenuTextTransform'),
|
2019-01-24 14:26:54 +01:00
|
|
|
'fixed' => $this->getInput('themeMenuFixed', helper::FILTER_BOOLEAN)
|
2018-04-02 08:29:19 +02:00
|
|
|
]]);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation du menu',
|
|
|
|
'vendor' => [
|
|
|
|
'tinycolorpicker'
|
|
|
|
],
|
|
|
|
'view' => 'menu'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Réinitialisation de la personnalisation avancée
|
|
|
|
*/
|
|
|
|
public function reset() {
|
|
|
|
// Supprime le fichier de personnalisation avancée
|
|
|
|
unlink('site/data/custom.css');
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Personnalisation avancée réinitialisée',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme/advanced',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Options du site
|
|
|
|
*/
|
|
|
|
public function site() {
|
|
|
|
// Soumission du formulaire
|
|
|
|
if($this->isPost()) {
|
|
|
|
$this->setData(['theme', 'title', [
|
|
|
|
'font' => $this->getInput('themeTitleFont'),
|
|
|
|
'textColor' => $this->getInput('themeTitleTextColor'),
|
|
|
|
'fontWeight' => $this->getInput('themeTitleFontWeight'),
|
|
|
|
'textTransform' => $this->getInput('themeTitleTextTransform')
|
|
|
|
]]);
|
|
|
|
$this->setData(['theme', 'button', 'backgroundColor', $this->getInput('themeButtonBackgroundColor')]);
|
|
|
|
$this->setData(['theme', 'link', 'textColor', $this->getInput('themeLinkTextColor')]);
|
|
|
|
$this->setData(['theme', 'text', [
|
|
|
|
'font' => $this->getInput('themeTextFont'),
|
|
|
|
'fontSize' => $this->getInput('themeTextFontSize'),
|
|
|
|
'textColor' => $this->getInput('themeTextTextColor'),
|
|
|
|
]]);
|
|
|
|
$this->setData(['theme', 'site', [
|
|
|
|
'backgroundColor' => $this->getInput('themeSiteBackgroundColor'),
|
|
|
|
'radius' => $this->getInput('themeSiteRadius'),
|
|
|
|
'shadow' => $this->getInput('themeSiteShadow'),
|
2019-01-14 20:54:55 +01:00
|
|
|
'width' => $this->getInput('themeSiteWidth')
|
2019-01-03 15:07:11 +01:00
|
|
|
]]);
|
2018-04-02 08:29:19 +02:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Modifications enregistrées',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Personnalisation du site',
|
|
|
|
'vendor' => [
|
2019-01-02 23:55:43 +01:00
|
|
|
'tinycolorpicker',
|
|
|
|
'tinymce'
|
2018-04-02 08:29:19 +02:00
|
|
|
],
|
|
|
|
'view' => 'site'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2018-12-25 16:24:20 +01:00
|
|
|
/**
|
|
|
|
* Import du thème
|
|
|
|
*/
|
|
|
|
public function manage() {
|
2018-12-27 20:06:03 +01:00
|
|
|
if($this->isPost() ) {
|
2018-12-28 17:13:26 +01:00
|
|
|
$zipFilename = $this->getInput('themeManageImport', helper::FILTER_STRING_SHORT, true);
|
2018-12-28 22:38:32 +01:00
|
|
|
|
2018-12-28 17:13:26 +01:00
|
|
|
$zip = new ZipArchive();
|
2018-12-28 22:38:32 +01:00
|
|
|
if ($zip->open('site/file/source/'.$zipFilename) === TRUE) {
|
|
|
|
$zip->extractTo('.');
|
2018-12-28 17:13:26 +01:00
|
|
|
$zip->close();
|
2018-12-28 22:38:32 +01:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
2018-12-30 18:33:37 +01:00
|
|
|
'redirect' => helper::baseUrl() . 'theme'
|
2018-12-28 22:38:32 +01:00
|
|
|
]);
|
2018-12-29 17:49:48 +01:00
|
|
|
} else {
|
|
|
|
$this->addOutput([
|
2019-01-24 09:31:40 +01:00
|
|
|
'notification' => 'Erreur avec le thème <b>'.$zipFilename.'</b>',
|
2018-12-29 17:49:48 +01:00
|
|
|
'redirect' => helper::baseUrl() . 'theme/manage'
|
|
|
|
]);
|
|
|
|
}
|
2018-12-27 20:06:03 +01:00
|
|
|
}
|
2018-12-29 17:49:48 +01:00
|
|
|
|
2018-12-25 18:38:17 +01:00
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'title' => 'Gestion des thèmes',
|
|
|
|
'view' => 'manage'
|
|
|
|
]);
|
2018-12-29 17:49:48 +01:00
|
|
|
|
2018-12-25 18:38:17 +01:00
|
|
|
}
|
2018-12-25 16:24:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Export du thème
|
|
|
|
*/
|
2018-12-25 18:38:17 +01:00
|
|
|
public function export() {
|
2019-01-17 17:48:58 +01:00
|
|
|
// Make zip
|
|
|
|
$zipFilename = $this->makezip();
|
2018-12-28 16:52:58 +01:00
|
|
|
// Téléchargement du ZIP
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
header('Content-Type: application/octet-stream');
|
|
|
|
header('Content-Transfer-Encoding: binary');
|
|
|
|
header('Content-Disposition: attachment; filename="' . $zipFilename . '"');
|
|
|
|
header('Content-Length: ' . filesize('site/tmp/' . $zipFilename));
|
|
|
|
readfile('site/tmp/' . $zipFilename);
|
|
|
|
// Nettoyage du dossier
|
|
|
|
unlink ('site/tmp/' . $zipFilename);
|
2019-01-17 17:48:58 +01:00
|
|
|
die();
|
2018-12-28 16:52:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Export du thème
|
|
|
|
*/
|
|
|
|
public function save() {
|
2019-01-17 17:48:58 +01:00
|
|
|
// Make zip
|
|
|
|
$zipFilename = $this->makezip();
|
|
|
|
// Téléchargement du ZIP
|
2019-01-17 19:05:21 +01:00
|
|
|
mkdir('site/file/source/theme');
|
|
|
|
copy ('site/tmp/' . $zipFilename , 'site/file/source/theme/' . $zipFilename);
|
2019-01-17 17:48:58 +01:00
|
|
|
// Nettoyage du dossier
|
|
|
|
unlink ('site/tmp/' . $zipFilename);
|
|
|
|
// Valeurs en sortie
|
|
|
|
$this->addOutput([
|
|
|
|
'notification' => 'Archive <b>'.$zipFilename.'</b> sauvegardée dans fichiers',
|
|
|
|
'redirect' => helper::baseUrl() . 'theme/manage',
|
|
|
|
'state' => true
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* construction du zip
|
|
|
|
*/
|
|
|
|
public function makezip() {
|
2018-12-26 12:00:30 +01:00
|
|
|
// Creation du dossier
|
2019-02-19 23:53:02 +01:00
|
|
|
// $zipFilename = 'theme-'.date('dmY').'-'.date('hm').'-'.rand(10,99).'.zip';
|
|
|
|
$zipFilename = 'theme '.date('d m Y').' '.date('H i s ').'.zip';
|
2018-12-26 20:20:43 +01:00
|
|
|
$zip = new ZipArchive();
|
2018-12-28 15:03:23 +01:00
|
|
|
if ($zip->open('site/tmp/' . $zipFilename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) === TRUE) {
|
|
|
|
$zip->addFile('site/data/theme.json','site/data/theme.json');
|
2018-12-30 00:27:23 +01:00
|
|
|
$zip->addFile('site/data/theme.json','site/data/theme.css');
|
|
|
|
$zip->addFile('site/data/theme.json','site/data/custom.css');
|
2018-12-28 15:03:23 +01:00
|
|
|
if ($this->getData(['theme','body','image']) !== '' ) {
|
|
|
|
$zip->addFile('site/file/source/'.$this->getData(['theme','body','image']),
|
|
|
|
'site/file/source/'.$this->getData(['theme','body','image'])
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if ($this->getData(['theme','header','image']) !== '' ) {
|
|
|
|
$zip->addFile('site/file/source/'.$this->getData(['theme','header','image']),
|
|
|
|
'site/file/source/'.$this->getData(['theme','header','image'])
|
|
|
|
);
|
2018-12-26 20:20:43 +01:00
|
|
|
}
|
2018-12-28 15:03:23 +01:00
|
|
|
$ret = $zip->close();
|
2018-12-26 20:20:43 +01:00
|
|
|
}
|
2019-01-17 17:48:58 +01:00
|
|
|
return ($zipFilename);
|
|
|
|
}
|
2019-03-08 11:22:19 +01:00
|
|
|
}
|