136 lines
6.1 KiB
PHP
Executable File
136 lines
6.1 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
// -----------------------------------------------------
|
|
// Recup de la collection / theme
|
|
// -----------------------------------------------------
|
|
if (isset($_SESSION['nomThemeCss']) && !empty($_SESSION['nomThemeCss'])) {
|
|
$nomThemeCss=$_SESSION['nomThemeCss'];
|
|
if (isset($debug[7]) && $debug[7] == '1') { $debugMsg .= monDebug(2, ['THEME RECUP FROM SESSION' => $nomThemeCss], 'css.selectStyleFromNum.php');}
|
|
}
|
|
else
|
|
{$nomThemeCss='css_default';}
|
|
|
|
// -----------------------------------------------------
|
|
// Requete des couleurs generiques
|
|
// -----------------------------------------------------
|
|
include ("./styles/req/coulGeneReqSelectAll.php");
|
|
|
|
// 'Si on a utilisé la liste des nom de style, alors nomCss a l'ancienne valeur ou bien vide --> on le force avec le nouveau nom[num]
|
|
if (isset($cssNom[$theNumCss])) {if ($nomCss!=$cssNom[$theNumCss]) {$nomCss=$cssNom[$theNumCss];} }
|
|
|
|
// -----------------------------------------------------
|
|
// Requête du style
|
|
// -----------------------------------------------------
|
|
$resConn='';
|
|
$result=array();
|
|
if (isset($cssNom[$theNumCss])) {
|
|
$reqSelect="SELECT * from " .$nomThemeCss. " WHERE nom='" .$cssNom[$theNumCss]. "';";
|
|
if (isset($debug[7]) && $debug[7] == '1' ) $debugMsg .= monDebug(2,['reqSelect' => $reqSelect],'');
|
|
$resConn=$idPdo->query($reqSelect);
|
|
$result=$resConn->fetch(PDO::FETCH_ASSOC);
|
|
if (isset($debug[7]) && $debug[7] == '1' ) if (isset($debug[7]) && $debug[7] == '1' ) monDebug(2,['nbr de champs' => count($result) ],'');
|
|
$mStyle="";
|
|
$_SESSION['previewStyle']="";
|
|
|
|
// -----------------------------------------------------
|
|
// Boucle sur les attributs
|
|
// -----------------------------------------------------
|
|
foreach ($result as $nomAttr => $valeur) {
|
|
$exception=0;
|
|
if ($nomAttr =='theLeft') {$nomAttr="left";} // left reservé mysql
|
|
if ($nomAttr =='theFloat') {$nomAttr="float";} // float reservé mysql
|
|
if ($nomAttr =='theRight') {$nomAttr="right";} // right reservé mysql
|
|
if ($nomAttr =='theCursor') {$nomAttr="cursor";} // cursor reservé mysql
|
|
|
|
// -----------------------------------------------------
|
|
// Recup des attributs
|
|
// -----------------------------------------------------
|
|
if ($nomAttr =='theme') {$theCssVolet=$valeur;}
|
|
|
|
if ($nomAttr !='id' && $nomAttr !='description' && $nomAttr !='nom' && $valeur !='-' && $valeur !='' && $nomAttr!='@keyframes' && $nomAttr!='type') {
|
|
if ($nomAttr =='border-radius' || $nomAttr =='border-width' || $nomAttr =='font-size' ) {
|
|
$myTest=strtoupper (substr ($valeur,-2,2));
|
|
$myTest2=strtoupper (substr ($valeur,-1,1));
|
|
if ($myTest!= "PX" && $myTest!= "EM" && $myTest2 != "%")
|
|
{$mStyle .=$nomAttr. ': ' .$valeur. 'px; '; $_SESSION['previewStyle'].=$nomAttr. ': ' .$valeur. 'px; ';}
|
|
else
|
|
{$mStyle .=$nomAttr. ': ' .$valeur. '; '; $_SESSION['previewStyle'].=$nomAttr. ': ' .$valeur. '; ';}
|
|
$exception=1;
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Cas du background URL : ('chemin')
|
|
// -----------------------------------------------------
|
|
if ($nomAttr =='background-image:url' && $cssNom[$theNumCss]=='#bodyImg' ) {
|
|
$mStyle .=$nomAttr. '(\'' .$valeur. '\');'; $exception=1;
|
|
if (isset($debug[7]) && $debug[7] == '1') { $debugMsg .= monDebug(2, ['L' => '', 'valeur' => $valeur], '');}
|
|
$_SESSION['previewStyle'].=$nomAttr. '(\'' .$valeur. '\');';
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Cas des couleurs génériques
|
|
// Clients
|
|
// Catalogue
|
|
// Commandes
|
|
// Publicité
|
|
// Information
|
|
// Global
|
|
if ($nomAttr =='color' || $nomAttr =='background' || $nomAttr =='border-color' ) {
|
|
if ($valeur=='Couleur du thème' || $valeur=='Couleur globale') {
|
|
include ("./styles/determinerFamilleCouleur.php");
|
|
$exception=1;
|
|
|
|
// -----------------------------------------------------
|
|
// Cas de la fontColor
|
|
// -----------------------------------------------------
|
|
if ($nomAttr =='color' || $nomAttr =='border-color' ) {
|
|
switch ($valeur) {
|
|
case 'Couleur du thème':
|
|
$mStyle .=$nomAttr. ': ' .$voletFontColorTheme. '; '; $_SESSION['previewStyle'].=$nomAttr. ': ' .$voletFontColorTheme. '; ';
|
|
break;
|
|
|
|
case 'Couleur globale':
|
|
$mStyle .=$nomAttr. ': ' .$voletFontColorGlobal. '; '; $_SESSION['previewStyle'].=$nomAttr. ': ' .$voletFontColorGlobal. '; ';
|
|
break;
|
|
}
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Cas du backGround Color
|
|
// -----------------------------------------------------
|
|
if ($nomAttr =='background' ) {
|
|
switch ($valeur) {
|
|
case 'Couleur du thème':
|
|
$mStyle .=$nomAttr. ': ' .$voletBgColorTheme. '; ';
|
|
$_SESSION['previewStyle'].=$nomAttr. ': ' .$voletBgColorTheme. '; ';
|
|
break;
|
|
|
|
case 'Couleur globale':
|
|
$mStyle .=$nomAttr. ': ' .$voletBGColorGlobal. '; ';
|
|
$_SESSION['previewStyle'].=$nomAttr. ': ' .$voletBGColorGlobal. '; ';
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Cas normal
|
|
// -----------------------------------------------------
|
|
if ($exception==0) {
|
|
$mStyle .=$nomAttr. ': ' .$valeur. '; ';
|
|
// -----------------------------------------------------
|
|
// Pour le preview
|
|
// -----------------------------------------------------
|
|
if ($nomAttr !='commentaires' && $nomAttr !='theme') {
|
|
$_SESSION['previewStyle'].=$nomAttr. ': ' .$valeur. '; ';
|
|
}
|
|
}
|
|
}
|
|
if (isset($debug[7]) && $debug[7] == '1' ) { if ($valeur!="-") $debugMsg .= monDebug(2,['Css attribut' => $nomAttr. ' = ' .$valeur ],''); }
|
|
} //for each
|
|
} //$cssNom[$theNumCss]
|
|
|
|
if (isset($debug[7]) && $debug[7] == '1' ) { $debugMsg .= monDebug(2,['mStyle' => $mStyle, '$_SESSION[previewStyle]' => $_SESSION['previewStyle'] ],'');}
|
|
if ($nomCss=='#iconesPpauxMenuDeroulant') {include ("./req/reqUpdateIconeStyle.php");}
|
|
?>
|