$DBCONNECTION_REQUIRED=0;
include ("../../inc/includes.php");
+include_once ("inc/functions.php");
+
+$svg_color_names = Array('green', 'yellow', 'red', 'blue');
Session::checkRight("reports", "r");
Session::checkRight("computer", "r");
$query = "SELECT COUNT(c.id) AS count, e.name AS ename,
(CASE WHEN o.name REGEXP '^Debian ' THEN SUBSTRING_INDEX(REPLACE(o.name,' GNU/Linux',''),'.',1)
WHEN o.name REGEXP '^Ubuntu ' THEN SUBSTRING_INDEX(REPLACE(o.name,' LTS',''),'.',2)
- WHEN o.name REGEXP '^Microsoft' THEN REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(o.name,'™',''),'®',''),'fessional',''),'fessionnel',''),'Microsoft ','')
+ WHEN o.name REGEXP '^Microsoft' THEN REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(o.name,'(R)',''),'™',''),'®',''),'fessional',''),'fessionnel',''),'Microsoft ','')
WHEN o.name REGEXP '^Mac ' THEN REPLACE(o.name,'Mac ','')
ELSE o.name END) AS oname
FROM `$table_item` c
if (empty($data['oname'])) {
$data['oname'] = "<i>(indéterminé)</i>";
}
- if (($data['oname'] == 'Debian 7') || ($data['oname'] == 'Ubuntu 12.04')) {
- $oname_plus = '<svg width="5" height="5" style="background-color: #00ff00; margin: 1px;"/>';
+ if (($data['oname'] == 'Debian 8') || ($data['oname'] == 'Ubuntu 12.04')) {
+ $oname_plus = svg_bar(Array(1,0,0,0), 5, 5);
$green_total += $data['count'];
- } elseif (($data['oname'] == 'Debian 6') || ($data['oname'] == 'Ubuntu 10.04')) {
- $oname_plus = '<svg width="5" height="5" style="background-color: #ffff00; margin: 1px;"/>';
+ } elseif (($data['oname'] == 'Debian 7') || ($data['oname'] == 'Ubuntu 14.04')) {
+ $oname_plus = svg_bar(Array(0,1,0,0), 5, 5);
$yellow_total += $data['count'];
} elseif ((substr($data['oname'],0,7) == 'Windows') || (substr($data['oname'],strlen($data['oname'])-4,4) == 'OS X')) {
- $oname_plus = '<svg width="5" height="5" style="background-color: #0000ff; margin: 1px;"/>';
+ $oname_plus = svg_bar(Array(0,0,0,1), 5, 5);
$blue_total += $data['count'];
} else {
- $oname_plus = '<svg width="5" height="5" style="background-color: #ff0000; margin: 1px;"/>';
+ $oname_plus = svg_bar(Array(0,0,1,0), 5, 5);
$red_total += $data['count'];
}
echo "<tr class='tab_bg_2 auf_show_details'>";
$region_total += $data['count'];
}
-$green_svg = '<svg width="'.(400*$green_total/$region_total).'" height="5" style="background-color: #00ff00; margin: 1px 0;"/>';
-$yellow_svg = '<svg width="'.(400*$yellow_total/$region_total).'" height="5" style="background-color: #ffff00; margin: 1px 0;"/>';
-$red_svg = '<svg width="'.(400*$red_total/$region_total).'" height="5" style="background-color: #ff0000; margin: 1px 0;"/>';
-$blue_svg = '<svg width="'.(400*$blue_total/$region_total).'" height="5" style="background-color: #0000ff; margin: 1px 0;"/>';
echo "<tr class='tab_bg_2'><td class='b'> Sous-total</td>";
-echo "<td>".$green_svg.$yellow_svg.$red_svg.$blue_svg."</td>";
+echo "<td>".svg_bar(Array($green_total,$yellow_total,$red_total,$blue_total), 400, 5)."</td>";
echo "<td class='numeric b'>$region_total</td></tr>";
$green_grand_total += $green_total;
$result = $DB->query($query);
$total = $DB->result($result, 0, 0);
-$green_svg = '<svg width="'.(400*$green_grand_total/$grand_total).'" height="5" style="background-color: #00ff00; margin: 1px 0;"/>';
-$yellow_svg = '<svg width="'.(400*$yellow_grand_total/$grand_total).'" height="5" style="background-color: #ffff00; margin: 1px 0;"/>';
-$red_svg = '<svg width="'.(400*$red_grand_total/$grand_total).'" height="5" style="background-color: #ff0000; margin: 1px 0;"/>';
-$blue_svg = '<svg width="'.(400*$blue_grand_total/$grand_total).'" height="5" style="background-color: #0000ff; margin: 1px 0;"/>';
echo "<tr class='tab_bg_1'><td class='b'>Total général</td>";
-echo "<td>".$green_svg.$yellow_svg.$red_svg.$blue_svg."</td>";
+echo "<td>".svg_bar(Array($green_grand_total,$yellow_grand_total,$red_grand_total,$blue_grand_total), 400, 5)."</td>";
echo "<td class='numeric b'>$total</td></tr>";
echo "</table>";