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


PHP NetworkPort类代码示例

本文整理汇总了PHP中NetworkPort的典型用法代码示例。如果您正苦于以下问题:PHP NetworkPort类的具体用法?PHP NetworkPort怎么用?PHP NetworkPort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NetworkPort类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNetworkEquipment

 function getNetworkEquipment($id, $line, $a_links = array())
 {
     $networkPort = new NetworkPort();
     $a_networkports = $networkPort->find("`itemtype`='NetworkEquipment'\n         AND `items_id`='" . $id . "'");
     $i = 0;
     foreach ($a_networkports as $data_n) {
         $networkports_id = $networkPort->getContact($data_n['id']);
         if ($networkports_id) {
             $networkPort->getFromDB($networkports_id);
             switch ($networkPort->fields['itemtype']) {
                 case 'NetworkEquipment':
                     if ($i > 0) {
                         $this->line++;
                         $this->routes[$this->line] = $this->routes[$line];
                         $line = $this->line;
                     }
                     array_push($this->routes[$line], $networkPort->fields['items_id']);
                     if (!isset($this->devices[$networkPort->fields['items_id']])) {
                         $this->devices[$networkPort->fields['items_id']] = $networkPort->fields['items_id'];
                         $this->getNetworkEquipment($networkPort->fields['items_id'], $line);
                     }
                     $i++;
                     break;
             }
         }
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:27,代码来源:dependency.class.php

示例2: getNetworkEquipments

 function getNetworkEquipments($networkequipments_id)
 {
     $networkPort = new NetworkPort();
     $a_networkports = $networkPort->find("`itemtype`='NetworkEquipment'\n         AND `items_id`='" . $networkequipments_id . "'");
     foreach ($a_networkports as $data_n) {
         $networkports_id = $networkPort->getContact($data_n['id']);
         if ($networkports_id) {
             $networkPort->getFromDB($networkports_id);
             switch ($networkPort->fields['itemtype']) {
                 case 'NetworkEquipment':
                     $this->a_devices_link['NetworkEquipment-' . $networkPort->fields['items_id']]['NetworkEquipment-' . $networkequipments_id] = 1;
                     if (!isset($this->a_devices['NetworkEquipment-' . $networkPort->fields['items_id']])) {
                         $this->a_devices['NetworkEquipment-' . $networkPort->fields['items_id']] = $this->getState('NetworkEquipment', $networkPort->fields['items_id']);
                         $this->getNetworkEquipments($networkPort->fields['items_id']);
                     }
                     break;
                 case 'Computer':
                 case 'Printer':
                     $this->a_devices_link['NetworkEquipment-' . $networkequipments_id][$networkPort->fields['itemtype'] . '-' . $networkPort->fields['items_id']] = 1;
                     if (!isset($this->a_devices[$networkPort->fields['itemtype'] . '-' . $networkPort->fields['items_id']])) {
                         $this->a_devices[$networkPort->fields['itemtype'] . '-' . $networkPort->fields['items_id']] = $this->getState($networkPort->fields['itemtype'], $networkPort->fields['items_id']);
                     }
                     break;
             }
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:27,代码来源:canvas.class.php

示例3: ImportNetworkEquipment

 /**
  * @test
  */
 public function ImportNetworkEquipment()
 {
     global $DB;
     self::restore_database();
     // Load session rights
     $_SESSION['glpidefault_entity'] = 0;
     Session::initEntityProfiles(2);
     Session::changeProfile(4);
     $pfUnmanaged = new PluginFusioninventoryUnmanaged();
     $networkEquipment = new NetworkEquipment();
     $networkPort = new NetworkPort();
     $networkName = new NetworkName();
     $iPAddress = new IPAddress();
     $input = array('name' => 'switch', 'entities_id' => 0, 'item_type' => 'NetworkEquipment', 'sysdescr' => 'Cisco machin chose', 'locations_id' => 1, 'is_dynamic' => 1, 'serial' => 'XXS6BEF3', 'comment' => 'this is a comment', 'plugin_fusioninventory_configsecurities_id' => 1);
     $unmanageds_id = $pfUnmanaged->add($input);
     // * Add networkport
     $input = array();
     $input['itemtype'] = 'PluginFusioninventoryUnmanaged';
     $input['items_id'] = $unmanageds_id;
     $input['instantiation_type'] = 'NetworkPortEthernet';
     $input['name'] = 'general';
     $input['mac'] = '00:00:00:43:ae:0f';
     $input['is_dynamic'] = 1;
     $networkports_id = $networkPort->add($input);
     $input = array();
     $input['items_id'] = $networkports_id;
     $input['itemtype'] = 'NetworkPort';
     $input['name'] = '';
     $input['is_dynamic'] = 1;
     $networknames_id = $networkName->add($input);
     $input = array();
     $input['entities_id'] = 0;
     $input['itemtype'] = 'NetworkName';
     $input['items_id'] = $networknames_id;
     $input['name'] = '192.168.20.1';
     $input['is_dynamic'] = 1;
     $iPAddress->add($input);
     $pfUnmanaged->import($unmanageds_id);
     $cnt = countElementsInTable("glpi_networkequipments");
     $this->assertEquals(1, $cnt, "May have network equipment added");
     $cnt = countElementsInTable("glpi_plugin_fusioninventory_unmanageds");
     $this->assertEquals(0, $cnt, "Unknown device may be deleted");
     $networkEquipment->getFromDB(1);
     $this->assertEquals('XXS6BEF3', $networkEquipment->fields['serial'], "Serial");
     $this->assertEquals('switch', $networkEquipment->fields['name'], "Name");
     $this->assertEquals(1, $networkEquipment->fields['is_dynamic'], "is_dynamic");
     $this->assertEquals(1, $networkEquipment->fields['locations_id'], "locations_id");
     $this->assertEquals('this is a comment', $networkEquipment->fields['comment'], "comment");
     $networkPort->getFromDB(1);
     $a_reference = array('name' => 'general', 'id' => '1', 'items_id' => '1', 'itemtype' => 'NetworkEquipment', 'entities_id' => '0', 'is_recursive' => '0', 'logical_number' => '0', 'instantiation_type' => 'NetworkPortEthernet', 'mac' => '00:00:00:43:ae:0f', 'comment' => '', 'is_deleted' => '0', 'is_dynamic' => '1');
     $this->assertEquals($a_reference, $networkPort->fields, "Networkport");
     $networkName->getFromDB(1);
     $a_reference = array('id' => '1', 'entities_id' => '0', 'items_id' => '1', 'itemtype' => 'NetworkPort', 'comment' => NULL, 'fqdns_id' => '0', 'is_deleted' => '0', 'is_dynamic' => '1', 'name' => '');
     $this->assertEquals($a_reference, $networkName->fields, "Networkname");
     $iPAddress->getFromDB(1);
     $a_reference = array('name' => '192.168.20.1', 'id' => '1', 'entities_id' => '0', 'items_id' => '1', 'itemtype' => 'NetworkName', 'version' => '4', 'binary_0' => '0', 'binary_1' => '0', 'binary_2' => '65535', 'binary_3' => '3232240641', 'is_deleted' => '0', 'is_dynamic' => '1', 'mainitems_id' => '1', 'mainitemtype' => 'NetworkEquipment');
     $this->assertEquals($a_reference, $iPAddress->fields, "IPAddress");
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:61,代码来源:UnmanagedImportTest.php

示例4: prepareInput

 function prepareInput($input)
 {
     // Try to get mac address from the instantiation ...
     if (!isset($input['mac']) && isset($input['networkports_id_alias'])) {
         $networkPort = new NetworkPort();
         if ($networkPort->getFromDB($input['networkports_id_alias'])) {
             $input['mac'] = $networkPort->getField('mac');
         }
     }
     return $input;
 }
开发者ID:stweil,项目名称:glpi,代码行数:11,代码来源:networkportalias.class.php

示例5: testAddCompleteNetworkPort

 /**
  * @covers NetworkPort::prepareInputForAdd
  * @covers NetworkPort::post_addItem
  */
 public function testAddCompleteNetworkPort()
 {
     $this->Login();
     $computer1 = getItemByTypeName('Computer', '_test_pc01');
     // Do some installations
     $ins = new NetworkPort();
     // Be sure added
     $nb_log = countElementsInTable('glpi_logs');
     $this->assertGreaterThan(0, $ins->add(['items_id' => $computer1->getID(), 'itemtype' => 'Computer', 'entities_id' => $computer1->fields['entities_id'], 'is_recursive' => 0, 'logical_number' => 3, 'mac' => '00:24:81:eb:c6:d2', 'instantiation_type' => 'NetworkPortEthernet', 'name' => 'em3', 'comment' => 'Comment me!', 'netpoints_id' => 0, 'items_devicenetworkcards_id' => 0, 'type' => 'T', 'speed' => 1000, 'speed_other_value' => '', 'NetworkName_name' => 'test1.me', 'NetworkName_fqdns_id' => 0, 'NetworkName__ipaddresses' => ['-1' => '192.168.20.1']]));
     $this->assertGreaterThan($nb_log, countElementsInTable('glpi_logs'));
     // be sure added and have no logs
     $nb_log = countElementsInTable('glpi_logs');
     $this->assertGreaterThan(0, $ins->add(['items_id' => $computer1->getID(), 'itemtype' => 'Computer', 'entities_id' => $computer1->fields['entities_id'], 'is_recursive' => 0, 'logical_number' => 4, 'mac' => '00:24:81:eb:c6:d4', 'instantiation_type' => 'NetworkPortEthernet', 'name' => 'em4', 'comment' => 'Comment me!', 'netpoints_id' => 0, 'items_devicenetworkcards_id' => 0, 'type' => 'T', 'speed' => 1000, 'speed_other_value' => '', 'NetworkName_name' => 'test2.me', 'NetworkName_fqdns_id' => 0, 'NetworkName__ipaddresses' => ['-1' => '192.168.20.2']], [], false));
     $this->assertEquals($nb_log, countElementsInTable('glpi_logs'));
 }
开发者ID:btry,项目名称:glpi,代码行数:19,代码来源:NetworkportTest.php

示例6: 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

示例7: testAddCompleteNetworkPort

 /**
  * @covers NetworkPort::prepareInputForAdd
  * @covers NetworkPort::post_addItem
  */
 public function testAddCompleteNetworkPort()
 {
     $this->Login();
     $computer1 = getItemByTypeName('Computer', '_test_pc01');
     // Do some installations
     $networkport = new NetworkPort();
     // Be sure added
     $nb_log = countElementsInTable('glpi_logs');
     $new_id = $networkport->add(['items_id' => $computer1->getID(), 'itemtype' => 'Computer', 'entities_id' => $computer1->fields['entities_id'], 'is_recursive' => 0, 'logical_number' => 3, 'mac' => '00:24:81:eb:c6:d2', 'instantiation_type' => 'NetworkPortEthernet', 'name' => 'em3', 'comment' => 'Comment me!', 'netpoints_id' => 0, 'items_devicenetworkcards_id' => 0, 'type' => 'T', 'speed' => 1000, 'speed_other_value' => '', 'NetworkName_name' => 'test1', 'NetworkName_comment' => 'test1 comment', 'NetworkName_fqdns_id' => 0, 'NetworkName__ipaddresses' => ['-1' => '192.168.20.1'], '_create_children' => true]);
     $this->assertGreaterThan(0, $new_id);
     $this->assertGreaterThan($nb_log, countElementsInTable('glpi_logs'));
     // check data in db
     // 1 -> NetworkPortEthernet
     $all_netportethernets = getAllDatasFromTable('glpi_networkportethernets', '', false, 'id');
     $networkportethernet = end($all_netportethernets);
     unset($networkportethernet['id']);
     unset($networkportethernet['date_mod']);
     unset($networkportethernet['date_creation']);
     $expected = ['networkports_id' => $new_id, 'items_devicenetworkcards_id' => '0', 'netpoints_id' => '0', 'type' => 'T', 'speed' => '1000'];
     $this->assertEquals($expected, $networkportethernet);
     // 2 -> NetworkName
     $all_networknames = getAllDatasFromTable('glpi_networknames', '', false, 'id');
     $networkname = end($all_networknames);
     $networknames_id = $networkname['id'];
     unset($networkname['id']);
     unset($networkname['date_mod']);
     unset($networkname['date_creation']);
     $expected = ['entities_id' => $computer1->fields['entities_id'], 'items_id' => $new_id, 'itemtype' => 'NetworkPort', 'name' => 'test1', 'comment' => 'test1 comment', 'fqdns_id' => 0, 'is_deleted' => 0, 'is_dynamic' => 0];
     $this->assertEquals($expected, $networkname);
     // 3 -> IPAddress
     $all_ipadresses = getAllDatasFromTable('glpi_ipaddresses', '', false, 'id');
     $ipadress = end($all_ipadresses);
     unset($ipadress['id']);
     unset($ipadress['date_mod']);
     unset($ipadress['date_creation']);
     $expected = ['entities_id' => $computer1->fields['entities_id'], 'items_id' => $networknames_id, 'itemtype' => 'NetworkName', 'version' => '4', 'name' => '192.168.20.1', 'binary_0' => '0', 'binary_1' => '0', 'binary_2' => '65535', 'binary_3' => '3232240641', 'is_deleted' => '0', 'is_dynamic' => '0', 'mainitems_id' => $computer1->getID(), 'mainitemtype' => 'Computer'];
     $this->assertEquals($expected, $ipadress);
     // be sure added and have no logs
     $nb_log = countElementsInTable('glpi_logs');
     $new_id = $networkport->add(['items_id' => $computer1->getID(), 'itemtype' => 'Computer', 'entities_id' => $computer1->fields['entities_id'], 'is_recursive' => 0, 'logical_number' => 4, 'mac' => '00:24:81:eb:c6:d4', 'instantiation_type' => 'NetworkPortEthernet', 'name' => 'em4', 'comment' => 'Comment me!', 'netpoints_id' => 0, 'items_devicenetworkcards_id' => 0, 'type' => 'T', 'speed' => 1000, 'speed_other_value' => '', 'NetworkName_name' => 'test2', 'NetworkName_fqdns_id' => 0, 'NetworkName__ipaddresses' => ['-1' => '192.168.20.2']], [], false);
     $this->assertGreaterThan(0, $new_id);
     $this->assertEquals($nb_log, countElementsInTable('glpi_logs'));
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:47,代码来源:NetworkportTest.php

示例8: NewComputer

 /**
  * @test
  */
 public function NewComputer()
 {
     global $DB;
     $_SESSION["plugin_fusioninventory_entity"] = 0;
     $_SESSION["glpiname"] = 'Plugin_FusionInventory';
     $a_inventory = array('fusioninventorycomputer' => array('last_fusioninventory_update' => date('Y-m-d H:i:s')), 'soundcard' => array(), 'graphiccard' => array(), 'controller' => array(), 'processor' => array(), 'computerdisk' => array(), 'memory' => array(), 'monitor' => array(), 'printer' => array(), 'peripheral' => array(), 'networkport' => array(), 'software' => array(), 'harddrive' => array(), 'virtualmachine' => array(), 'antivirus' => array(), 'storage' => array(), 'licenseinfo' => array(), 'networkcard' => array(), 'drive' => array(), 'batteries' => array(), 'itemtype' => 'Computer');
     $a_inventory['Computer'] = array('name' => 'pc', 'users_id' => 0, 'operatingsystems_id' => 1, 'operatingsystemversions_id' => 1, 'uuid' => 1, 'domains_id' => 1, 'os_licenseid' => '', 'os_license_number' => '', 'operatingsystemservicepacks_id' => 1, 'manufacturers_id' => 0, 'computermodels_id' => 0, 'serial' => 'XB63J7D', 'computertypes_id' => 1, 'is_dynamic' => 1, 'contact' => 'ddurieux');
     $a_inventory['networkport'] = array('em0-cc:f9:54:a1:03:45' => array('name' => 'em0', 'netmask' => '255.255.255.0', 'subnet' => '192.168.30.0', 'mac' => 'cc:f9:54:a1:03:45', 'instantiation_type' => 'NetworkPortEthernet', 'virtualdev' => 0, 'ssid' => '', 'gateway' => '', 'dhcpserver' => '', 'logical_number' => 1, 'ipaddress' => array('192.168.30.198')));
     $networkPort = new NetworkPort();
     $a_networkports = $networkPort->find("`mac`='cc:f9:54:a1:03:45'");
     $a_networkport = current($a_networkports);
     $networkports_id = $a_networkport['id'];
     $pfiComputerLib = new PluginFusioninventoryInventoryComputerLib();
     $computer = new Computer();
     $computers_id = $computer->add(array('serial' => 'XB63J7D', 'entities_id' => 0));
     $_SESSION['glpiactive_entity'] = 0;
     $pfiComputerLib->updateComputer($a_inventory, $computers_id, FALSE);
     $a_networkports = $networkPort->find("`mac`='cc:f9:54:a1:03:45'");
     $this->assertEquals(1, count($a_networkports), "The MAC address cc:f9:54:a1:03:45 must be tied to only one port");
     $a_networkport = current($a_networkports);
     $this->assertEquals($networkports_id, $a_networkport['id'], 'The networkport ID is not the same ' . 'between the unknown device and the computer');
     $this->assertEquals('Computer', $a_networkport['itemtype'], "Maybe Computer ");
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:26,代码来源:UnmanagedManagedTest.php

示例9: 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

示例10: showHistory

 static function showHistory($ID_port)
 {
     global $DB, $CFG_GLPI;
     $np = new NetworkPort();
     $query = "\n         SELECT * FROM(\n            SELECT * FROM (\n               SELECT `id`, `date_mod`, `plugin_fusioninventory_agentprocesses_id`,\n                  `networkports_id_source`, `networkports_id_destination`,\n                  `creation` as `field`, NULL as `value_old`, NULL as `value_new`\n               FROM `glpi_plugin_fusioninventory_networkportconnectionlogs`\n               WHERE `networkports_id_source`='" . $ID_port . "'\n                  OR `networkports_id_destination`='" . $ID_port . "'\n               ORDER BY `date_mod` DESC\n               )\n            AS `DerivedTable1`\n            UNION ALL\n            SELECT * FROM (\n               SELECT `glpi_plugin_fusioninventory_networkportlogs`.`id`,\n                  `date_mod` as `date_mod`, `plugin_fusioninventory_agentprocesses_id`,\n                  `networkports_id` AS `networkports_id_source`,\n                  NULL as `networkports_id_destination`,\n                  `name` AS `field`, `value_old`, `value_new`\n               FROM `glpi_plugin_fusioninventory_networkportlogs`\n               LEFT JOIN `glpi_plugin_fusioninventory_mappings`\n                  ON `glpi_plugin_fusioninventory_networkportlogs`." . "`plugin_fusioninventory_mappings_id` =\n                     `glpi_plugin_fusioninventory_mappings`.`id`\n               WHERE `networkports_id`='" . $ID_port . "'\n               ORDER BY `date_mod` DESC\n               )\n            AS `DerivedTable2`)\n         AS `MainTable`\n         ORDER BY `date_mod` DESC, `id` DESC";
     $text = "<table class='tab_cadre' cellpadding='5' width='950'>";
     $text .= "<tr class='tab_bg_1'>";
     $text .= "<th colspan='8'>";
     $text .= "Historique";
     $text .= "</th>";
     $text .= "</tr>";
     $text .= "<tr class='tab_bg_1'>";
     $text .= "<th>" . __('Connection') . "</th>";
     $text .= "<th>" . __('Item') . "</th>";
     $text .= "<th>" . __('Field') . "</th>";
     $text .= "<th></th>";
     $text .= "<th></th>";
     $text .= "<th></th>";
     $text .= "<th>" . __('Date') . "</th>";
     $text .= "</tr>";
     $result = $DB->query($query);
     if ($result) {
         while ($data = $DB->fetch_array($result)) {
             $text .= "<tr class='tab_bg_1'>";
             if (!empty($data["networkports_id_destination"])) {
                 // Connections and disconnections
                 $imgfolder = $CFG_GLPI['root_doc'] . "/plugins/fusioninventory/pics";
                 if ($data['field'] == '1') {
                     $text .= "<td align='center'><img src='" . $imgfolder . "/connection_ok.png'/></td>";
                 } else {
                     $text .= "<td align='center'><img src='" . $imgfolder . "/connection_notok.png'/></td>";
                 }
                 if ($ID_port == $data["networkports_id_source"]) {
                     if ($np->getFromDB($data["networkports_id_destination"])) {
                         //if (isset($np->fields["items_id"])) {
                         $item = new $np->fields["itemtype"]();
                         $item->getFromDB($np->fields["items_id"]);
                         $link1 = $item->getLink(1);
                         $link = "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/networkport.form.php?id=" . $np->fields["id"] . "\">";
                         if (rtrim($np->fields["name"]) != "") {
                             $link .= $np->fields["name"];
                         } else {
                             $link .= __('Without name');
                         }
                         $link .= "</a>";
                         $text .= "<td align='center'>" . $link . " " . __('on', 'fusioninventory') . " " . $link1 . "</td>";
                     } else {
                         $text .= "<td align='center'><font color='#ff0000'>" . __('Deleted') . "</font></td>";
                     }
                 } else {
                     if ($ID_port == $data["networkports_id_destination"]) {
                         $np->getFromDB($data["networkports_id_source"]);
                         if (isset($np->fields["items_id"])) {
                             $item = new $np->fields["itemtype"]();
                             $item->getFromDB($np->fields["items_id"]);
                             $link1 = $item->getLink(1);
                             $link = "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/networkport.form.php?id=" . $np->fields["id"] . "\">";
                             if (rtrim($np->fields["name"]) != "") {
                                 $link .= $np->fields["name"];
                             } else {
                                 $link .= __('Without name');
                             }
                             $link .= "</a>";
                             $text .= "<td align='center'>" . $link . " " . __('on', 'fusioninventory') . " " . $link1 . "</td>";
                         } else {
                             $text .= "<td align='center'><font color='#ff0000'>" . __('Deleted') . "</font></td>";
                         }
                     }
                 }
                 $text .= "<td align='center' colspan='4'></td>";
                 $text .= "<td align='center'>" . Html::convDateTime($data["date_mod"]) . "</td>";
             } else {
                 // Changes values
                 $text .= "<td align='center' colspan='2'></td>";
                 //               $text .= "<td align='center'>".
                 //                      $FUSIONINVENTORY_MAPPING[NETWORKING_TYPE][$data["field"]]['name']."</td>";
                 $mapping = new PluginFusioninventoryMapping();
                 $mapfields = $mapping->get('NetworkEquipment', $data["field"]);
                 if ($mapfields != FALSE) {
                     $text .= "<td align='center'>" . $mapping->getTranslation($mapfields) . "</td>";
                 } else {
                     $text .= "<td align='center'></td>";
                 }
                 $text .= "<td align='center'>" . $data["value_old"] . "</td>";
                 $text .= "<td align='center'>-></td>";
                 $text .= "<td align='center'>" . $data["value_new"] . "</td>";
                 $text .= "<td align='center'>" . Html::convDateTime($data["date_mod"]) . "</td>";
             }
             $text .= "</tr>";
         }
     }
     $text .= "</table>";
     return $text;
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:94,代码来源:networkportlog.class.php

示例11: reportForNetworkInformations

 /**
  * @since version 0.84
  *
  * @param $networkport_prefix
  * @param $networkport_crit
  * @param $where_crit
  * @param $order                  (default '')
  * @param $field                  (default '')
  * @param $extra                  (default '')
  **/
 static function reportForNetworkInformations($networkport_prefix, $networkport_crit, $where_crit, $order = '', $field = '', $extra = '')
 {
     global $DB;
     // This SQL request matches the NetworkPort, then its NetworkName and IPAddreses. It also
     //      match opposite NetworkPort, then its NetworkName and IPAddresses.
     // Results are groupes by NetworkPort. Then all IPs are concatenated by comma as separator.
     $query = "SELECT {$field}\n                       PORT_1.`itemtype` AS itemtype_1,\n                       PORT_1.`items_id` AS items_id_1,\n                       PORT_1.`id` AS id_1,\n                       PORT_1.`name` AS port_1,\n                       PORT_1.`mac` AS mac_1,\n                       GROUP_CONCAT(ADDR_1.`name` SEPARATOR ',') AS ip_1,\n                       PORT_2.`itemtype` AS itemtype_2,\n                       PORT_2.`items_id` AS items_id_2,\n                       PORT_2.`id` AS id_2,\n                       PORT_2.`name` AS port_2,\n                       PORT_2.`mac` AS mac_2,\n                       GROUP_CONCAT(ADDR_2.`name` SEPARATOR ',') AS ip_2\n                FROM {$networkport_prefix}\n                INNER JOIN `glpi_networkports` AS PORT_1\n                     ON ({$networkport_crit} AND PORT_1.`is_deleted` = 0)\n                LEFT JOIN `glpi_networknames` AS NAME_1\n                    ON (NAME_1.`itemtype` = 'NetworkPort'\n                        AND PORT_1.`id` = NAME_1.`items_id`\n                        AND NAME_1.`is_deleted` = 0)\n                LEFT JOIN `glpi_ipaddresses` AS ADDR_1\n                    ON (ADDR_1.`itemtype` = 'NetworkName'\n                        AND NAME_1.`id` = ADDR_1.`items_id`\n                        AND ADDR_1.`is_deleted` = 0)\n                LEFT JOIN `glpi_networkports_networkports` AS LINK\n                    ON (LINK.`networkports_id_1` = PORT_1.`id`\n                        OR LINK.`networkports_id_2` = PORT_1.`id`)\n                LEFT JOIN `glpi_networkports` AS PORT_2\n                    ON (PORT_2.`id`=IF(LINK.`networkports_id_1`=PORT_1.`id`,\n                                       LINK.`networkports_id_2`,\n                                       LINK.`networkports_id_1`))\n                LEFT JOIN `glpi_networknames` AS NAME_2\n                    ON (NAME_2.`itemtype` = 'NetworkPort'\n                        AND PORT_2.`id` = NAME_2.`items_id`\n                        AND NAME_2.`is_deleted` = 0)\n                LEFT JOIN `glpi_ipaddresses` AS ADDR_2\n                    ON (ADDR_2.`itemtype` = 'NetworkName'\n                        AND NAME_2.`id` = ADDR_2.`items_id`\n                        AND ADDR_2.`is_deleted` = 0)\n                WHERE {$where_crit} GROUP BY PORT_1.`id`";
     if (!empty($order)) {
         $query .= "ORDER BY {$order}";
     }
     $result = $DB->request($query);
     if ($result->numrows() > 0) {
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr>";
         if (!empty($extra)) {
             echo "<td>&nbsp;</td>";
         }
         echo "<th colspan='5'>" . __('Device 1') . "</th>";
         echo "<th colspan='5'>" . __('Device 2') . "</th>";
         echo "</tr>\n";
         echo "<tr>";
         if (!empty($extra)) {
             echo "<th>{$extra}</th>";
         }
         echo "<th>" . __('Device type') . "</th>";
         echo "<th>" . __('Device name') . "</th>";
         echo "<th>" . NetworkPort::getTypeName(1) . "</th>";
         echo "<th>" . __('MAC address') . "</th>";
         echo "<th>" . IPAddress::getTypeName(0) . "</th>";
         echo "<th>" . NetworkPort::getTypeName(1) . "</th>";
         echo "<th>" . __('MAC address') . "</th>";
         echo "<th>" . IPAddress::getTypeName(0) . "</th>";
         echo "<th>" . __('Device type') . "</th>";
         echo "<th>" . __('Device name') . "</th>";
         echo "</tr>\n";
         foreach ($result as $line) {
             echo "<tr class='tab_bg_1'>";
             // To ensure that the NetworkEquipment remain the first item, we test its type
             if ($line['itemtype_2'] == 'NetworkEquipment') {
                 $idx = 2;
             } else {
                 $idx = 1;
             }
             if (!empty($extra)) {
                 echo "<td>" . (empty($line['extra']) ? NOT_AVAILABLE : $line['extra']) . "</td>";
             }
             $itemtype = $line["itemtype_{$idx}"];
             if (!empty($itemtype)) {
                 echo "<td>" . $itemtype::getTypeName(1) . "</td>";
                 $item_name = '';
                 if ($item = getItemForItemtype($itemtype)) {
                     if ($item->getFromDB($line["items_id_{$idx}"])) {
                         $item_name = $item->getName();
                     }
                 }
                 echo "<td>" . (empty($item_name) ? NOT_AVAILABLE : $item_name) . "</td>";
             } else {
                 echo "<td> " . NOT_AVAILABLE . " </td>";
                 echo "<td> " . NOT_AVAILABLE . " </td>";
             }
             echo "<td>" . (empty($line["port_{$idx}"]) ? NOT_AVAILABLE : $line["port_{$idx}"]) . "</td>";
             echo "<td>" . (empty($line["mac_{$idx}"]) ? NOT_AVAILABLE : $line["mac_{$idx}"]) . "</td>";
             echo "<td>" . (empty($line["ip_{$idx}"]) ? NOT_AVAILABLE : $line["ip_{$idx}"]) . "</td>";
             if ($idx == 1) {
                 $idx = 2;
             } else {
                 $idx = 1;
             }
             echo "<td>" . (empty($line["port_{$idx}"]) ? NOT_AVAILABLE : $line["port_{$idx}"]) . "</td>";
             echo "<td>" . (empty($line["mac_{$idx}"]) ? NOT_AVAILABLE : $line["mac_{$idx}"]) . "</td>";
             echo "<td>" . (empty($line["ip_{$idx}"]) ? NOT_AVAILABLE : $line["ip_{$idx}"]) . "</td>";
             $itemtype = $line["itemtype_{$idx}"];
             if (!empty($itemtype)) {
                 echo "<td>" . $itemtype::getTypeName(1) . "</td>";
                 $item_name = '';
                 if ($item = getItemForItemtype($itemtype)) {
                     if ($item->getFromDB($line["items_id_{$idx}"])) {
                         $item_name = $item->getName();
                     }
                 }
                 echo "<td>" . (empty($item_name) ? NOT_AVAILABLE : $item_name) . "</td>";
             } else {
                 echo "<td> " . NOT_AVAILABLE . " </td>";
                 echo "<td> " . NOT_AVAILABLE . " </td>";
             }
             echo "</tr>\n";
         }
         echo "</table><br><hr><br>";
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:100,代码来源:report.class.php

示例12: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     switch ($ma->getAction()) {
         case 'transform_to':
             $input = $ma->getInput();
             if (isset($input["transform_to"]) && !empty($input["transform_to"])) {
                 $networkport = new NetworkPort();
                 foreach ($ids as $id) {
                     if ($networkport->canEdit($id) && $item->can($id, DELETE)) {
                         if (empty($networkport->fields['instantiation_type'])) {
                             if ($networkport->switchInstantiationType($input['transform_to']) !== false) {
                                 $instantiation = $networkport->getInstantiation();
                                 $input2 = $item->fields;
                                 $input2['networkports_id'] = $input2['id'];
                                 unset($input2['id']);
                                 if ($instantiation->add($input2)) {
                                     $item->delete(array('id' => $id));
                                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                                 } else {
                                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                                     $ma->addMessage($networkport->getErrorMessage(ERROR_ON_ACTION));
                                 }
                             } else {
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                                 $ma->addMessage($networkport->getErrorMessage(ERROR_ON_ACTION));
                             }
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                             $ma->addMessage($networkport->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($networkport->getErrorMessage(ERROR_RIGHT));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:48,代码来源:networkportmigration.class.php

示例13: getHTMLTableCellsForItem

 /**
  * @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;
     if ($item !== NULL && $item->getType() == 'IPNetwork') {
         $queries = array();
         foreach ($CFG_GLPI["networkport_types"] as $itemtype) {
             $table = getTableForItemType($itemtype);
             $queries[] = "(SELECT ADDR.`binary_0` AS binary_0,\n                                  ADDR.`binary_1` AS binary_1,\n                                  ADDR.`binary_2` AS binary_2,\n                                  ADDR.`binary_3` AS binary_3,\n                                  ADDR.`name`     AS ip,\n                                  ADDR.`id`       AS id,\n                                  ADDR.`itemtype` AS addr_item_type,\n                                  ADDR.`items_id` AS addr_item_id,\n                                  `glpi_entities`.`completename` AS entity,\n                                  NAME.`id`       AS name_id,\n                                  PORT.`id`       AS port_id,\n                                  ITEM.`id`       AS item_id,\n                                  '{$itemtype}'     AS item_type\n                           FROM `glpi_ipaddresses_ipnetworks` AS LINK\n                           JOIN `glpi_ipaddresses` AS ADDR ON (ADDR.`id` = LINK.`ipaddresses_id`\n                                                               AND ADDR.`itemtype` = 'NetworkName'\n                                                               AND ADDR.`is_deleted` = '0')\n                           LEFT JOIN `glpi_entities` ON (ADDR.`entities_id` = `glpi_entities`.`id`)\n                           JOIN `glpi_networknames` AS NAME ON (NAME.`id` = ADDR.`items_id`\n                                                                AND NAME.`itemtype` = 'NetworkPort')\n                           JOIN `glpi_networkports` AS PORT ON (NAME.`items_id` = PORT.`id`\n                                                                AND PORT.`itemtype` = '{$itemtype}')\n                           JOIN `{$table}` AS ITEM ON (ITEM.`id` = PORT.`items_id`)\n                           WHERE LINK.`ipnetworks_id` = '" . $item->getID() . "')";
         }
         $queries[] = "(SELECT ADDR.`binary_0` AS binary_0,\n                               ADDR.`binary_1` AS binary_1,\n                               ADDR.`binary_2` AS binary_2,\n                               ADDR.`binary_3` AS binary_3,\n                               ADDR.`name`     AS ip,\n                               ADDR.`id`       AS id,\n                               ADDR.`itemtype` AS addr_item_type,\n                               ADDR.`items_id` AS addr_item_id,\n                               `glpi_entities`.`completename` AS entity,\n                               NAME.`id`       AS name_id,\n                               PORT.`id`       AS port_id,\n                               NULL            AS item_id,\n                               NULL            AS item_type\n                        FROM `glpi_ipaddresses_ipnetworks` AS LINK\n                        JOIN `glpi_ipaddresses` AS ADDR ON (ADDR.`id` = LINK.`ipaddresses_id`\n                                                            AND ADDR.`itemtype` = 'NetworkName'\n                                                            AND ADDR.`is_deleted` = '0')\n                        LEFT JOIN `glpi_entities` ON (ADDR.`entities_id` = `glpi_entities`.`id`)\n                        JOIN `glpi_networknames` AS NAME ON (NAME.`id` = ADDR.`items_id`\n                                                             AND NAME.`itemtype` = 'NetworkPort')\n                        JOIN `glpi_networkports` AS PORT\n                           ON (NAME.`items_id` = PORT.`id`\n                               AND PORT.`itemtype`\n                                    NOT IN ('" . implode("', '", $CFG_GLPI["networkport_types"]) . "'))\n                        WHERE LINK.`ipnetworks_id` = '" . $item->getID() . "')";
         $queries[] = "(SELECT ADDR.`binary_0` AS binary_0,\n                               ADDR.`binary_1` AS binary_1,\n                               ADDR.`binary_2` AS binary_2,\n                               ADDR.`binary_3` AS binary_3,\n                               ADDR.`name`     AS ip,\n                               ADDR.`id`       AS id,\n                               ADDR.`itemtype` AS addr_item_type,\n                               ADDR.`items_id` AS addr_item_id,\n                               `glpi_entities`.`completename` AS entity,\n                               NAME.`id`       AS name_id,\n                               NULL            AS port_id,\n                               NULL            AS item_id,\n                               NULL            AS item_type\n                        FROM `glpi_ipaddresses_ipnetworks` AS LINK\n                        JOIN `glpi_ipaddresses` AS ADDR ON (ADDR.`id` = LINK.`ipaddresses_id`\n                                                            AND ADDR.`itemtype` = 'NetworkName'\n                                                            AND ADDR.`is_deleted` = '0')\n                        LEFT JOIN `glpi_entities` ON (ADDR.`entities_id` = `glpi_entities`.`id`)\n                        JOIN `glpi_networknames` AS NAME ON (NAME.`id` = ADDR.`items_id`\n                                                             AND NAME.`itemtype` != 'NetworkPort')\n                        WHERE LINK.`ipnetworks_id` = '" . $item->getID() . "')";
         $queries[] = "(SELECT ADDR.`binary_0` AS binary_0,\n                               ADDR.`binary_1` AS binary_1,\n                               ADDR.`binary_2` AS binary_2,\n                               ADDR.`binary_3` AS binary_3,\n                               ADDR.`name`     AS ip,\n                               ADDR.`id`       AS id,\n                               ADDR.`itemtype` AS addr_item_type,\n                               ADDR.`items_id` AS addr_item_id,\n                               `glpi_entities`.`completename` AS entity,\n                               NULL            AS name_id,\n                               NULL            AS port_id,\n                               NULL            AS item_id,\n                               NULL            AS item_type\n                        FROM `glpi_ipaddresses_ipnetworks` AS LINK\n                        JOIN `glpi_ipaddresses` AS ADDR ON (ADDR.`id` = LINK.`ipaddresses_id`\n                                                            AND ADDR.`itemtype` != 'NetworkName'\n                                                            AND ADDR.`is_deleted` = '0')\n                        LEFT JOIN `glpi_entities` ON (ADDR.`entities_id` = `glpi_entities`.`id`)\n                        WHERE LINK.`ipnetworks_id` = '" . $item->getID() . "')";
         $query = implode('UNION ', $queries);
         if ($options['order'] == 'ip' || $options['order'] == 'itemtype') {
             $query .= " ORDER BY binary_0, binary_1, binary_2, binary_3";
         }
         if (isset($options['SQL_options'])) {
             $query .= "\n" . $options['SQL_options'];
         }
         $canedit = isset($options['canedit']) && $options['canedit'];
         $options['createRow'] = false;
         $address = new self();
         $ipaddress = new self();
         $networkname = new NetworkName();
         $networkport = new NetworkPort();
         $item = NULL;
         foreach ($DB->request($query) as $line) {
             unset($row);
             if ($options['order'] == 'itemtype' && !empty($line['item_type'])) {
                 $row = $options['group_' . $line['item_type']]->createRow();
             }
             if (!isset($row)) {
                 $row = $options['group_None']->createRow();
             }
             $ip_header = $row->getGroup()->getSuperHeaderByName('IP Address');
             $item_header = $row->getGroup()->getHeaderByName('Item', 'Item');
             $port_header = $row->getGroup()->getHeaderByName('Item', 'NetworkPort');
             $name_header = $row->getGroup()->getHeaderByName('Item', 'NetworkName');
             $entity_header = $row->getGroup()->getHeaderByName('Item', 'Entity');
             $row->addCell($ip_header, $line['ip'], $father);
             if (!empty($line['name_id'])) {
                 $networkname->getFromDB($line['name_id']);
                 $row->addCell($name_header, $networkname->getLink(), $father);
                 if (!empty($line['port_id'])) {
                     $networkport->getFromDB($line['port_id']);
                     $row->addCell($port_header, $networkport->getLink(), $father);
                     if (!empty($line['item_id']) && !empty($line['item_type'])) {
                         $itemtype = $line['item_type'];
                         $item = new $itemtype();
                         $item->getFromDB($line['item_id']);
                         $row->addCell($item_header, $item->getLink(), $father);
                     }
                 }
                 $row->addCell($entity_header, $line['entity'], $father);
             } else {
                 if (!empty($line['addr_item_id']) && !empty($line['addr_item_type'])) {
                     $itemtype = $line['addr_item_type'];
                     $item = new $itemtype();
                     $item->getFromDB($line['addr_item_id']);
                     if ($item instanceof CommonDBChild) {
                         $items = $item->recursivelyGetItems();
                         $elements = array($item->getLink());
                         foreach ($items as $item_) {
                             $elements[] = $item_->getLink();
                         }
                         $row->addCell($item_header, implode(' > ', $elements), $father);
                     } else {
                         $row->addCell($item_header, $item->getLink(), $father);
                     }
                     $row->addCell($entity_header, $line['entity'], $father);
                 }
             }
         }
     } else {
         if (isset($options['dont_display']['IPAddress'])) {
             return;
         }
         $header = $row->getGroup()->getHeaderByName('Internet', __CLASS__);
         if (!$header) {
             return;
         }
         if (empty($item)) {
             if (empty($father)) {
                 return;
             }
             $item = $father->getItem();
         }
         $query = "SELECT `id`\n                                  FROM `glpi_ipaddresses`\n                                  WHERE `items_id` = '" . $item->getID() . "'\n                                        AND `itemtype` = '" . $item->getType() . "'\n                                        AND `is_deleted` = '0'";
         $canedit = isset($options['canedit']) && $options['canedit'];
         $createRow = isset($options['createRow']) && $options['createRow'];
         $options['createRow'] = false;
         $address = new self();
         foreach ($DB->request($query) as $ipaddress) {
             if ($address->getFromDB($ipaddress['id'])) {
//.........这里部分代码省略.........
开发者ID:stweil,项目名称:glpi,代码行数:101,代码来源:ipaddress.class.php

示例14: array

 /**
  * Get the SEARCH_OPTION array
  *
  * @param $itemtype
  * @param $withplugins boolean get search options from plugins (true by default)
  *
  * @return the reference to  array of search options for the given item type
  **/
 static function &getOptions($itemtype, $withplugins = true)
 {
     global $CFG_GLPI;
     static $search = array();
     $item = NULL;
     if (!isset($search[$itemtype])) {
         // standard type first
         switch ($itemtype) {
             case 'Internet':
                 $search[$itemtype]['common'] = __('Characteristics');
                 $search[$itemtype][1]['table'] = 'networkport_types';
                 $search[$itemtype][1]['field'] = 'name';
                 $search[$itemtype][1]['name'] = __('Name');
                 $search[$itemtype][1]['datatype'] = 'itemlink';
                 $search[$itemtype][1]['searchtype'] = 'contains';
                 $search[$itemtype][2]['table'] = 'networkport_types';
                 $search[$itemtype][2]['field'] = 'id';
                 $search[$itemtype][2]['name'] = __('ID');
                 $search[$itemtype][2]['searchtype'] = 'contains';
                 $search[$itemtype][31]['table'] = 'glpi_states';
                 $search[$itemtype][31]['field'] = 'completename';
                 $search[$itemtype][31]['name'] = __('Status');
                 $search[$itemtype] += NetworkPort::getSearchOptionsToAdd('networkport_types');
                 break;
             case 'AllAssets':
                 $search[$itemtype]['common'] = __('Characteristics');
                 $search[$itemtype][1]['table'] = 'asset_types';
                 $search[$itemtype][1]['field'] = 'name';
                 $search[$itemtype][1]['name'] = __('Name');
                 $search[$itemtype][1]['datatype'] = 'itemlink';
                 $search[$itemtype][1]['searchtype'] = 'contains';
                 $search[$itemtype][2]['table'] = 'asset_types';
                 $search[$itemtype][2]['field'] = 'id';
                 $search[$itemtype][2]['name'] = __('ID');
                 $search[$itemtype][2]['searchtype'] = 'contains';
                 $search[$itemtype][31]['table'] = 'glpi_states';
                 $search[$itemtype][31]['field'] = 'completename';
                 $search[$itemtype][31]['name'] = __('Status');
                 $search[$itemtype] += Location::getSearchOptionsToAdd();
                 $search[$itemtype][5]['table'] = 'asset_types';
                 $search[$itemtype][5]['field'] = 'serial';
                 $search[$itemtype][5]['name'] = __('Serial number');
                 $search[$itemtype][6]['table'] = 'asset_types';
                 $search[$itemtype][6]['field'] = 'otherserial';
                 $search[$itemtype][6]['name'] = __('Inventory number');
                 $search[$itemtype][16]['table'] = 'asset_types';
                 $search[$itemtype][16]['field'] = 'comment';
                 $search[$itemtype][16]['name'] = __('Comments');
                 $search[$itemtype][16]['datatype'] = 'text';
                 $search[$itemtype][70]['table'] = 'glpi_users';
                 $search[$itemtype][70]['field'] = 'name';
                 $search[$itemtype][70]['name'] = __('User');
                 $search[$itemtype][7]['table'] = 'asset_types';
                 $search[$itemtype][7]['field'] = 'contact';
                 $search[$itemtype][7]['name'] = __('Alternate username');
                 $search[$itemtype][7]['datatype'] = 'string';
                 $search[$itemtype][8]['table'] = 'asset_types';
                 $search[$itemtype][8]['field'] = 'contact_num';
                 $search[$itemtype][8]['name'] = __('Alternate username number');
                 $search[$itemtype][8]['datatype'] = 'string';
                 $search[$itemtype][71]['table'] = 'glpi_groups';
                 $search[$itemtype][71]['field'] = 'completename';
                 $search[$itemtype][71]['name'] = __('Group');
                 $search[$itemtype][19]['table'] = 'asset_types';
                 $search[$itemtype][19]['field'] = 'date_mod';
                 $search[$itemtype][19]['name'] = __('Last update');
                 $search[$itemtype][19]['datatype'] = 'datetime';
                 $search[$itemtype][19]['massiveaction'] = false;
                 $search[$itemtype][23]['table'] = 'glpi_manufacturers';
                 $search[$itemtype][23]['field'] = 'name';
                 $search[$itemtype][23]['name'] = __('Manufacturer');
                 $search[$itemtype][24]['table'] = 'glpi_users';
                 $search[$itemtype][24]['field'] = 'name';
                 $search[$itemtype][24]['linkfield'] = 'users_id_tech';
                 $search[$itemtype][24]['name'] = __('Technician in charge of the hardware');
                 $search[$itemtype][80]['table'] = 'glpi_entities';
                 $search[$itemtype][80]['field'] = 'completename';
                 $search[$itemtype][80]['name'] = __('Entity');
                 break;
             default:
                 if ($item = getItemForItemtype($itemtype)) {
                     $search[$itemtype] = $item->getSearchOptions();
                 }
                 break;
         }
         if (Session::getLoginUserID() && in_array($itemtype, $CFG_GLPI["ticket_types"])) {
             $search[$itemtype]['tracking'] = __('Assistance');
             $search[$itemtype][60]['table'] = 'glpi_tickets';
             $search[$itemtype][60]['field'] = 'id';
             $search[$itemtype][60]['datatype'] = 'count';
             $search[$itemtype][60]['name'] = _x('quantity', 'Number of tickets');
             $search[$itemtype][60]['forcegroupby'] = true;
//.........这里部分代码省略.........
开发者ID:jose-martins,项目名称:glpi,代码行数:101,代码来源:search.class.php

示例15: post_addItem

 function post_addItem()
 {
     global $DB, $CFG_GLPI;
     // Manage add from template
     if (isset($this->input["_oldID"])) {
         // ADD Devices
         Item_devices::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Infocoms
         Infocom::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Ports
         NetworkPort::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Contract
         Contract_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Documents
         Document_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
         // ADD Computers
         Computer_Item::cloneItem($this->getType(), $this->input["_oldID"], $this->fields['id']);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:19,代码来源:phone.class.php


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