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


PHP Interfaces::getInterfacesCrawlByCrawlCycle方法代码示例

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


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

示例1: getRoutersClients


//.........这里部分代码省略.........
     $xw->writeAttribute('id', 'sh_ip_online_highlighted_pushpin');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>0.5</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/ip_online_highlighted_1.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('ListStyle');
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_red-pushpin');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>0.5</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/ip_offline.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('ListStyle');
     $xw->endElement();
     $xw->startElement('Style');
     $xw->writeAttribute('id', 'sh_yellow-pushpin');
     $xw->startElement('IconStyle');
     $xw->writeRaw('<scale>0.5</scale>');
     $xw->startElement('Icon');
     $xw->writeRaw('<href>' . $GLOBALS['url_to_netmon'] . '/templates/' . $GLOBALS['template'] . '/img/ffmap/ip_unknown.png</href>');
     $xw->endElement();
     $xw->endElement();
     $xw->endElement();
     $xw->startElement('ListStyle');
     $xw->endElement();
     $xw->startElement('Folder');
     $xw->startElement('name');
     $xw->writeRaw('create');
     $xw->endElement();
     $last_endet_crawl_cycle = Crawling::getLastEndedCrawlCycle();
     $crawl_routers = Router_old::getCrawlRoutersByCrawlCycleId($last_endet_crawl_cycle['id']);
     foreach ($crawl_routers as $crawl_router) {
         $router_data = Router_old::getRouterInfo($crawl_router['router_id']);
         $crawl_interfaces = Interfaces::getInterfacesCrawlByCrawlCycle($last_endet_crawl_cycle['id'], $crawl_router['router_id']);
         $row['traffic'] = 0;
         foreach ($crawl_interfaces as $interface) {
             $traffic = $traffic + $interface['traffic_rx_avg'] + $interface['traffic_tx_avg'];
         }
         $traffic = round($traffic / 1024, 2);
         //Make coordinates and location information
         if (!empty($crawl_router['longitude']) and !empty($crawl_router['latitude'])) {
             $longitude = $crawl_router['longitude'];
             $latitude = $crawl_router['latitude'];
             $location = $crawl_router['location'];
             $do = true;
         } elseif (!empty($router_data['longitude']) and !empty($router_data['latitude'])) {
             $longitude = $router_data['longitude'];
             $latitude = $router_data['latitude'];
             $location = $router_data['location'];
             $do = true;
         } else {
             $do = false;
         }
         if ($do) {
             $xw->startElement('Placemark');
             $xw->startElement('name');
             $xw->writeRaw("<![CDATA[Router <a href='" . $GLOBALS['url_to_netmon'] . "/router.php?router_id=" . $router_data['router_id'] . "'>" . $router_data['hostname'] . "</a>]]>");
             $xw->endElement();
             $xw->startElement('description');
             $box_inhalt = "Clients";
             $xw->writeRaw("<![CDATA[{$box_inhalt}]]>");
             $xw->endElement();
             $xw->startElement('styleUrl');
             if ($crawl_router['client_count'] == 0) {
                 $xw->writeRaw('#sh_client-pushpin-0');
             } elseif ($crawl_router['client_count'] == 1) {
                 $xw->writeRaw('#sh_client-pushpin-1');
             } elseif ($crawl_router['client_count'] == 2) {
                 $xw->writeRaw('#sh_client-pushpin-2');
             } elseif ($crawl_router['client_count'] == 3) {
                 $xw->writeRaw('#sh_client-pushpin-3');
             } elseif ($crawl_router['client_count'] == 4) {
                 $xw->writeRaw('#sh_client-pushpin-4');
             } elseif ($crawl_router['client_count'] == 5) {
                 $xw->writeRaw('#sh_client-pushpin-5');
             } elseif ($crawl_router['client_count'] >= 6) {
                 $xw->writeRaw('#sh_client-pushpin-6');
             }
             $xw->endElement();
             $xw->startElement('Point');
             $xw->startElement('coordinates');
             $xw->writeRaw("{$longitude},{$latitude},0");
             $xw->endElement();
             $xw->endElement();
             $xw->endElement();
         }
     }
     $xw->endElement();
     $xw->endElement();
     $xw->endDocument();
     print $xw->outputMemory(true);
     return true;
 }
开发者ID:wAmpIre,项目名称:netmon,代码行数:101,代码来源:map.class.php

示例2: getRouterListByUserId

 public function getRouterListByUserId($user_id)
 {
     $routers = array();
     $last_endet_crawl_cycle = Crawling::getLastEndedCrawlCycle();
     try {
         $stmt = DB::getInstance()->prepare("SELECT  routers.id as router_id, routers.create_date as router_create_date, routers.*,\n\t\t\t\t\tchipsets.id as chipset_id, chipsets.name as chipset_name, chipsets.*,\n\t\t\t\t\tusers.id as user_id, users.*,\n\t\t\t\t\tcrawl_routers.status, crawl_routers.nodewatcher_version\n\n\t\t\t\t\tFROM routers\n\t\t\t\t\tLEFT JOIN chipsets on (chipsets.id=routers.chipset_id)\n\t\t\t\t\tLEFT JOIN users on (users.id=routers.user_id)\n\t\t\t\t\tLEFT JOIN crawl_routers on (crawl_routers.router_id=routers.id AND crawl_routers.crawl_cycle_id=?)\n\t\t\t\t\tWHERE routers.user_id=?");
         $stmt->execute(array($last_endet_crawl_cycle['id'], $user_id));
         $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     } catch (PDOException $e) {
         echo $e->getMessage();
         echo $e->getTraceAsString();
     }
     foreach ($rows as $row) {
         $text = $row['location'];
         $shorttext = $text;
         $length = 20;
         if (strlen($text) > $length) {
             $shorttext = substr($text, 0, $length - 1);
             $var = explode(" ", substr($text, $length, strlen($text)));
             $shorttext .= $var[0];
         }
         $row['short_location'] = $shorttext;
         $text = $row['chipset_name'];
         $shorttext = $text;
         $length = 16;
         if (strlen($text) > $length) {
             $shorttext = substr($text, 0, $length - 1);
             $var = explode(" ", substr($text, $length, strlen($text)));
             $shorttext .= $var[0];
         }
         $row['short_chipset_name'] = $shorttext;
         $row['actual_crawl_data'] = Router_old::getCrawlRouterByCrawlCycleId($last_endet_crawl_cycle['id'], $row['router_id']);
         $row['router_reliability'] = Router_old::getRouterReliability($row['router_id'], 500);
         $row['originators_count'] = count(BatmanAdvanced::getCrawlBatmanAdvOriginatorsByCrawlCycleId($last_endet_crawl_cycle['id'], $row['router_id']));
         $row['interfaces'] = Interfaces::getInterfacesCrawlByCrawlCycle($last_endet_crawl_cycle['id'], $row['router_id']);
         $row['traffic'] = 0;
         foreach ($row['interfaces'] as $interface) {
             $row['traffic'] = $row['traffic'] + $interface['traffic_rx_avg'] + $interface['traffic_tx_avg'];
         }
         $row['traffic'] = round($row['traffic'] / 1024, 2);
         $routers[] = $row;
     }
     return $routers;
 }
开发者ID:wAmpIre,项目名称:netmon,代码行数:44,代码来源:router_old.class.php


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