showForItem() static public method

Show ports for an item
static public showForItem ( CommonDBTM $item, $withtemplate = '' )
$item CommonDBTM CommonDBTM object
$withtemplate integer withtemplate param (default '')
            Plugin::displayAction($netdevice, $_REQUEST['glpi_tab']);
            break;
        case 4:
            Infocom::showForItem($netdevice);
            Contract::showAssociated($netdevice);
            break;
        case 5:
            Document::showAssociated($netdevice, $_POST["withtemplate"]);
            break;
        case 6:
            Ticket::showListForItem('NetworkEquipment', $_POST["id"]);
            break;
        case 7:
            Link::showForItem('NetworkEquipment', $_POST["id"]);
            break;
        case 10:
            showNotesForm($_POST['target'], 'NetworkEquipment', $_POST["id"]);
            break;
        case 11:
            Reservation::showForItem('NetworkEquipment', $_POST["id"]);
            break;
        case 12:
            Log::showForItem($netdevice);
            break;
        default:
            if (!Plugin::displayAction($netdevice, $_REQUEST['glpi_tab'])) {
                NetworkPort::showForItem('NetworkEquipment', $_POST["id"]);
            }
    }
}
ajaxFooter();
示例#2
0
            case 4:
                Infocom::showForItem($phone);
                Contract::showAssociated($phone);
                break;
            case 5:
                Document::showAssociated($phone);
                break;
            case 6:
                Ticket::showListForItem('Phone', $_POST["id"]);
                break;
            case 7:
                Link::showForItem('Phone', $_POST["id"]);
                break;
            case 10:
                showNotesForm($_POST['target'], 'Phone', $_POST["id"]);
                break;
            case 11:
                Reservation::showForItem('Phone', $_POST["id"]);
                break;
            case 12:
                Log::showForItem($phone);
                break;
            default:
                if (!Plugin::displayAction($phone, $_REQUEST['glpi_tab'])) {
                    Computer_Item::showForItem($phone);
                    NetworkPort::showForItem('Phone', $_POST["id"], 'Phone', $_POST["withtemplate"]);
                }
        }
    }
}
ajaxFooter();
            case 4:
                Infocom::showForItem($periph);
                Contract::showAssociated($periph);
                break;
            case 5:
                Document::showAssociated($periph);
                break;
            case 6:
                Ticket::showListForItem('Peripheral', $_POST["id"]);
                break;
            case 7:
                Link::showForItem('Peripheral', $_POST["id"]);
                break;
            case 10:
                showNotesForm($_POST['target'], 'Peripheral', $_POST["id"]);
                break;
            case 11:
                Reservation::showForItem('Peripheral', $_POST["id"]);
                break;
            case 12:
                Log::showForItem($periph);
                break;
            default:
                if (!Plugin::displayAction($periph, $_REQUEST['glpi_tab'])) {
                    Computer_Item::showForItem($periph);
                    NetworkPort::showForItem('Peripheral', $_POST["id"], $_POST["withtemplate"]);
                }
        }
    }
}
ajaxFooter();
 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') {
         if (Session::haveRight("plugin_monitoring_componentscatalog", READ)) {
             echo "<form name='form' method='post' action='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/networkport.form.php'>";
             echo "<input type='hidden' name='items_id' value='" . $id . "' />";
             echo "<input type='hidden' name='itemtype' value='NetworkEquipment' />";
         }
         $nbcol++;
     }
     $a_pref = DisplayPreference::getForTypeUser('PluginFusioninventoryNetworkport', Session::getLoginUserID());
     echo "<table class='tab_cadre' cellpadding='" . $nbcol . "' width='1100'>";
     $result = $this->showNetworkPortDetailHeader($monitoring, $query);
     if ($result) {
         while ($data = $DB->fetch_array($result)) {
             $this->showNetworkPortDetail($data, $monitoring);
             if ($data['instantiation_type'] == 'NetworkPortAggregate') {
                 $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) {
                         $query_agp = "\n                     SELECT `glpi_networkports`.`id`, `instantiation_type`,\n                        `glpi_plugin_fusioninventory_networkports`.`id` as `fusionid`\n\n                     FROM glpi_plugin_fusioninventory_networkports\n\n                     LEFT JOIN glpi_networkports\n                     ON glpi_plugin_fusioninventory_networkports.networkports_id =\n                           glpi_networkports.id\n                     WHERE `glpi_networkports`.`id`='" . $port_id . "'\n                     LIMIT 1 ";
                         $result_agp = $DB->query($query_agp);
                         if ($DB->numrows($result_agp) > 0) {
                             $data_agp = $DB->fetch_assoc($result_agp);
                             $this->showNetworkPortDetail($data_agp, $monitoring, TRUE);
                         }
                     }
                 }
             }
         }
     }
     if ($monitoring == '1') {
         if (Session::haveRight("plugin_monitoring_componentscatalog", UPDATE)) {
             echo "<tr class='tab_bg_1 center'>";
             echo "<td colspan='2'></td>";
             echo "<td class='center'>";
             echo "<input type='submit' class='submit' name='update' value='" . __s('Save') . "'/>";
             echo "</td>";
             echo "<td colspan='" . count($a_pref) . "'></td>";
             echo "</tr>";
         }
     }
     echo "</table>";
     if ($monitoring == '1') {
         if (Session::haveRight("plugin_monitoring_componentscatalog", UPDATE)) {
             Html::closeForm();
         }
     }
 }
示例#5
0
     Infocom::showForItem($computer);
     Contract::showAssociated($computer, $_POST["withtemplate"]);
     Document::showAssociated($computer);
     Ticket::showListForItem('Computer', $_POST["id"]);
     Link::showForItem('Computer', $_POST["id"]);
     RegistryKey::showForComputer($_POST["id"]);
     ComputerVirtualMachine::showForVirtualMachine($computer);
     ComputerVirtualMachine::showForComputer($computer);
     Plugin::displayAction($computer, $_REQUEST['glpi_tab']);
     break;
 case 2:
     Computer_SoftwareVersion::showForComputer($computer);
     break;
 case 3:
     Computer_Item::showForComputer($_POST['target'], $computer);
     NetworkPort::showForItem('Computer', $_POST["id"]);
     break;
 case 4:
     Infocom::showForItem($computer);
     Contract::showAssociated($computer);
     break;
 case 5:
     Document::showAssociated($computer);
     break;
 case 6:
     Ticket::showListForItem('Computer', $_POST["id"]);
     break;
 case 7:
     Link::showForItem('Computer', $_POST["id"]);
     break;
 case 10:
示例#6
0
 switch ($_REQUEST['glpi_tab']) {
     case -1:
         Cartridge::showInstalled($printer);
         Cartridge::showInstalled($printer, 1);
         Computer_Item::showForItem($printer);
         NetworkPort::showForItem('Printer', $_POST["id"], $_POST["withtemplate"]);
         Infocom::showForItem($printer);
         Contract::showAssociated($printer);
         Document::showAssociated($printer);
         Ticket::showListForItem('Printer', $_POST["id"]);
         Link::showForItem('Printer', $_POST["id"]);
         Plugin::displayAction($printer, $_REQUEST['glpi_tab']);
         break;
     case 3:
         Computer_Item::showForItem($printer);
         NetworkPort::showForItem('Printer', $_POST["id"]);
         break;
     case 4:
         Infocom::showForItem($printer);
         Contract::showAssociated($printer);
         break;
     case 5:
         Document::showAssociated($printer);
         break;
     case 6:
         Ticket::showListForItem('Printer', $_POST["id"]);
         break;
     case 7:
         Link::showForItem('Printer', $_POST["id"]);
         break;
     case 10: