Repository navigation
Expand file tree
/
Copy pathgeneratemap.php
More file actions
94 lines (67 loc) · 3.35 KB
/
Copy pathgeneratemap.php
File metadata and controls
94 lines (67 loc) · 3.35 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
$previousID = -1;
$arrayOfSearch = array();
$temporaryArrayForThisItem = array();
while ($rowItemsInDB = mysql_fetch_object($resultForSearch)){
if ($rowItemsInDB->id != $previousID){
if ($previousID != -1)
array_push($arrayOfSearch, $temporaryArrayForThisItem);
$temporaryArrayForThisItem["id"] = $rowItemsInDB->id;
$temporaryArrayForThisItem["latitude"] = $rowItemsInDB->latitude;
$temporaryArrayForThisItem["longitude"] = $rowItemsInDB->longitude;
$temporaryArrayForThisItem["parish"] = $rowItemsInDB->parish;
$temporaryArrayForThisItem["city"] = $rowItemsInDB->city;
$temporaryArrayForThisItem["current_country"] = $rowItemsInDB->current_county;
$temporaryArrayForThisItem["event_type"] = $rowItemsInDB->eventtype_id;
$temporaryArrayForThisItem["start_date"] = $rowItemsInDB->start_date;
$temporaryArrayForThisItem["short_title"] = $rowItemsInDB->short_title;
$temporaryArrayForThisItem["short_desc"] = $rowItemsInDB->short_desc;
$temporaryArrayForThisItem["eventtype"] = $rowItemsInDB->event_type;
$temporaryArrayForThisItem["eventtypeorig"] = $rowItemsInDB->eventtype_id;
$temporaryArrayForThisItem["type"] = $rowItemsInDB->event_type_class;
}else{
$temporaryArrayForThisItem["eventtype"] .= "_" . $rowItemsInDB->event_type;
$temporaryArrayForThisItem["eventtypeorig"] .= "_" . $rowItemsInDB->eventtype_id;
}
$previousID = $rowItemsInDB->id;
}
if ($previousID != -1)
array_push($arrayOfSearch, $temporaryArrayForThisItem);
echo '<markers>';
foreach($arrayOfSearch as $arrayOfThisItem){
if ($arrayOfThisItem["latitude"] != "" && $arrayOfThisItem["longitude"] != "")
if (!isset($enteredLocations[$arrayOfThisItem["latitude"] . "-" . $arrayOfThisItem["longitude"]]))
{
$enteredLocations[$arrayOfThisItem["latitude"] . "-" . $arrayOfThisItem["longitude"]] = 1;
$locationName = ($arrayOfThisItem["parish"] != "")? $arrayOfThisItem["parish"]. ", ": "";
$locationName .= ($arrayOfThisItem["city"] != "")? $arrayOfThisItem["city"]. ", ": "";
$locationName .= ($arrayOfThisItem["current_country"] != "")? $arrayOfThisItem["current_country"]. ", ": "";
$locationName = ($locationName != "")? "Location: $locationName ": "";
$evenDate = ($arrayOfThisItem["start_date"] != "")? "Event Date: " . $arrayOfThisItem["start_date"] : "";
echo '<marker ';
echo 'name="' . parseToXML($locationName) . '" ';
echo 'desc="' . parseToXML($arrayOfThisItem["short_desc"]) . '" ';
echo 'eventtype="' . parseToXML($arrayOfThisItem["eventtype"]) . '" ';
echo 'eventtypeorig="' . parseToXML($arrayOfThisItem["eventtypeorig"]) . '" ';
echo 'eventdate="' . parseToXML($evenDate) . '" ';
echo 'lat="' . $arrayOfThisItem["latitude"] . '" ';
echo 'lng="' . $arrayOfThisItem["longitude"] . '" ';
echo 'type="' . parseToXML($arrayOfThisItem["type"]) . '" ';
echo 'sourcetitle="' . parseToXML($arrayOfThisItem["short_title"]) . '" ';
echo '/>';
}
}
echo '</markers>';
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
$xmlStr=str_replace("\x94",'"',$xmlStr);
$xmlStr=str_replace("\x93",'"',$xmlStr);
$xmlStr=str_replace("\x92",'',$xmlStr);
return $xmlStr;
}
?>