Merge pull request #63 from v1r0x/load-multiple-addresses

display all contact addresses as marker
This commit is contained in:
Jan-Christoph Borchardt 2015-08-13 09:06:53 +02:00
Родитель 8e67b77e54 412e660bb7
Коммит f238ce4527
2 изменённых файлов: 19 добавлений и 15 удалений

Просмотреть файл

@ -104,10 +104,11 @@ class PageController extends Controller {
foreach ($contacts as $r) {
$data = array();
$contact = $r;
$lookupAdr = implode(',', array_filter($r['ADR'][0]));
$lookup = $this -> doAdresslookup($lookupAdr);
$contact ['location'] = $lookup[0];
$contact -> image = $r['thumbnail'];
for($i=0; $i<count($r['ADR']); $i++){
$lookupAdr = implode(',', array_filter($r['ADR'][$i]));
$lookup = $this -> doAdresslookup($lookupAdr);
$contact ['location'][] = $lookup[0];
}
array_push($response['contacts'],$contact);
}
$response['nodes'] = $this->bboxSearch($kw, $bbox);

Просмотреть файл

@ -473,17 +473,19 @@ Array.prototype.unique = function() {
});
}
var markerHTML = '<b>' + contact.FN + "</b>";
var street = [contact.ADR[0][0], contact.ADR[0][1], contact.ADR[0][2]].clean('').join('<br />');
var city = (contact.ADR[0][3]) ? contact.ADR[0][3] : '';
markerHTML += '<br />' + street + " " + city;
markerHTML += (contact.TEL) ? '<br />Tel: ' + escape(contact.TEL[0]) : '';
var marker = L.marker([contact.location.lat * 1, contact.location.lon * 1], {
icon : iconImage
});
toolKit.addMarker(marker, markerHTML)
mapSearch.searchItems.push(marker);
for(i=0; i<contact.location.length; i++){
if(contact.location[i] == null) continue;
var markerHTML = '<b>' + contact.FN + "</b>";
var street = [contact.ADR[i][0], contact.ADR[i][1], contact.ADR[i][2]].clean('').join('<br />');
var city = (contact.ADR[i][3]) ? contact.ADR[i][3] : '';
markerHTML += '<br />' + street + ", " + city;
markerHTML += (contact.TEL) ? '<br />Tel: ' + escape(contact.TEL[0]) : '';
var marker = L.marker([contact.location[i].lat * 1, contact.location[i].lon * 1], {
icon : iconImage
});
toolKit.addMarker(marker, markerHTML)
mapSearch.searchItems.push(marker);
}
}
mapSearch._ids.push(contact.id)
})
@ -1134,3 +1136,4 @@ Array.prototype.unique = function() {
}, timeout);
}
})(jQuery, OC);