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