/** * @since version 0.84 * * @param $row HTMLTableRow object (default NULL) * @param $item CommonDBTM object (default NULL) * @param $father HTMLTableCell object (default NULL) * @param $options array **/ static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array()) { $column_name = __CLASS__; if (isset($options['dont_display'][$column_name])) { return; } if ($item->fields["interfacetypes_id"]) { $row->addCell($row->getHeaderByName($column_name), Dropdown::getDropdownName("glpi_interfacetypes", $item->fields["interfacetypes_id"])); } }
/** * @since version 0.84 * * @warning note the difference between getHTMLTableCellForItem and getHTMLTableCellsForItem * * @param $row HTMLTableRow object * @param $item CommonDBTM object (default NULL) * @param $father HTMLTableCell object (default NULL) * @param $options array **/ function getHTMLTableCellForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array()) { global $CFG_GLPI; $this_type = $this->getType(); if (isset($options['dont_display'][$this_type])) { return $father; } if (static::canView()) { $content = $this->getLink(); } else { $content = $this->getName(); } if ($options['canedit']) { $field_name = 'quantity_' . $this->getType() . '_' . $this->getID(); $content .= " <img title='" . __s('Add') . "' alt='" . __s('Add') . "'\n onClick=\"" . Html::jsShow($field_name) . "\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>"; $content .= "<span id='{$field_name}' style='display:none'><br>"; $content .= __('Add') . " "; $content = array($content, array('function' => 'Dropdown::showInteger', 'parameters' => array($field_name, 0, 0, 10)), "</span>"); } $linktype = static::getItem_DeviceType(); if (in_array($item->getType(), $linktype::itemAffinity())) { $cell = $row->addCell($row->getHeaderByName('common', 'device'), $content, $father, $this); } else { $cell = $father; } return $cell; }
/** * @see NetworkPortInstantiation::getInstantiationHTMLTable() **/ function getInstantiationHTMLTable(NetworkPort $netport, HTMLTableRow $row, HTMLTableCell $father = NULL, array $options = array()) { if (isset($this->fields['networkports_id_list']) && is_string($this->fields['networkports_id_list'])) { $this->fields['networkports_id_list'] = importArrayFromDB($this->fields['networkports_id_list']); } $row->addCell($row->getHeaderByName('Instantiation', 'Origin'), $this->getInstantiationNetworkPortHTMLTable()); parent::getInstantiationHTMLTable($netport, $row, $father, $options); return NULL; }
/** * @see NetworkPortInstantiation::getInstantiationHTMLTable() **/ function getInstantiationHTMLTable(NetworkPort $netport, HTMLTableRow $row, HTMLTableCell $father = NULL, array $options = array()) { $row->addCell($row->getHeaderByName('Instantiation', 'Origin'), $this->getInstantiationNetworkPortHTMLTable()); parent::getInstantiationHTMLTable($netport, $row, $father, $options); return NULL; }
/** * 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; }
/** * @since version 0.84 * * @see CommonDevice::getHTMLTableCellForItem() **/ static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array()) { $column_name = __CLASS__; if (isset($options['dont_display'][$column_name])) { return; } if (empty($item)) { if (empty($father)) { return; } $item = $father->getItem(); } if (in_array($item->getType(), NetworkPort::getNetworkPortInstantiations())) { $link = new Item_DeviceNetworkCard(); if ($link->getFromDB($item->fields['items_devicenetworkcards_id'])) { $device = $link->getOnePeer(1); if ($device) { $row->addCell($row->getHeaderByName($column_name), $device->getLink(), $father); } } } }
/** * @since version 0.84 * * @param $row HTMLTableRow object (default NULL) * @param $item CommonDBTM object (default NULL) * @param $father HTMLTableCell object (default NULL) * @param $options array **/ static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array()) { global $DB, $CFG_GLPI; $column_name = __CLASS__; if (isset($options['dont_display'][$column_name])) { return; } if (empty($item)) { if (empty($father)) { return; } $item = $father->getItem(); } $canedit = isset($options['canedit']) && $options['canedit']; if ($item->getType() == 'NetworkPort_Vlan') { if (isset($item->fields["tagged"]) && $item->fields["tagged"] == 1) { $tagged_msg = __('Tagged'); } else { $tagged_msg = __('Untagged'); } $vlan = new self(); if ($vlan->getFromDB($options['items_id'])) { $content = sprintf(__('%1$s - %2$s'), $vlan->getName(), $tagged_msg); $content .= Html::showToolTip(sprintf(__('%1$s: %2$s'), __('ID TAG'), $vlan->fields['tag']) . "<br>" . sprintf(__('%1$s: %2$s'), __('Comments'), $vlan->fields['comment']), array('display' => false)); $this_cell = $row->addCell($row->getHeaderByName($column_name), $content, $father); } } }