Example #1
0
 }
 #
 # print IP address
 #
 # ip - range
 if (@$addresses[$n]->class == "compressed-range") {
     print "<tr class='dhcp'>";
     print "\t<td>";
     # status icon
     if ($subnet['pingSubnet'] == "1") {
         print "\t\t<span class='status status-padded'></span>";
     }
     print $Subnets->transform_to_dotted($addresses[$n]->ip_addr) . ' - ' . $Subnets->transform_to_dotted($addresses[$n]->stopIP) . " (" . $addresses[$n]->numHosts . ")";
     print $Addresses->address_type_format_tag($addresses[$n]->state);
     print "\t</td>";
     print "\t<td>" . $Addresses->address_type_index_to_type($addresses[$n]->state) . " (" . _("range") . ")</td>";
     print "\t<td>" . $addresses[$n]->description . "</td>";
     if ($colspan['dhcp'] != 0) {
         print "\t<td colspan='{$colspan['dhcp']}' class='unused'></td>";
     }
     // tr ends after!
 } else {
     print "<tr>";
     # status icon
     if ($subnet['pingSubnet'] == "1") {
         //calculate
         $tDiff = time() - strtotime($addresses[$n]->lastSeen);
         if ($addresses[$n]->excludePing == "1") {
             $hStatus = "padded";
             $hTooltip = "";
         } elseif ($tDiff < $statuses[0]) {
 if ($result_addresses[$m]->subnetId != $result_addresses[$m - 1]->subnetId) {
     //new line
     $lineCount++;
     //subnet details
     $worksheet->write($lineCount, 0, $Subnets->transform_to_dotted($subnet['subnet']) . "/" . $subnet['mask'] . " - " . $subnet['description'] . $vlanText, $format_title);
     $worksheet->mergeCells($lineCount, 0, $lineCount, $colSpan - 1);
     //new line
     $lineCount++;
 }
 $m++;
 $x = 0;
 $worksheet->write($lineCount, $x, $Subnets->transform_to_dotted($ip['ip_addr']), $format_left);
 $x++;
 # state
 if (in_array('state', $selected_ip_fields)) {
     $worksheet->write($lineCount, $x, _($Addresses->address_type_index_to_type($ip['state'])));
     $x++;
 }
 $worksheet->write($lineCount, $x, $ip['description']);
 $x++;
 $worksheet->write($lineCount, $x, $ip['dns_name']);
 $x++;
 # switch
 if (in_array('switch', $selected_ip_fields)) {
     if (strlen($ip['switch']) > 0 && $ip['switch'] != 0) {
         $device = (array) $Tools->fetch_device(null, $ip['switch']);
         $ip['switch'] = $device != 0 ? $device['hostname'] : "";
     } else {
         $ip['switch'] = "";
     }
     $worksheet->write($lineCount, $x, $ip['switch']);