import UIKit
import MapKit
//import Firebase
// alle UIViewController() functions
class ThirdViewController: UIViewController {
@IBOutlet weak var mapView: MKMapView!
let locationManager = CLLocationManager()
override func viewDidLoad()
{
super.viewDidLoad()
requestLocationAccess()
//Regio instellen
var newRegion:MKCoordinateRegion = MKCoordinateRegion()
newRegion.center.latitude = -25.106303;
newRegion.center.longitude = 133.587542;
newRegion.span.latitudeDelta = 30;
newRegion.span.longitudeDelta = 30;
self.mapView.setRegion(newRegion, animated: true)
self.mapView.delegate = self
if let cityDetailsPath = Bundle.main.path(forResource: "Hostels", ofType: "plist"){
if let cityDetails = NSArray(contentsOfFile: cityDetailsPath) as? [[String: String]] {
for city in cityDetails
{
guard let latStr = city["latitude"] else { continue }
guard let lonStr = city["longitude"] else { continue }
guard let titleStr = city["title"] else { continue }
guard let subtitleStr = city["subTitle"] else { continue }
if let lat = Double(latStr) {
if let lon = Double(lonStr) {
let title = titleStr
let subTitle = subtitleStr
let annotation = PinAnnotation(coordinate: CLLocationCoordinate2DMake(lat,lon), title: title, subtitle: subTitle)
self.mapView.addAnnotation(annotation)
}
}
}
}
}
}
// Vraag locatie toestemming
func requestLocationAccess()
{
let status = CLLocationManager.authorizationStatus()
switch status
{
case .authorizedAlways, .authorizedWhenInUse:
return
case .denied, .restricted:
print("location access denied")
default:
locationManager.requestWhenInUseAuthorization()
}
}
func showLocations(location:PinAnnotation){
}
}
// alle UISearchBarDelegate functions
extension ThirdViewController: UISearchBarDelegate {
}
// alle MKMapViewDelegate functions
extension ThirdViewController: MKMapViewDelegate {
func createViewAnnotationForMap(mapView:MKMapView, annotation:MKAnnotation)->MKAnnotationView {
_ = "PinAnnotation"
if let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "PinAnnotation") {
return annotationView
}
else
{
let returnedAnnotationView:MKPinAnnotationView = MKPinAnnotationView(annotation: annotation, reuseIdentifier:"PinAnnotation")
returnedAnnotationView.animatesDrop = true
returnedAnnotationView.canShowCallout = true
return returnedAnnotationView
}
}
}
答案 0 :(得分:0)
$query = mysqli_query($db,"
SELECT a.*,b.collection_id,c.contract_id,d.customer_name
FROM `rentals_invoice` As a
INNER JOIN rental_collection As b ON b.collection_id = a.collection_id
INNER JOIN rental_contract AS c ON c.contract_id = b.contract_id
INNER JOIN customer_information AS d ON d.customer_cnic = c.customer_cnic
");