Ignore:
Timestamp:
Feb 7, 2013, 9:45:02 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Pozice zařízení se nyní zadává jako výběr položky ze samostatné tabulky pojmenovaných pozic. To by mělo zjednodušit zadávání pozice nových zařízení a sloučit do jedné značky více zařízení ve ze stejné pozice.
  • Přidáno: Základní datová struktura pro evidenci zaměstnanců.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Map/Map.php

    r474 r482  
    6161    while($Link = $DbResult->fetch_assoc())
    6262    {
    63       $DbResult2 = $this->Database->query('SELECT * FROM NetworkDevice WHERE NetworkDevice.Id = (SELECT Device FROM NetworkInterface WHERE NetworkInterface.Id = '.$Link['Interface1'].')');
    64       $DbResult3 = $this->Database->query('SELECT * FROM NetworkDevice WHERE NetworkDevice.Id = (SELECT Device FROM NetworkInterface WHERE NetworkInterface.Id = '.$Link['Interface2'].')');
     63      $DbResult2 = $this->Database->query('SELECT NetworkDevice.Used, MapPosition.Latitude, MapPosition.Longitude FROM NetworkDevice JOIN MapPosition ON MapPosition.Id = NetworkDevice.MapPosition WHERE NetworkDevice.Id = (SELECT NetworkInterface.Device FROM NetworkInterface WHERE NetworkInterface.Id = '.$Link['Interface1'].')');
     64      $DbResult3 = $this->Database->query('SELECT NetworkDevice.Used, MapPosition.Latitude, MapPosition.Longitude FROM NetworkDevice JOIN MapPosition ON MapPosition.Id = NetworkDevice.MapPosition WHERE NetworkDevice.Id = (SELECT NetworkInterface.Device FROM NetworkInterface WHERE NetworkInterface.Id = '.$Link['Interface2'].')');
    6565      if(($DbResult2->num_rows > 0) and ($DbResult3->num_rows > 0))
    6666      {
     
    6868        $Device2 = $DbResult3->fetch_assoc();
    6969        if(($Device1['Used'] == 1) and ($Device2['Used'] == 1))
    70           $Output .= 'new GPolyline([new GLatLng('.$Device1['PositionLatitude'].', '.$Device1['PositionLongitude'].'),new GLatLng('.$Device2['PositionLatitude'].', '.$Device2['PositionLongitude'].')], "#4F4FBF", 3, 0.8), ';
     70          $Output .= 'new GPolyline([new GLatLng('.$Device1['Latitude'].', '.$Device1['Longitude'].'),new GLatLng('.$Device2['Latitude'].', '.$Device2['Longitude'].')], "#4F4FBF", 3, 0.8), ';
    7171      }
    7272    }
     
    9999                    NetworkDevices = [';
    100100
    101     $DbResult = $this->Database->query('SELECT * FROM NetworkDevice WHERE Used=1');
     101    $DbResult = $this->Database->query('SELECT GROUP_CONCAT(NetworkDevice.Name SEPARATOR ",") AS Name, '.
     102      'MapPosition.Latitude AS Latitude, MapPosition.Longitude AS Longitude, MapPosition.Name AS NodeName '.
     103      'FROM NetworkDevice LEFT JOIN MapPosition ON MapPosition.Id = NetworkDevice.MapPosition '.
     104      'WHERE (NetworkDevice.Used=1) AND (NetworkDevice.MapPosition IS NOT NULL) '.
     105      'GROUP BY NetworkDevice.MapPosition');
    102106    while($Device = $DbResult->fetch_assoc())
    103107    {
    104       $Output .= 'new GMarker(new GLatLng('.$Device['PositionLatitude'].', '.$Device['PositionLongitude'].'), {title: "'.$Device['Name'].'", icon:tinyIcon }), ';
     108      $Output .= 'new GMarker(new GLatLng('.$Device['Latitude'].', '.
     109      $Device['Longitude'].'), {title: "'.$Device['NodeName'].': '.$Device['Name'].'", icon:tinyIcon }), ';
    105110    }
    106111    $Output .= '];
Note: See TracChangeset for help on using the changeset viewer.