Gestion des couleurs
This commit is contained in:
parent
9227a3f9d5
commit
23fb977c09
@ -72,58 +72,65 @@ function commentaires_lien($content){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function commentaires_graphique_couleur($content){
|
function commentaires_graphique_couleur($content){
|
||||||
global $graphCouleurs;
|
$graphCouleurs = array();
|
||||||
//Association des couleurs Nom => code Hexa
|
//Association des couleurs Nom => code Hexa
|
||||||
$assocNomCouleurs = array(
|
$assocNomCouleurs = array(
|
||||||
'BLA' => '0xFFFFFF',
|
'BLA' => 0xFFFFFF,
|
||||||
'BLA1' => '0xFFFAFA',
|
'BLA1' => 0xFFFAFA,
|
||||||
'BLA2' => '0xF0FFFF',
|
'BLA2' => 0xF0FFFF,
|
||||||
'BLA3' => '0xFFFFF0',
|
'BLA3' => 0xFFFFF0,
|
||||||
'BLE' => '0x0000FF',
|
'BLE' => 0x0000FF,
|
||||||
'BLE1' => '0x00BFFF',
|
'BLE1' => 0x00BFFF,
|
||||||
'BLE2' => '0x00008B',
|
'BLE2' => 0x00008B,
|
||||||
'BLE3' => '0x87F0FA',
|
'BLE3' => 0x87F0FA,
|
||||||
'JAU' => '0xFFFF00',
|
'JAU' => 0xFFFF00,
|
||||||
'JAU1' => '0xFFEFD5',
|
'JAU1' => 0xFFEFD5,
|
||||||
'JAU2' => '0xFFA500',
|
'JAU2' => 0xFFA500,
|
||||||
'JAU3' => '0xFFFFE0',
|
'JAU3' => 0xFFFFE0,
|
||||||
'LUM' => '0xADFF2F',
|
'LUM' => 0xADFF2F,
|
||||||
'LUM1' => '0x00FFFF',
|
'LUM1' => 0x00FFFF,
|
||||||
'LUM2' => '0xFF00FF',
|
'LUM2' => 0xFF00FF,
|
||||||
'LUM3' => '0xF0FFF0',
|
'LUM3' => 0xF0FFF0,
|
||||||
'MAR' => '0xD2691E',
|
'MAR' => 0xD2691E,
|
||||||
'MAR1' => '0xF4A460',
|
'MAR1' => 0xF4A460,
|
||||||
'MAR2' => '0x8B4513',
|
'MAR2' => 0x8B4513,
|
||||||
'MAR3' => '0xF5DEB3',
|
'MAR3' => 0xF5DEB3,
|
||||||
'MET' => '0xFFD700',
|
'MET' => 0xFFD700,
|
||||||
'MET1' => '0xFFF8DC',
|
'MET1' => 0xFFF8DC,
|
||||||
'MET2' => '0xC0C0C0',
|
'MET2' => 0xC0C0C0,
|
||||||
'MET3' => '0xFDF5E6',
|
'MET3' => 0xFDF5E6,
|
||||||
'NOI' => '0x000000',
|
'NOI' => 0x000000,
|
||||||
'NOI1' => '0x808080',
|
'NOI1' => 0x808080,
|
||||||
'NOI2' => '0x2F4F4F',
|
'NOI2' => 0x2F4F4F,
|
||||||
'NOI3' => '0xDCDCDC',
|
'NOI3' => 0xDCDCDC,
|
||||||
'ROU' => '0xFF0000',
|
'ROU' => 0xFF0000,
|
||||||
'ROU1' => '0xFF7F50',
|
'ROU1' => 0xFF7F50,
|
||||||
'ROU2' => '0xB22222',
|
'ROU2' => 0xB22222,
|
||||||
'ROU3' => '0xFFDAB9',
|
'ROU3' => 0xFFDAB9,
|
||||||
'VER' => '0x228B22',
|
'VER' => 0x228B22,
|
||||||
'VER1' => '0x66CDAA',
|
'VER1' => 0x66CDAA,
|
||||||
'VER2' => '0x066400',
|
'VER2' => 0x066400,
|
||||||
'VER3' => '0x98FB98',
|
'VER3' => 0x98FB98,
|
||||||
'VIO' => '0xC71585',
|
'VIO' => 0xC71585,
|
||||||
'VIO1' => '0xEE82EE',
|
'VIO1' => 0xEE82EE,
|
||||||
'VIO2' => '0x8B008B',
|
'VIO2' => 0x8B008B,
|
||||||
'VIO3' => '0xFFF0F5',
|
'VIO3' => 0xFFF0F5,
|
||||||
);
|
);
|
||||||
$pattern = '/COULEUR\(([a-z]{3,4}),?\)/i';
|
$pattern = '/COULEUR\((.*)\)/i';
|
||||||
|
///Detection couleur
|
||||||
if ( preg_match($pattern, $content, $matches) ) {
|
if ( preg_match($pattern, $content, $matches) ) {
|
||||||
$nbCouleurs = count($matches);
|
$listeCouleurs = $matches[1];
|
||||||
$graphCouleurs = array($nbCouleurs-1);
|
//Récupération des couleurs
|
||||||
for($i=1;$i<$nbCouleurs;$i++){
|
$pattern = '/([a-z0-9]{3,4})/i';
|
||||||
$graphCouleurs[] = $assocNomCouleurs[$matches[$i]];
|
if ( preg_match_all($pattern, $listeCouleurs, $matches) ) {
|
||||||
|
FB::log($matches, 'matches');
|
||||||
|
$nbCouleurs = count($matches[1]);
|
||||||
|
for($i=1;$i<$nbCouleurs;$i++){
|
||||||
|
$graphCouleurs[] = $assocNomCouleurs[$matches[1][$i]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FB::log($graphCouleurs,' DETECTION : graphCouleurs');
|
||||||
return $graphCouleurs;
|
return $graphCouleurs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,6 +303,7 @@ function commentaires_graph_stacked($id, $titre, $strRatios) {
|
|||||||
|
|
||||||
function commentaires_graph_histo($id, $titre, $strRatios){
|
function commentaires_graph_histo($id, $titre, $strRatios){
|
||||||
global $graphCouleurs;
|
global $graphCouleurs;
|
||||||
|
FB::log($graphCouleurs, 'HISTO : graphCouleurs');
|
||||||
if(count($graphCouleurs)>0){
|
if(count($graphCouleurs)>0){
|
||||||
$couleurs = $graphCouleurs;
|
$couleurs = $graphCouleurs;
|
||||||
} else {
|
} else {
|
||||||
@ -363,6 +371,7 @@ function commentaires_graph_histo($id, $titre, $strRatios){
|
|||||||
$layer->setBorderColor(Transparent, softLighting(Left));
|
$layer->setBorderColor(Transparent, softLighting(Left));
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($data['y'] as $ydata){
|
foreach($data['y'] as $ydata){
|
||||||
|
FB::log($couleurs[$i], 'Couleur');
|
||||||
$layer->addDataSet($ydata['data'], $couleurs[$i], $ydata['titre']);
|
$layer->addDataSet($ydata['data'], $couleurs[$i], $ydata['titre']);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -1348,6 +1348,7 @@ $tabCommentaires = $etab['tabCommentaires'];
|
|||||||
<?php
|
<?php
|
||||||
require_once 'commentaires/commentaires.php';
|
require_once 'commentaires/commentaires.php';
|
||||||
$graphCouleurs = array();
|
$graphCouleurs = array();
|
||||||
|
$couleurs = array();
|
||||||
if(count($tabCommentaires)>0){
|
if(count($tabCommentaires)>0){
|
||||||
$totalLigne = count($tabCommentaires);
|
$totalLigne = count($tabCommentaires);
|
||||||
$currentLigne = 0;
|
$currentLigne = 0;
|
||||||
@ -1373,7 +1374,12 @@ if(count($tabCommentaires)>0){
|
|||||||
//Traitement des images
|
//Traitement des images
|
||||||
$commentaires = commentaires_image($commentaires);
|
$commentaires = commentaires_image($commentaires);
|
||||||
//Récupération des couleurs pour les graphiques
|
//Récupération des couleurs pour les graphiques
|
||||||
$graphCouleurs = commentaires_graphique_couleur($commentaires);
|
$couleurs = commentaires_graphique_couleur($commentaires);
|
||||||
|
if ( count($couleurs)>0 ){
|
||||||
|
$graphCouleurs = $couleurs;
|
||||||
|
$commentaires = preg_replace('/COULEUR\(.*\)/', '', $commentaires);
|
||||||
|
$couleurs = array();
|
||||||
|
}
|
||||||
//Traitement des graphiques
|
//Traitement des graphiques
|
||||||
$commentaires = commentaires_graphique($commentaires);
|
$commentaires = commentaires_graphique($commentaires);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user