本文整理汇总了PHP中NetworkPort::getNetworkPortInstantiationsWithNames方法的典型用法代码示例。如果您正苦于以下问题:PHP NetworkPort::getNetworkPortInstantiationsWithNames方法的具体用法?PHP NetworkPort::getNetworkPortInstantiationsWithNames怎么用?PHP NetworkPort::getNetworkPortInstantiationsWithNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkPort
的用法示例。
在下文中一共展示了NetworkPort::getNetworkPortInstantiationsWithNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displaySpecificTypeField
function displaySpecificTypeField($ID, $field = array())
{
switch ($field['type']) {
case 'instantiation_type':
Dropdown::showFromArray($field['name'], NetworkPort::getNetworkPortInstantiationsWithNames(), array('value' => $this->fields[$field['name']]));
break;
case 'type':
Dropdown::showFromArray('type', NetworkPortEthernet::getPortTypeName(), array('value' => $this->fields[$field['name']]));
break;
case 'readonly_text':
$value = $this->fields[$field['name']];
echo "<input type='hidden' name='" . $field['name'] . "' value='{$value}'>{$value}";
break;
case 'MIB or wildcard':
$name = $field['name'];
$value = $this->fields[$name];
$values = array($value => $value, '*' => __('Any kind', 'ocsinventoryng'));
Dropdown::showFromArray($name, $values, array('value' => $value));
break;
case 'speed':
$standard_speeds = NetworkPortEthernet::getPortSpeed();
if (!isset($standard_speeds[$this->fields['speed']]) && !empty($this->fields['speed'])) {
$speed = NetworkPortEthernet::transformPortSpeed($this->fields['speed'], true);
} else {
$speed = true;
}
Dropdown::showFromArray('speed', $standard_speeds, array('value' => $this->fields['speed'], 'other' => $speed));
break;
case 'version':
Dropdown::showFromArray('version', WifiNetwork::getWifiCardVersion(), array('value' => $this->fields['version']));
break;
}
}
示例2: displaySpecificTypeField
function displaySpecificTypeField($ID, $field = array())
{
switch ($field['type']) {
case 'instantiation_type':
Dropdown::showFromArray($field['name'], NetworkPort::getNetworkPortInstantiationsWithNames(), array('value' => $this->fields[$field['name']]));
break;
case 'type':
Dropdown::showFromArray('type', NetworkPortEthernet::getPortTypeName(), array('value' => $this->fields[$field['name']]));
break;
case 'speed':
$standard_speeds = NetworkPortEthernet::getPortSpeed();
if (!isset($standard_speeds[$this->fields['speed']]) && !empty($this->fields['speed'])) {
$speed = NetworkPortEthernet::transformPortSpeed($this->fields['speed'], true);
} else {
$speed = true;
}
Dropdown::showFromArray('speed', $standard_speeds, array('value' => $this->fields['speed'], 'other' => $speed));
break;
case 'version':
Dropdown::showFromArray('version', WifiNetwork::getWifiCardVersion(), array('value' => $this->fields['version']));
break;
}
}
示例3: showForm
function showForm(CommonDBTM $item, $options = array())
{
global $DB, $CFG_GLPI;
if (!Session::haveRight('plugin_fusioninventory_networkequipment', READ)) {
NetworkPort::showForItem($item);
return;
}
$canedit = FALSE;
if (Session::haveRight('plugin_fusioninventory_networkequipment', UPDATE)) {
$canedit = TRUE;
}
$id = $item->getID();
if (!($data = $this->find("`networkequipments_id`='" . $id . "'", '', 1))) {
// Add in database if not exist
$input = array();
$input['networkequipments_id'] = $id;
$_SESSION['glpi_plugins_fusinvsnmp_table'] = 'glpi_networkequipments';
$ID_tn = $this->add($input);
$this->getFromDB($ID_tn);
} else {
foreach ($data as $datas) {
$this->fields = $datas;
}
}
if (isset($_POST['displaysnmpinfo'])) {
$this->showNetworkEquipmentInformation($id, $options);
return;
}
//$_SESSION['plugin_fusioninventory_networkportview'] = 'glpi';
if (!isset($_SESSION['plugin_fusioninventory_networkportview'])) {
$_SESSION['plugin_fusioninventory_networkportview'] = 'fusioninventory';
}
// Display glpi network port view if no fusionnetworkport
$query = "SELECT glpi_plugin_fusioninventory_networkports.id\n FROM glpi_plugin_fusioninventory_networkports\n LEFT JOIN glpi_networkports\n ON glpi_plugin_fusioninventory_networkports.networkports_id = glpi_networkports.id\n WHERE glpi_networkports.items_id='" . $id . "'\n AND glpi_networkports.itemtype='NetworkEquipment'";
$result = $DB->query($query);
if ($DB->numrows($result) == 0) {
NetworkPort::showForItem($item);
return;
}
echo "<form action='" . $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/front/networkport.display.php' method='post'>";
echo __('Display the view', 'fusioninventory');
echo ' <i>' . $_SESSION['plugin_fusioninventory_networkportview'] . "</i>. ";
echo __('If you prefer, you can display the view', 'fusioninventory');
echo ' ';
if ($_SESSION['plugin_fusioninventory_networkportview'] == 'fusioninventory') {
echo '<input type="submit" class="submit" name="selectview" value="glpi" />';
} else {
echo '<input type="submit" class="submit" name="selectview" value="fusioninventory" />';
}
Html::closeForm();
if ($_SESSION['plugin_fusioninventory_networkportview'] == 'glpi') {
NetworkPort::showForItem($item);
return;
}
$canedit = $item->can($item->getID(), UPDATE);
if ($canedit) {
$networkPort = new NetworkPort();
echo "\n<form method='get' action='" . $networkPort->getFormURL() . "'>\n";
echo "<input type='hidden' name='items_id' value='" . $item->getID() . "'>\n";
echo "<input type='hidden' name='itemtype' value='" . $item->getType() . "'>\n";
echo "<div class='firstbloc'><table class='tab_cadre_fixe'>\n";
echo "<tr class='tab_bg_2'><td class='center'>\n";
_e('Network port type to be added');
echo " ";
Dropdown::showFromArray('instantiation_type', NetworkPort::getNetworkPortInstantiationsWithNames(), array('value' => 'NetworkPortEthernet'));
echo "</td>\n";
echo "<td class='tab_bg_2 center' width='50%'>";
_e('Add several ports');
echo " <input type='checkbox' name='several' value='1'></td>\n";
echo "<td>\n";
echo "<input type='submit' name='create' value=\"" . _sx('button', 'Add') . "\" " . "class='submit'>\n";
echo "</td></tr></table></div>\n";
Html::closeForm();
}
$monitoring = 0;
if (class_exists("PluginMonitoringNetworkport")) {
$monitoring = 1;
}
// * Get all ports compose tha aggregat
$a_aggregated_ports = array();
$query = "SELECT *, glpi_plugin_fusioninventory_networkports.mac as ifmacinternal\n FROM glpi_plugin_fusioninventory_networkports\n LEFT JOIN glpi_networkports\n ON glpi_plugin_fusioninventory_networkports.networkports_id = glpi_networkports.id\n WHERE glpi_networkports.items_id='" . $id . "'\n AND glpi_networkports.itemtype='NetworkEquipment'\n AND `instantiation_type`='NetworkPortAggregate'\n ORDER BY logical_number ";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
$query_ag = "SELECT * FROM `glpi_networkportaggregates`\n WHERE `networkports_id`='" . $data['id'] . "'\n LIMIT 1";
$result_ag = $DB->query($query_ag);
if ($DB->numrows($result_ag) > 0) {
$data_ag = $DB->fetch_assoc($result_ag);
$a_ports = importArrayFromDB($data_ag['networkports_id_list']);
foreach ($a_ports as $port_id) {
$a_aggregated_ports[$port_id] = $port_id;
}
}
}
$where = '';
if (count($a_aggregated_ports) > 0) {
$where = "AND `glpi_networkports`.`id` NOT IN " . "('" . implode("', '", $a_aggregated_ports) . "')";
}
$query = "SELECT `glpi_networkports`.`id`, `instantiation_type`,\n `glpi_plugin_fusioninventory_networkports`.`id` as `fusionid`\n FROM glpi_plugin_fusioninventory_networkports\n\n LEFT JOIN glpi_networkports\n ON glpi_plugin_fusioninventory_networkports.networkports_id = glpi_networkports.id\n WHERE glpi_networkports.items_id='" . $id . "'\n AND `glpi_networkports`.`itemtype`='NetworkEquipment'\n " . $where . "\n AND NOT (glpi_networkports.name='general'\n AND glpi_networkports.logical_number=0)\n ORDER BY logical_number ";
$nbcol = 5;
if ($monitoring == '1') {
//.........这里部分代码省略.........