1
<h3>Facility GIS List</h3>
3
<table class="staffTable">
12
<?php foreach ($ag_facility_geos as $ag_facility_geo): ?>
15
<a href="<?php echo url_for('facility/show?id='.$ag_facility_geo->getId()) ?>">
16
<?php echo $ag_facility_geo->getFacilityName() ?>
21
//maybe the below 9 lines should be in actions.class
22
//the below lines return a properly ordered array of:
23
//street number, street name, city, state, zip
25
$siteContacts = $ag_facility_geo->getAgSite()->getAgEntity()->getAgEntityAddressContact();
26
foreach ($siteContacts as $siteContact) {
27
$address = $siteContact->getAgAddress();
28
$addressValues = $address->getAgAddressMjAgAddressValue();
29
$formats = $address->getAgAddressStandard()->getAgAddressFormat();
30
$facilityAddress[$siteContact->getAddressId()] = '';
31
foreach ($formats as $format) {
33
$addressValues = $address->getAgAddressMjAgAddressValue();
34
foreach ($addressValues as $addressValue) {
35
if ($addressValue->getAgAddressValue()->getAddressElementId() == $format->getAddressElementId()) {
36
$facilityAddress[$siteContact->getAddressId()][] = $addressValue->getAgAddressValue()->value; //okay, i have to have these in order.
37
//the array needs to be reset, crazy concat
40
$order[$format->getLineSequence()][$format->getInlineSequence()] = $string;
43
//we should put a check here for 'work' and 'home' address and only retrieve those, currently it is 0 and 1 (first and second contact
44
$addressKeys = array_keys($facilityAddress);
45
if(isset($facilityAddress[$addressKeys[0]]))
47
foreach($facilityAddress[$addressKeys[0]] as $addressPart){
48
echo $addressPart . ' '; //echo the entire address
50
$streetnumber = substr($facilityAddress[$addressKeys[0]][0], 0,strpos($facilityAddress[$addressKeys[0]][0],' '));// agGis::parse_address($facilityAddress[$addressKeys[0]][0]);
51
//parse address should be better, i want it to return streetname AND number!
52
$streetname = substr($facilityAddress[$addressKeys[0]][0], strpos($streetnumber['number'], $facilityAddress[$addressKeys[0]][0]));
53
$zip = $facilityAddress[$addressKeys[0]][3];
54
echo '<a class=linkButton href="' . url_for('gis/geocode') . '?number=' . $streetnumber['number'] . '&street=' . $streetname . '&zip=' . $zip . '&address_id=' . $addressKeys[0] . '">geo</a>';
57
<td><?php echo $ag_facility_geo->getUpdatedAt() ?></td>
66
<a class="linkButton" href="<?php echo url_for('gis/new') ?>">New</a>
b'\\ No newline at end of file'