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


PHP NetworkPort::getLink方法代码示例

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


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

示例1: displayLine

 static function displayLine($data, $displayhost = 1)
 {
     global $DB, $CFG_GLPI;
     $pMonitoringService = new PluginMonitoringService();
     $networkPort = new NetworkPort();
     $pMonitoringComponent = new PluginMonitoringComponent();
     $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
     $entity = new Entity();
     $pMonitoringService->getFromDB($data['id']);
     echo "<td width='32' class='center'>";
     $shortstate = self::getState($data['state'], $data['state_type'], $data['event'], $data['is_acknowledged']);
     $alt = __('Ok', 'monitoring');
     if ($shortstate == 'orange') {
         $alt = __('Warning (data)', 'monitoring');
     } else {
         if ($shortstate == 'yellow') {
             $alt = __('Warning (connection)', 'monitoring');
         } else {
             if ($shortstate == 'red') {
                 $alt = __('Critical', 'monitoring');
             } else {
                 if ($shortstate == 'redblue') {
                     $alt = __('Critical / Acknowledge', 'monitoring');
                 }
             }
         }
     }
     echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/box_" . $shortstate . "_32.png'\n         title='" . $alt . "' alt='" . $alt . "' />";
     echo "</td>";
     echo "<td>";
     $entity->getFromDB($data['entities_id']);
     echo $entity->fields['completename'];
     echo "</td>";
     $pMonitoringComponent->getFromDB($data['plugin_monitoring_components_id']);
     echo "<td class='center'>";
     $timezone = '0';
     if (isset($_SESSION['plugin_monitoring_timezone'])) {
         $timezone = $_SESSION['plugin_monitoring_timezone'];
     }
     if ($pMonitoringComponent->fields['graph_template'] != '') {
         echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display.form.php?itemtype=PluginMonitoringService&items_id=" . $data['id'] . "'>";
         $pmServicegraph = new PluginMonitoringServicegraph();
         ob_start();
         $pmServicegraph->displayGraph($pMonitoringComponent->fields['graph_template'], "PluginMonitoringService", $data['id'], "0", '2h', "div", "600");
         $div = ob_get_contents();
         ob_end_clean();
         $chart = "<table width='600' class='tab_cadre'><tr><td>" . $div . "</td></tr></table>";
         Html::showToolTip($chart, array('img' => $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/stats_32.png"));
         $pmServicegraph->displayGraph($pMonitoringComponent->fields['graph_template'], "PluginMonitoringService", $data['id'], "0", '2h', "js");
     }
     echo "</a>";
     echo "</td>";
     if ($displayhost == '1') {
         $pmComponentscatalog_Host->getFromDB($data["plugin_monitoring_componentscatalogs_hosts_id"]);
         if (isset($pmComponentscatalog_Host->fields['itemtype']) and $pmComponentscatalog_Host->fields['itemtype'] != '') {
             $itemtype = $pmComponentscatalog_Host->fields['itemtype'];
             $item = new $itemtype();
             $item->getFromDB($pmComponentscatalog_Host->fields['items_id']);
             echo "<td>";
             echo $item->getTypeName() . " : " . $item->getLink();
             if (!is_null($pMonitoringService->fields['networkports_id']) and $pMonitoringService->fields['networkports_id'] > 0) {
                 $networkPort->getFromDB($pMonitoringService->fields['networkports_id']);
                 echo " [" . $networkPort->getLink() . "]";
             }
             echo "</td>";
         } else {
             echo "<td>" . __('Resources', 'monitoring') . "</td>";
         }
     }
     echo "<td>" . $pMonitoringComponent->getLink();
     if (!is_null($pMonitoringService->fields['networkports_id']) and $pMonitoringService->fields['networkports_id'] > 0) {
         $networkPort->getFromDB($pMonitoringService->fields['networkports_id']);
         echo " [" . $networkPort->getLink() . "]";
     }
     echo "</td>";
     //      $nameitem = '';
     //      if (isset($itemmat->fields['name'])) {
     //         $nameitem = "[".$itemmat->getLink(1)."]";
     //      }
     //if ($pMonitoringService->fields['plugin_monitoring_services_id'] == '0') {
     //echo "<td>".$itemmat->getLink(1)."</td>";
     //      } else {
     //         $pMonitoringServiceH->getFromDB($pMonitoringService->fields['plugin_monitoring_services_id']);
     //         $itemtypemat = $pMonitoringServiceH->fields['itemtype'];
     //         $itemmat = new $itemtypemat();
     //         $itemmat->getFromDB($pMonitoringServiceH->fields['items_id']);
     //         echo "<td>".$pMonitoringService->getLink(1).$nameitem." ".__('on', 'monitoring')." ".$itemmat->getLink(1)."</td>";
     //      }
     //      unset($itemmat);
     echo "<td class='center'>";
     if ($shortstate == 'red') {
         echo "<table>";
         echo "<tr>";
         echo "<td>";
         echo $data['state'];
         echo "</td>";
         echo "<td>";
         echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/acknowledge.form.php?id=" . $data['id'] . "'>" . "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/acknowledge_checked.png'" . " alt='" . __('Define an acknowledge', 'monitoring') . "'" . " title='" . __('Define an acknowledge', 'monitoring') . "'/>" . "</a>";
         echo "</td>";
         echo "</tr>";
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:display.class.php

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

示例3: getInstantiationNetworkPortHTMLTable

 /**
  * \brief display the attached NetworkPort
  *
  * NetworkPortAlias and NetworkPortAggregate are based on other physical network ports
  * (Ethernet or Wifi). This method displays the physical network ports.
  **/
 function getInstantiationNetworkPortHTMLTable()
 {
     $netports = array();
     // Manage alias
     if (isset($this->fields['networkports_id_alias'])) {
         $links_id = $this->fields['networkports_id_alias'];
         $netport = new NetworkPort();
         if ($netport->getFromDB($links_id)) {
             $netports[] = $netport->getLink();
         }
     }
     // Manage aggregate
     if (isset($this->fields['networkports_id_list'])) {
         $links_id = $this->fields['networkports_id_list'];
         $netport = new NetworkPort();
         foreach ($links_id as $id) {
             if ($netport->getFromDB($id)) {
                 $netports[] = $netport->getLink();
             }
         }
     }
     if (count($netports) > 0) {
         return implode('<br>', $netports);
     }
     return "&nbsp;";
 }
开发者ID:stweil,项目名称:glpi,代码行数:32,代码来源:networkportinstantiation.class.php

示例4: displayGraphs

 function displayGraphs($itemtype, $items_id)
 {
     global $CFG_GLPI;
     $pmComponent = new PluginMonitoringComponent();
     $pmConfig = new PluginMonitoringConfig();
     $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
     $networkPort = new NetworkPort();
     $item = new $itemtype();
     $item->getFromDB($items_id);
     $pmComponent->getFromDB($item->fields['plugin_monitoring_components_id']);
     if (!isset($_SESSION['glpi_plugin_monitoring']['perfname'][$pmComponent->fields['id']])) {
         PluginMonitoringToolbox::loadPreferences($pmComponent->fields['id']);
     }
     $css_width = '950';
     if (isset($_GET['mobile'])) {
         $css_width = '300';
     }
     echo "<table class='tab_cadre' width='" . $css_width . "'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     $title = Dropdown::getDropdownName(getTableForItemType('PluginMonitoringComponent'), $item->fields['plugin_monitoring_components_id']);
     if (!is_null($item->fields['networkports_id']) && $item->fields['networkports_id'] > 0) {
         $networkPort->getFromDB($item->fields['networkports_id']);
         $title .= " [" . $networkPort->getLink() . "]";
     }
     $title .= ' ' . __('on', 'monitoring') . ' ';
     $pmComponentscatalog_Host->getFromDB($item->fields["plugin_monitoring_componentscatalogs_hosts_id"]);
     if (isset($pmComponentscatalog_Host->fields['itemtype']) and $pmComponentscatalog_Host->fields['itemtype'] != '') {
         $itemtype2 = $pmComponentscatalog_Host->fields['itemtype'];
         $item2 = new $itemtype2();
         $item2->getFromDB($pmComponentscatalog_Host->fields['items_id']);
         $title .= str_replace("'", "\"", $item2->getLink() . " (" . $item2->getTypeName() . ")");
     }
     echo $title;
     echo "</th>";
     echo "<th width='200'>";
     if (!isset($_GET['mobile'])) {
         echo "<form method='post'>";
         $a_timezones = PluginMonitoringConfig::getTimezones();
         if (!isset($_SESSION['plugin_monitoring_timezone'])) {
             $_SESSION['plugin_monitoring_timezone'] = '0';
         }
         $a_timezones_allowed = array();
         $pmConfig->getFromDB(1);
         $a_temp = importArrayFromDB($pmConfig->fields['timezones']);
         foreach ($a_temp as $key) {
             $a_timezones_allowed[$key] = $a_timezones[$key];
         }
         if (count($a_timezones_allowed) == '0') {
             $a_timezones_allowed['0'] = $a_timezones['0'];
         }
         Dropdown::showFromArray('plugin_monitoring_timezone', $a_timezones_allowed, array('value' => $_SESSION['plugin_monitoring_timezone']));
         echo "&nbsp;<input type='submit' name='update' value=\"" . __('Save') . "\" class='submit'>";
         Html::closeForm();
     }
     echo "</th>";
     echo "</tr>";
     $timezone = '0';
     if (isset($_SESSION['plugin_monitoring_timezone'])) {
         $timezone = $_SESSION['plugin_monitoring_timezone'];
     }
     if (!isset($_GET['mobile'])) {
         echo "<tr class='tab_bg_1'>";
         echo "<th colspan='2'>";
         echo "<div id='legendlink'><a onClick='\$(\"#options\").toggle();'>[ Options ]</a></div>";
         echo "</th>";
         echo "</tr>";
         // * Display perfname
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='2'>";
         echo "<div id='options' style='display:none'>";
         PluginMonitoringToolbox::preferences($pmComponent->fields['id'], 0);
         echo "</div>";
         echo "</td>";
         echo "</tr>";
         // * Display date slider
         echo "<tr class='tab_bg_1'>";
         echo "<th colspan='2'>";
         echo __('Select date', 'monitoring') . " - " . __('Select time', 'monitoring');
         echo "</th>";
         echo "</tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<th colspan='2'>";
         $start = time();
         $oldvalue = current(getAllDatasFromTable('glpi_plugin_monitoring_serviceevents', "`plugin_monitoring_services_id`='" . $items_id . "'", false, 'date ASC LIMIT 1'));
         $date = new DateTime($oldvalue['date']);
         if ($date->getTimestamp() < $start) {
             $start = $date->getTimestamp();
         }
         $nbdays = round((date('U') - $start) / 86400);
         echo "<script type=\"text/javascript\">\n            \$(function() {\n                \$( \"#custom_date\" ).datepicker({ minDate: -" . $nbdays . ", maxDate: \"+0D\", dateFormat:'mm/dd/yy' });\n                \$( \"#custom_time\" ).timepicker();\n\n            });\n         </script>";
         echo '<center><input type="text" id="custom_date" value="' . date('m/d/Y') . '"> ' . ' <input type="text" id="custom_time" value="' . date('H:i') . '"></center>';
         echo "</th>";
         echo "</tr>";
     }
     $a_list = array();
     $a_list["2h"] = __("Last 2 hours", "monitoring");
     $a_list["12h"] = __("Last 12 hours", "monitoring");
     $a_list["1d"] = __("Last 24 hours", "monitoring");
     $a_list["1w"] = __("Last 7 days (average)", "monitoring");
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:display.class.php

示例5: showGraphsByHost

   /**
    * Display graphs of services associated with host
    *
    * @param $itemtype value type of item
    * @param $items_id integer id of the object
    *
    **/
   function showGraphsByHost($itemtype, $items_id) {
      global $CFG_GLPI,$DB;

      PluginMonitoringToolbox::loadLib();
      $pmComponentscatalog = new PluginMonitoringComponentscatalog();
      $pmComponent = new PluginMonitoringComponent();
      $pmServicegraph = new PluginMonitoringServicegraph();
      $networkPort = new NetworkPort();

      $query = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`
         WHERE `items_id`='".$items_id."'
            AND `itemtype`='".$itemtype."'";
      $result = $DB->query($query);

      echo '<center><input type="text" id="custom_date" value="'.date('m/d/Y').'"> '
              . ' <input type="text" id="custom_time" value="'.date('H:i').'"></center>';

      echo "<table class='tab_cadre_fixe'>";
      while ($data=$DB->fetch_array($result)) {
         $pmComponentscatalog->getFromDB($data['plugin_monitoring_componentscalalog_id']);

         $querys = "SELECT `glpi_plugin_monitoring_services`.* FROM `glpi_plugin_monitoring_services`
            LEFT JOIN `glpi_plugin_monitoring_components`
               on `plugin_monitoring_components_id` = `glpi_plugin_monitoring_components`.`id`
            WHERE `plugin_monitoring_componentscatalogs_hosts_id`='".$data['id']."'
               ORDER BY `name`";
         $results = $DB->query($querys);
         while ($datas=$DB->fetch_array($results)) {
            $pmComponent->getFromDB($datas['plugin_monitoring_components_id']);
            if ($pmComponent->fields['graph_template'] != 0) {
               echo "<tr>";
               echo "<td>";
               echo "<table class='tab_cadre'>";
               echo "<tr class='tab_bg_3'>";
               echo "<th>";
               echo "<a href='".$CFG_GLPI['root_doc']."/plugins/monitoring/front/display.form.php?itemtype=PluginMonitoringService&items_id=".$datas['id']."'>";
               echo $pmComponent->fields['name'];
               echo "</a>";
               if (!is_null($datas['networkports_id'])
                       && $datas['networkports_id'] > 0) {
                  $networkPort->getFromDB($datas['networkports_id']);
                  echo " [".$networkPort->getLink()."]";
               }
               echo "</th>";
               echo "</tr>";
               echo "<tr class='tab_bg_1'>";
               echo "<td style='position: relative'>";
               $pmServicegraph->displayGraph($pmComponent->fields['graph_template'],
                                             "PluginMonitoringService",
                                             $datas['id'],
                                             "0",
                                             "2h",
                                             "",
                                             920);
               echo "</td>";
               echo "</tr>";
               echo "</table>";
               echo "</td>";
               echo "</tr>";
            }
         }
      }

      echo "</tr>";
      echo "</table>";

   }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:74,代码来源:service.class.php

示例6: showHosts

 function showHosts($componentscatalogs_id, $static)
 {
     global $DB, $CFG_GLPI;
     if ($static == '1') {
         $this->addHost($componentscatalogs_id);
     }
     $rand = mt_rand();
     $query = "SELECT * FROM `" . $this->getTable() . "`\n         WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscatalogs_id . "'\n            AND `is_static`='" . $static . "'";
     $result = $DB->query($query);
     echo "<form method='post' name='componentscatalog_host_form{$rand}' id='componentscatalog_host_form{$rand}' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/front/componentscatalog_host.form.php\">";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     echo "<th colspan='5'>";
     if ($DB->numrows($result) == 0) {
         echo __('No associated hosts', 'monitoring');
     } else {
         echo __('Associated hosts', 'monitoring');
     }
     echo "</th>";
     echo "</tr>";
     echo "</table>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     echo "<th width='10'>&nbsp;</th>";
     echo "<th>" . __('Type') . "</th>";
     echo "<th>" . __('Entity') . "</th>";
     echo "<th>" . __('Name') . "</th>";
     echo "<th>" . __('Serial number') . "</th>";
     echo "<th>" . __('Inventory number') . "</th>";
     echo "</tr>";
     while ($data = $DB->fetch_array($result)) {
         $itemtype = $data['itemtype'];
         $item = new $itemtype();
         $display_normal = 1;
         $networkports = false;
         if ($itemtype == 'NetworkEquipment') {
             $querys = "SELECT * FROM `glpi_plugin_monitoring_services`\n               WHERE `plugin_monitoring_componentscatalogs_hosts_id`='" . $data['id'] . "'\n                  AND `networkports_id`='0'";
             $results = $DB->query($querys);
             if ($DB->numrows($results) == 0) {
                 $display_normal = 0;
             }
             $querys = "SELECT * FROM `glpi_plugin_monitoring_services`\n               WHERE `plugin_monitoring_componentscatalogs_hosts_id`='" . $data['id'] . "'\n                  AND `networkports_id`!='0'";
             $results = $DB->query($querys);
             if ($DB->numrows($results) > 0) {
                 $networkports = true;
             }
         }
         $item->getFromDB($data['items_id']);
         if ($display_normal == 1) {
             echo "<tr>";
             echo "<td>";
             echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
             echo "</td>";
             echo "<td class='center'>";
             echo $item->getTypeName();
             echo "</td>";
             echo "<td class='center'>";
             echo Dropdown::getDropdownName("glpi_entities", $item->fields['entities_id']) . "</td>";
             echo "<td class='center" . (isset($item->fields['is_deleted']) && $item->fields['is_deleted'] ? " tab_bg_2_2'" : "'");
             echo ">" . $item->getLink() . "</td>";
             echo "<td class='center'>" . (isset($item->fields["serial"]) ? "" . $item->fields["serial"] . "" : "-") . "</td>";
             echo "<td class='center'>" . (isset($item->fields["otherserial"]) ? "" . $item->fields["otherserial"] . "" : "-") . "</td>";
             echo "</tr>";
         }
         if ($networkports) {
             $itemport = new NetworkPort();
             while ($datas = $DB->fetch_array($results)) {
                 $itemport->getFromDB($datas['networkports_id']);
                 echo "<tr>";
                 echo "<td>";
                 echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
                 echo "</td>";
                 echo "<td class='center'>";
                 echo $itemport->getTypeName();
                 echo "</td>";
                 echo "<td class='center'>";
                 echo Dropdown::getDropdownName("glpi_entities", $item->fields['entities_id']) . "</td>";
                 echo "<td colspan='3' class='left" . (isset($item->fields['is_deleted']) && $item->fields['is_deleted'] ? " tab_bg_2_2'" : "'");
                 echo ">" . $itemport->getLink() . " on " . $item->getLink(1) . "</td>";
                 echo "</tr>";
             }
         }
     }
     if ($static == '1') {
         Html::openArrowMassives("componentscatalog_host_form{$rand}", true);
         Html::closeArrowMassives(array('deleteitem' => _sx('button', 'Delete permanently')));
         Html::closeForm();
     }
     echo "</table>";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:90,代码来源:componentscatalog_host.class.php

示例7: displayLine

 static function displayLine($data, $displayhost = 1)
 {
     global $DB, $CFG_GLPI, $LANG;
     $pMonitoringService = new PluginMonitoringService();
     $networkPort = new NetworkPort();
     $pMonitoringComponent = new PluginMonitoringComponent();
     $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
     $pmServicegraph = new PluginMonitoringServicegraph();
     $entity = new Entity();
     $pMonitoringService->getFromDB($data['id']);
     echo "<td width='32' class='center'>";
     $shortstate = self::getState($data['state'], $data['state_type']);
     echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/box_" . $shortstate . "_32.png'/>";
     echo "</td>";
     echo "<td>";
     $entity->getFromDB($data['entities_id']);
     echo $entity->fields['completename'];
     echo "</td>";
     $pMonitoringComponent->getFromDB($data['plugin_monitoring_components_id']);
     echo "<td class='center'>";
     $img = '';
     $timezone = '0';
     if (isset($_SESSION['plugin_monitoring_timezone'])) {
         $timezone = $_SESSION['plugin_monitoring_timezone'];
     }
     $timezone_file = str_replace("+", ".", $timezone);
     $img = "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/send.php?file=PluginMonitoringService-" . $data['id'] . "-2h" . $timezone_file . ".png'/>";
     echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display.form.php?itemtype=PluginMonitoringService&items_id=" . $data['id'] . "'>";
     if (file_exists(GLPI_ROOT . "/files/_plugins/monitoring/PluginMonitoringService-" . $data['id'] . "-2h" . $timezone_file . ".png") or $pMonitoringComponent->fields['graph_template'] != '') {
         $img = "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/send.php?file=PluginMonitoringService-" . $data['id'] . "-2h" . $timezone_file . ".png'/>";
         showToolTip($img, array('img' => $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/stats_32.png"));
     } else {
     }
     echo "</a>";
     echo "</td>";
     if ($displayhost == '1') {
         $pmComponentscatalog_Host->getFromDB($data["plugin_monitoring_componentscatalogs_hosts_id"]);
         if (isset($pmComponentscatalog_Host->fields['itemtype']) and $pmComponentscatalog_Host->fields['itemtype'] != '') {
             $itemtype = $pmComponentscatalog_Host->fields['itemtype'];
             $item = new $itemtype();
             $item->getFromDB($pmComponentscatalog_Host->fields['items_id']);
             echo "<td>";
             echo $item->getTypeName() . " : " . $item->getLink();
             if (!is_null($pMonitoringService->fields['networkports_id']) and $pMonitoringService->fields['networkports_id'] > 0) {
                 $networkPort->getFromDB($pMonitoringService->fields['networkports_id']);
                 echo " [" . $networkPort->getLink() . "]";
             }
             echo "</td>";
         } else {
             echo "<td>" . $LANG['plugin_monitoring']['service'][0] . "</td>";
         }
     }
     echo "<td>" . $pMonitoringComponent->getLink();
     if (!is_null($pMonitoringService->fields['networkports_id']) and $pMonitoringService->fields['networkports_id'] > 0) {
         $networkPort->getFromDB($pMonitoringService->fields['networkports_id']);
         echo " [" . $networkPort->getLink() . "]";
     }
     echo "</td>";
     //      $nameitem = '';
     //      if (isset($itemmat->fields['name'])) {
     //         $nameitem = "[".$itemmat->getLink(1)."]";
     //      }
     //if ($pMonitoringService->fields['plugin_monitoring_services_id'] == '0') {
     //echo "<td>".$itemmat->getLink(1)."</td>";
     //      } else {
     //         $pMonitoringServiceH->getFromDB($pMonitoringService->fields['plugin_monitoring_services_id']);
     //         $itemtypemat = $pMonitoringServiceH->fields['itemtype'];
     //         $itemmat = new $itemtypemat();
     //         $itemmat->getFromDB($pMonitoringServiceH->fields['items_id']);
     //         echo "<td>".$pMonitoringService->getLink(1).$nameitem." ".$LANG['networking'][25]." ".$itemmat->getLink(1)."</td>";
     //      }
     //      unset($itemmat);
     echo "<td class='center'>";
     echo $data['state'];
     echo "</td>";
     echo "<td>";
     echo convDate($data['last_check']) . ' ' . substr($data['last_check'], 11, 8);
     echo "</td>";
     echo "<td>";
     echo $data['event'];
     echo "</td>";
     echo "<td align='center'>";
     $segments = CalendarSegment::getSegmentsBetween($pMonitoringComponent->fields['calendars_id'], date('w', date('U')), date('H:i:s'), date('w', date('U')), date('H:i:s'));
     if (count($segments) == '0') {
         echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/service_pause.png' />";
     } else {
         echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/service_run.png' />";
     }
     echo "</td>";
     if ($displayhost == '0') {
         $pmUnavaibility = new PluginMonitoringUnavaibility();
         $pmUnavaibility->displayValues($pMonitoringService->fields['id'], 'currentmonth', 1);
         $pmUnavaibility->displayValues($pMonitoringService->fields['id'], 'lastmonth', 1);
         $pmUnavaibility->displayValues($pMonitoringService->fields['id'], 'currentyear', 1);
         echo "<td>";
         $a_arg = importArrayFromDB($pMonitoringService->fields['arguments']);
         $cnt = '';
         if (count($a_arg) > 0) {
             $cnt = " (" . count($a_arg) . ")";
         }
//.........这里部分代码省略.........
开发者ID:RubichonL,项目名称:glpi_monitoring,代码行数:101,代码来源:display.class.php


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