[x] Affichage explicite (code couleur) des semestre / UEs / Modules

This commit is contained in:
xdrm-brackets 2016-01-04 17:05:15 +01:00
parent acc3a00c52
commit a585b3d9bd
3 changed files with 15 additions and 11 deletions

View File

@ -1089,7 +1089,7 @@ if( (permission('master') || permission('admin')) && $etudiantOpt != null ){
if( $semestreOpt == null ) $semestreOpt = $answer->parcours[0]['id'];
$parcoursChart = array();
foreach($answer->parcours as $semestre) array_push($parcoursChart, array('id'=>$semestre['id'], 'nom' => $semestre['formation'].' '.$semestre['semestre'], 'mention' => $semestre['mention']) );
foreach($answer->parcours as $semestre) array_push($parcoursChart, array('id'=>$semestre['id'], 'nom' => $semestre['formation'].' '.$semestre['semestre'], 'mention' => $semestre['mention'], 'moyenne' => $semestre['moyenne']) );
displayParcours( $parcoursChart, $semestreOpt);

View File

@ -41,40 +41,44 @@ function displayParcours($parcours, $selected){
'twitter' => '#30b6ea',
'facebook' => '#3372c5',
'blou' => '#3c73e6',
'default' => '#28b965'
'default' => '#28b965',
'gray' => '#888888'
);
/* CHOIX DU THEME */
$themeColor = $themes['default'];
$textColor = $themes['default'];
$currentColor = $themes['pamplemousse']; // couleur du semestre courant
$textColor = $themes['gray'];
/****************/
/* DEBUT DU SVG */
/****************/
echo "<svg height='100' width='".($W + 2*$m)."'>";
// [1] ligne de liaison
echo "<rect x='".$line['x']."' y='".$line['y']."' width='".$line['width']."' height='".$line['height']."' fill='".$themeColor."' />";
echo "<rect x='".$line['x']."' y='".$line['y']."' width='".$line['width']."' height='".$line['height']."' fill='".$textColor."' />";
// [3] points d'ancrages
for($i = 0 ; $i < $n ; $i++){
$ti = $lettrePixel * strlen( $parcours[$i]['nom'] ); // longueur du texte actuel
// couleur du texte en fonction de la note
if( !is_bool($parcours[$i]['moyenne']) ){
$val = 20 * $parcours[$i]['moyenne']['moyenne']/$parcours[$i]['moyenne']['base'];
if( $val <= 8 ) $themeColor = '#f55b55';
elseif( $val <= 10 ) $themeColor = '#f59555';
else $themeColor = '#2dcc70';
}else // si pas de note, on met la couleur par défaut
$themeColor = '#000000';
// (1) nom du semestre
echo "<text x='".($M+2*$M*$i - $ti/2)."' y='".$text['y']."' fill='".$textColor."' style='font-family:Ubuntu;font-size:16px;'>".$parcours[$i]['nom']."</text>";
// (2) cercle
if( $parcours[$i]['id'] == $selected ) // si dernier semestre, on met en valeur
echo "<circle style='cursor:pointer;' class='semestre_circle' data-stre='".$parcours[$i]['id']."' cx='".($M+2*$M*$i)."' cy='".$dot['y']."' r='".$dot['r']."' stroke='".$currentColor."' stroke-width='".(.8*$dot['r'])."' fill='#ecf0f1'/>";
else // sinon on affiche normalement
echo "<circle style='cursor:pointer;' class='semestre_circle' data-stre='".$parcours[$i]['id']."' cx='".($M+2*$M*$i)."' cy='".$dot['y']."' r='".$dot['r']."' stroke='".$themeColor."' stroke-width='".(.8*$dot['r'])."' fill='#ecf0f1'/>";
echo "<circle style='cursor:pointer;' class='semestre_circle' data-stre='".$parcours[$i]['id']."' cx='".($M+2*$M*$i)."' cy='".$dot['y']."' r='".$dot['r']."' stroke='".$themeColor."' stroke-width='".(.8*$dot['r'])."' fill='#ecf0f1'/>";
// (3) mention obtenue
echo "<text x='".($M+2*$M*$i - 5*$lettrePixel/2)."' y='".$text['yMention']."' fill='".$textColor."' style='font-family:Ubuntu;font-size:16px;'>".$parcours[$i]['mention']."</text>";