-
Notifications
You must be signed in to change notification settings - Fork 0
/
exportDataFromXML.php
64 lines (59 loc) · 1.95 KB
/
exportDataFromXML.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
// Export Districts From XML
function exportDistrictsFromXML($districts){
$allDistricts = array();
$i = 0;
foreach ($districts as $district) {
$d = new District($district->DistrictId, $district->DistrictName, $district->Latitude, $district->Longitude);
$allDistricts[$i]=$d;
$i++;
}
return $allDistricts;
}
// Export Municipalities From XML
function exportMunicipalitiesFromXML($municipalities){
$allMunicipalities = array();
$i = 0;
foreach ($municipalities as $muni) {
$m = new Municipality($muni->MunicipalityId, $muni->MunicipalityName, $muni->Latitude, $muni->Longitude);
$allMunicipalities[$i] = $m;
$i++;
}
return $allMunicipalities;
}
// Export Parishes From XML
function exportParishesFromXML($parishes){
$allParishes = array();
$i = 0;
foreach ($parishes as $parish) {
$p = new Parish($parish->ParishId, $parish->ParishName, $parish->Latitude, $parish->Longitude);
$allParishes[$i] = $p;
$i++;
}
return $allParishes;
}
// Export Pharmacies From XML
function exportPharmaciesFromXML($pharmacies){
$allPharmacies = array();
$i = 0;
foreach($pharmacies as $pharmacy) {
$ph = new Pharmacy($pharmacy->POISourceId, $pharmacy->Name, $pharmacy->Parish, $pharmacy->Address, $pharmacy->Locality, $pharmacy->HouseNumber, $pharmacy->ZipCode, $pharmacy->Phone, $pharmacy->Fax, $pharmacy->Latitude, $pharmacy->Longitude);
$allPharmacies[$i] = $ph;
$i++;
}
return $allPharmacies;
}
// Export Pharmacies From XML
function exportPharmaciesServiceFromXML($pharmacies){
$allPharmaciesAtService = array();
$i = 0;
foreach($pharmacies as $pharmacy) {
$ph = new Pharmacy($pharmacy->Code, $pharmacy->Name, $pharmacy->Address->Parish, $pharmacy->Address->Street, $pharmacy->Address->Locality,
'', $pharmacy->Address->ZipCode, $pharmacy->Phone, $pharmacy->Fax, $pharmacy->Address->Coordinates->Latitude,
$pharmacy->Address->Coordinates->Longitude);
$allPharmaciesAtService[$i] = $ph;
$i++;
}
return $allPharmaciesAtService;
}
?>