Changeset 7784 for trunk/src/map/inc/kmlHandler.php
- Timestamp:
- Apr 16, 2010, 10:55:40 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/map/inc/kmlHandler.php
r7769 r7784 19 19 foreach($xml->Document->Folder->Placemark as $placemark) 20 20 { 21 /* 22 * Getting all data from the datatags in the KML file. 23 * First we declare variables we will use. 24 * Then we itirate trough all the data and fill the variables 25 */ 26 $location; 27 $status; 28 $interfaces; 29 $masterIP; 30 $nodeType; 31 $type; 32 $hostname; 33 $hasBeenChecked; 34 $checkExecutionTime; 35 $currentState; 36 $lastCheck; 37 $problemHasBeenAcknowledged; 38 39 foreach($placemark->ExtendedData->Data as $data) 40 { 41 foreach($data->attributes() as $nameAttribute => $name) 42 { 43 if($name == "location") 44 $location = $data->value; 45 elseif($name == "status") 46 $status = $data->value; 47 elseif($name == "interfaces") 48 $interfaces = $data->value; 49 elseif($name == "masterIP") 50 $masterIP = $data->value; 51 elseif($name == "nodeType") 52 $nodeType = $data->value; 53 elseif($name == "type") 54 $type = $data->value; 55 elseif($name == "hostname") 56 $hostname = $data->value; 57 elseif($name == "hasBeenChecked") 58 $hasBeenChecked = $data->value; 59 elseif($name == "checkExecutionTime") 60 $checkExecutionTime = $data->value; 61 elseif($name == "currentState") 62 $currentState = $data->value; 63 elseif($name == "problemHasBeenAcknowledged") 64 $problemHasBeenAcknowledged = $data->value; 65 elseif($name == "location") 66 $location = $data->value; 67 } 68 } 69 70 /* 71 * We now fill up our array with Longitude and Latitude and Name by accessing $placemark 72 * Then we fill the rest of the array with the variables we declared and filled earlier 73 */ 21 74 22 75 $markers[] = array( "latitude"=>$placemark->LookAt->latitude, 23 76 "longitude"=>$placemark->LookAt->longitude, 24 77 "name"=>$placemark->name, 25 " description"=>$placemark->description,26 " id"=>$counter);27 $counter++;78 "location"=>$location, 79 "status"=>$status); 80 28 81 } 29 82 return $markers;
Note:
See TracChangeset
for help on using the changeset viewer.