/** * Get HTMLTable row for a given item * * @param $netport NetworkPort object (contains item) * @param $row HTMLTableRow object * @param $father HTMLTableHeader object (default NULL) * @param $options array of possible options: * - 'dont_display' : array of the elements that must not be display * - 'withtemplate' : integer withtemplate param * * @return the father cell for the Internet Informations ... **/ function getInstantiationHTMLTable(NetworkPort $netport, HTMLTableRow $row, HTMLTableCell $father = NULL, array $options = array()) { global $DB; $display_options = $options['display_options']; if ($this->canHaveVirtualPort && $display_options['virtual_ports']) { $virtual_header = $row->getHeaderByName('Instantiation', 'VirtualPorts'); $query = "(SELECT `networkports_id`\n FROM `glpi_networkportaliases`\n WHERE `networkports_id_alias`='" . $netport->getID() . "')\n UNION\n (SELECT `networkports_id`\n FROM `glpi_networkportaggregates`\n WHERE `networkports_id_list` LIKE '%\"" . $netport->getID() . "\"%')"; $iterator = $DB->request($query); if ($iterator->numrows() > 0) { $new_father = $row->addCell($virtual_header, __('this port'), $father); } else { $new_father = $row->addCell($virtual_header, '', $father); } foreach ($iterator as $networkports_ids) { $virtualPort = new NetworkPort(); if ($virtualPort->getFromDB($networkports_ids['networkports_id'])) { $cell_value = '<i>' . $virtualPort->getLink() . '</i>'; $virtual_cell = $row->addCell($virtual_header, $cell_value, $father); $virtual_cell->setAttributForTheRow(array('class' => 'htmltable_upper_separation_cell')); if ($this->canHaveVLAN && $display_options['vlans']) { NetworkPort_Vlan::getHTMLTableCellsForItem($row, $virtualPort, $virtual_cell, $options); } if ($display_options['internet']) { NetworkName::getHTMLTableCellsForItem($row, $virtualPort, $virtual_cell, $options); } } unset($virtualPort); } $father = $new_father; } if ($this->canHaveVLAN && $display_options['vlans']) { NetworkPort_Vlan::getHTMLTableCellsForItem($row, $netport, $father, $options); } if ($this->haveMAC && $display_options['mac'] && !empty($netport->fields["mac"])) { $row->addCell($row->getHeaderByName('Instantiation', 'MAC'), $netport->fields["mac"], $father); } if ($display_options['internet']) { NetworkName::getHTMLTableCellsForItem($row, $netport, $father, $options); } return NULL; }