当前位置: 首页>>代码示例>>PHP>>正文


PHP NetworkPort::getNetworkPortInstantiationsWithNames方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:33,代码来源:networkporttype.class.php

示例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;
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:23,代码来源:networkporttype.class.php

示例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 "&nbsp;";
         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 "&nbsp;<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') {
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:networkequipment.class.php


注:本文中的NetworkPort::getNetworkPortInstantiationsWithNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。