<?php
/*
 * Affichage graphique de présentation des scores
 * Conan Holder (-4.5 , 16)
 * Afdcc 2 (0 , 5)
 * Afdcc 1 (-10 , +10)
 * ScoreZ (-3 , 3)
 * Indiscore (0 , 100) ou (0, 20)
 */
header('Content-Type: text/html; charset='.CHARSET);

isset($_REQUEST['score'])? $score=$_REQUEST['score'] : $score = '';
isset($_REQUEST['val'])? $value=$_REQUEST['val'] : $value='';

if(empty($score) || empty($value))
{
	echo 'Paramètres incorrectes.';
	exit;
}

if( $score == 'indiscore' ){
	switch($_SESSION['tabInfo']['typeScore'])
	{
		case '20': 	$score.='20'; break;
		case '100':
		default: 	$score.='100'; break;
	}
}

$bornes = array(
	'conanh' 		=> array( 'min' => -4.5 	, 'max' => 16 	),
	'afdcc2' 		=> array( 'min' => 0		, 'max' => 5 	),
	'afdcc1' 		=> array( 'min' => -10		, 'max' => 10 	),
	'scorez' 		=> array( 'min' => -3		, 'max' => 3	),
	'indiscore100' 	=> array( 'min' => 0		, 'max' => 100 	),
	'indiscore20' 	=> array( 'min' => 0		, 'max' => 20 	),
);

$min = $bornes[$score]['min'];
$max = $bornes[$score]['max'];
$pct = round(($value-$min)*100/($max-$min));
if($pct<0) 		$pct = 0;
if($pct>100) 	$pct = 100;
$firephp->log($pct, 'pourcentage');
?>
<div class="blocdegrade clearfix">
<div><img class="borderimg" src="./img/indiscore/imgscores-<?=$pct?>.png"/></div>
<div><img src="./img/reglette.png" /></div>
<div class="echelle">
<span class="echelleleft"><?=$min?></span>
<span class="echelleright"><?=$max?></span>
</div>
</div>
<?php
exit;