static function showForVirtualMachine(Computer $comp)
{
global $DB;
$ID = $comp->fields['id'];
if (!$comp->getFromDB($ID) || !$comp->can($ID, READ)) {
return false;
}
$canedit = $comp->canEdit($ID);
echo "<div class='center'>";
if (isset($comp->fields['uuid']) && $comp->fields['uuid'] != '') {
$where = "LOWER(`uuid`)" . self::getUUIDRestrictRequest($comp->fields['uuid']);
$hosts = getAllDatasFromTable('glpi_computervirtualmachines', $where);
if (!empty($hosts)) {
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='noHover'><th colspan='2' >" . __('List of host machines') . "</th></tr>";
$header = "<tr><th>" . __('Name') . "</th>";
$header .= "<th>" . __('Entity') . "</th>";
$header .= "</tr>";
echo $header;
$computer = new Computer();
foreach ($hosts as $host) {
echo "<tr class='tab_bg_2'>";
echo "<td>";
if ($computer->can($host['computers_id'], READ)) {
echo "<a href='computer.form.php?id=" . $computer->fields['id'] . "'>";
echo $computer->fields['name'] . "</a>";
$tooltip = "<table><tr><td>" . __('Name') . "</td><td>" . $computer->fields['name'] . '</td></tr>';
$tooltip .= "<tr><td>" . __('Serial number') . "</td><td>" . $computer->fields['serial'] . '</td></tr>';
$tooltip .= "<tr><td>" . __('Comments') . "</td><td>" . $computer->fields['comment'] . '</td></tr></table>';
echo " " . Html::showToolTip($tooltip, array('display' => false));
} else {
echo $computer->fields['name'];
}
echo "</td>";
echo "<td>";
echo Dropdown::getDropdownName('glpi_entities', $computer->fields['entities_id']);
echo "</td></tr>";
}
echo $header;
echo "</table>";
}
}
echo "</div>";
if (!empty($hosts)) {
echo "<br>";
}
}