(".date('Y-m-d H:i:s')." UTC)$report_title

"; $computer = new Computer(); $itemtype = 'Computer'; $table_item = getTableForItemType($itemtype); //echo "Systèmes d'exploitation par implantation

"; echo ""; echo ""; $green_grand_total = 0; $yellow_grand_total = 0; $red_grand_total = 0; $blue_grand_total = 0; $grand_total = 0; # parcours des régions $query = "SELECT id,name,completename FROM glpi_entities WHERE (id=0 OR entities_id=0)"; $query .= " ".getEntitiesRestrictRequest("AND", "glpi_entities"); $region_result = $DB->query($query); while ($region_data = $DB->fetch_assoc($region_result)) { $region_id = $region_data['id']; if ($region_id != 0) { $region_name = getTreeLeafValueName("glpi_entities", $region_id); echo "\n"; } else { $region_name = "AUF (non classé)"; } echo ""; $green_total = 0; $yellow_total = 0; $red_total = 0; $blue_total = 0; $region_total = 0; # operating systems per computer $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(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 LEFT JOIN glpi_entities e ON (c.entities_id = e.id) LEFT JOIN glpi_operatingsystems o ON (c.operatingsystems_id = o.id) WHERE c.is_deleted = '0' AND c.is_template = '0' ".getEntitiesRestrictRequest("AND", "c"); if ($region_id != 0) { $query .= " AND ".getRealQueryForTreeItem("glpi_entities", $region_id, "e.id"); } else { $query .= " AND e.id = '0'"; } $query .= " GROUP BY 2,3 ORDER BY 2,3"; $result = $DB->query($query); while ($data=$DB->fetch_assoc($result)) { if (empty($data['ename'])) { $data['ename'] = "(indéterminé)"; } if (empty($data['oname'])) { $data['oname'] = "(indéterminé)"; } 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 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_bar(Array(0,0,0,1), 5, 5); $blue_total += $data['count']; } else { $oname_plus = svg_bar(Array(0,0,1,0), 5, 5); $red_total += $data['count']; } echo ""; echo ""; echo ""; echo ""; $region_total += $data['count']; } echo ""; echo ""; echo ""; $green_grand_total += $green_total; $yellow_grand_total += $yellow_total; $red_grand_total += $red_total; $blue_grand_total += $blue_total; $grand_total += $region_total; } // fin des régions #echo ""; echo "\n"; # total operating systems $query = "SELECT COUNT(*) FROM `".$table_item."` LEFT JOIN `glpi_computers_items` ON (`glpi_computers_items`.`itemtype` = '".$itemtype."' AND `glpi_computers_items`.`items_id` = `".$table_item."`.`id`) WHERE `".$table_item."`.`is_deleted` = '0' AND `".$table_item."`.`is_template` = '0' ". getEntitiesRestrictRequest("AND", $table_item); $result = $DB->query($query); $total = $DB->result($result, 0, 0); echo ""; echo ""; echo ""; echo "
ImplantationSystème d'exploitationQuantité
$region_name
  ".$data['ename']."".$oname_plus." ".$data['oname']."".$data['count']."
  Sous-total".svg_bar(Array($green_total,$yellow_total,$red_total,$blue_total), 400, 5)."$region_total
 
Total général".svg_bar(Array($green_grand_total,$yellow_grand_total,$red_grand_total,$blue_grand_total), 400, 5)."$total
"; Html::footer(); ?>