\n", "download", "kml"); download_document_data("\n", "download", "kml"); download_document_data("\n", "download", "kml"); // Initial values $valid_device = array(); $invalid_device = array(); $valid_equip = array(); // Get all devices $equipment = db_fetch_all_lances(); if (is_array($equipment)) { foreach($equipment as $item) { // Valid device if ((!in_array($item['device'], $valid_device)) && (!in_array($item['device'], $invalid_device))) { // valid capability if (db_check_system_device_capabilities($item['device'], array("kortsluiting schakelen"))) { array_push($valid_device, $item['device']); } else { array_push($invalid_device, $item['device']); } } // Handle device? if (in_array($item['device'], $valid_device)) { array_push($valid_equip, $item); } } } // Define style download_document_data("\t\n", "download", "kml"); // Valid equipment? if (is_array($valid_equip)) { foreach($valid_equip as $equip) { // Get last position $last_position = db_fetch_lance_log_gps_info($equip['id']); if (is_array($last_position)) { download_document_data("\t\n", "download", "kml"); $device = db_fetch_system_device_name("nl", $equip['device'], "download"); $idcode = ($equip['idcode'] == $equip['serienr']) ? $equip['idcode'] : $equip['idcode'] . " - " . $equip['serienr']; download_document_data("\t" . $idcode . " (" . $device . ")" . "\n", "download", "kml"); download_document_data("\t\n", "download", "kml"); download_document_data("\t\t" . $last_position[0]['longitude'] . "," . $last_position[0]['latitude'] . ",0\n", "download", "kml"); download_document_data("\t\n", "download", "kml"); download_document_data("\t\n", "download", "kml"); download_document_data("\t\t" . $last_position[0]['longitude'] . "\n", "download", "kml"); download_document_data("\t\t" . $last_position[0]['latitude'] . "\n", "download", "kml"); download_document_data("\t\t" . date("Y-m-d", $last_position[0]['t']) . "T" . date("H:i:s", $last_position[0]['t']) . "\n", "download", "kml"); download_document_data("\t\t200\n", "download", "kml"); download_document_data("\t\n", "download", "kml"); download_document_data("\t#default\n", "download", "kml"); download_document_data("\t\n", "download", "kml"); } } } // KML footer download_document_data("\n", "download", "kml"); download_document_data("", "download", "kml"); ?>