From 8a7abcc80e594e22af24e6e17bd1161ee8fccf08 Mon Sep 17 00:00:00 2001 From: Travis Ward Date: Tue, 10 Apr 2012 12:01:09 -0500 Subject: [PATCH] added mailing address field tocounty contact pages --- includes/counties.php | 108 ++++++++++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 25 deletions(-) diff --git a/includes/counties.php b/includes/counties.php index 85a46e6..2cf82c6 100644 --- a/includes/counties.php +++ b/includes/counties.php @@ -566,11 +566,16 @@ function county_footer_contact() { '') { - $zip = str_split($item[20],5); + if(strlen($item[20])>5) { + $zip = str_split($item[20],5); + $zip = $zip[0].'-'.$zip[1]; + } else { + $zip = $item[20]; + } echo '
  • '; echo $item[2].'
    '; echo $item[15]; - echo '
    '.$item[18].', '.$item[19].' '.$zip[0].'-'.$zip[1].'
  • '; + echo '
    '.$item[18].', '.$item[19].' '.$zip.''; } /*if($options['address-mail-street1']<>'') { echo '
  • '.$options['address-mail-street1']; @@ -627,21 +632,41 @@ function county_office_info() { $hash = md5(AGRILIFE_API_KEY.'getunits',true); $base64 = base64_encode($hash); - - /* New Method From IT 11-10-11 - * - * getUnits method in the API now provides the the following information - * - * Unit URL (uniturl) - * Unit Phone Number (unitphonenumber) - * Unit Fax Number (unitfaxnumber) - * Unit Email Address (unitemialaddress) - * Street (address1 & address2) - * Mail stop (mailstop) - * City (city) - * State (state) - * Zip Code (zipcode) - */ + + /* + * [Karsten Pearce Apr 09 2012 14:21:45] + * The AgriLife People API has been updated to send out the mailing address. + * If the fields are left blank it is then assumed that the mailing address is the same + * as the physical/home address. The new fields to grab are: + * + [0] => unitid + [1] => unitnumber + [2] => unitname + [3] => entitylist + [4] => parentunit + [5] => base_counties_countyid + [6] => base_districts_districtid + [7] => base_regions_regionid + [8] => countyname + [9] => districtname + [10] => regionname + [11] => uniturl + [12] => unitphonenumber + [13] => unitfaxnumber + [14] => unitemailaddress + [15] => address1 + [16] => address2 + [17] => mailstop + [18] => city + [19] => state + [20] => zipcode + [21] => mailing_address1 + [22] => mailing_address2 + [23] => mailing_mailstop + [24] => mailing_city + [25] => mailing_state + [26] => mailing_zipcode + */ /* * Call the webservice getUnits @@ -678,10 +703,29 @@ function county_office_info() { //echo $countycode; //print_r($result); //echo ''; - + foreach ( $result['ResultQuery']['data'] as $item ) { - $zip = str_split($item[20],5); - $zip = $zip[0].'-'.$zip[1]; + if(strlen($item[20])>5) { + $zip = str_split($item[20],5); + $zip = $zip[0].'-'.$zip[1]; + } else { + $zip = $item[20]; + } + + + /* Show a Map */ + /* + $mapaddress=$item[15].' '.$item[18].', '.$items[19].' '.$item[20]; + $map_image = ($options['map-img']=='' ? 'http://maps.google.com/maps/api/staticmap?size=350x400&maptype=roadmap&markers=size:mid%7Ccolor:blue%7Clabel:Office%7C'.urlencode($mapaddress).'&sensor=false&scale=2' : $options['map-img']); + + $map_link = ($options['map-link']=='' ? 'http://maps.google.com/?q='.urlencode($mapaddress).'&markers=size:mid%7Ccolor:blue%7Clabel:Office&sensor=false' : $options['map-link']); + + echo '
    '; + echo 'Map to county office'; + echo '
    '; + */ + + /* Show county contact info */ echo '
    '; echo '

    '.$item[2].'

    '; @@ -700,18 +744,32 @@ function county_office_info() { echo "
    "; echo "

    ".$item[15].'
    '; - //if($options['address-street2']<>'') - //echo ''.$options['address-street2'].'
    '; + if($item[16]<>'') + echo ''.$item[16].'
    '; echo ''.$item[18].', '; echo ''.$item[19].' '; echo ''.$zip.''; echo '
    U.S.A.

    '; echo '
    '; + + if($item[21]<>'') { + $mzip = str_split($item[26],5); + $mzip = $mzip[0].'-'.$mzip[1]; + echo "
    "; + echo "

    ".$item[21].'
    '; + if($item[22]<>'') + echo ''.$item[22].'
    '; + echo ''.$item[24].', '; + echo ''.$item[25].' '; + echo ''.$mzip.''; + echo '
    U.S.A.

    '; + echo '
    '; + } + echo '

    '; echo '
    '; - } - - } + } + } } }