/** * displayAddForm * * Displays the form for adding an address. * * @return void */ function displayAddForm() { $country_list = buildCountryList(); $selected = getDefaultCountry(); $country_options = buildHtmlSelectOptions($country_list, $selected); $validator = new FormValidator(); // TODO // Make this a removable alert message (part of Alerts table) echo ' <form id="addressbook_form" action="addressbook.php" method="post"> <p class="info-alert"> ' . T_('Please only add addresses for Non-members. Anyone who is a member of this website must add/update their own address.') . ' </p> <fieldset> <legend><span>' . T_('Add Address') . '</span></legend> <div class="field-row"> <div class="field-label"><label for="fname"><b>' . T_('First Name') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="fname" id="fname" size="25"/></div> </div> <div class="field-row"> <div class="field-label"><label for="lname"><b>' . T_('Last Name') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="lname" id="lname" size="25"/></div> </div> <div class="field-row"> <div class="field-label"><label for="email"><b>' . T_('Email') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="email" id="email" size="50"/></div> </div> <div class="field-row"> <div class="field-label"><label for="country"><b>' . T_('Country') . '</b></label></div> <div class="field-widget"> <select name="country" id="country"> <option></option> <option value="US">' . T_('UNITED STATES') . '</option> <option>------</option> ' . $country_options . ' </select> </div> </div> <div class="field-row"> <div class="field-label"><label for="address"><b>' . T_('Street Address') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="address" id="address" size="25"/></div> </div> <div class="field-row"> <div class="field-label"><label for="city"><b>' . T_('City') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="city" id="city" size="50"/></div> </div> <div class="field-row"> <div class="field-label"><label for="state"><b>' . T_('State') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="state" id="state" size="50"/></div> </div> <div class="field-row"> <div class="field-label"><label for="zip"><b>' . T_('Zip Code') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="zip" id="zip" size="10"/></div> </div> <div class="field-row"> <div class="field-label"><label for="home"><b>' . T_('Home Phone') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="home" id="home" size="20"/></div> </div> <div class="field-row"> <div class="field-label"><label for="work"><b>' . T_('Work Phone') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="work" id="work" size="20"/></div> </div> <div class="field-row"> <div class="field-label"><label for="cell"><b>' . T_('Cell Phone') . '</b></label></div> <div class="field-widget"><input class="frm_text" type="text" name="cell" id="cell" size="20"/></div> </div> <div class="field-row"> <div class="field-label"><label for="private"><b>' . T_('Private') . '</b></label></div> <div class="field-widget"><input type="checkbox" name="private" id="private"/></div> </div> <p> <input class="sub1" type="submit" name="addsubmit" value="' . T_('Add') . '"/> ' . T_('or') . ' <a href="addressbook.php">' . T_('Cancel') . '</a> </p> </fieldset> ' . $validator->getJsValidation($this->getProfile('add')) . ' </form>'; }
/** * formatAddressUs * * Valid Address * 1. Country * 2. State * 3. City * 4. City, State * 5. Address, City * 6. Address, City, State * 7. Address, City, State, Zip * 8. Address, City, State, Zip Country * * @param string $address * * @return void */ function formatAddressUs($address) { $str = ''; // 5 - 8 if (!empty($address['address'])) { $str .= cleanOutput($address['address']) . '<br/>'; if (!empty($address['city'])) { $str .= cleanOutput($address['city']); if (!empty($address['state'])) { $str .= ', ' . cleanOutput($address['state']); if (!empty($address['zip'])) { $str .= ' ' . cleanOutput($address['zip']); if (!empty($address['country'])) { // Convert country code to name $countries = buildCountryList(); $country = cleanOutput($address['country']); $country = $countries[$country]; $country = ucwords(strtolower($country)); $str .= '<br/>' . $country; } } } } } elseif (!empty($address['city'])) { $str .= cleanOutput($address['city']); if (!empty($address['state'])) { $str .= ', ' . cleanOutput($address['state']); } } elseif (!empty($address['state'])) { $str .= cleanOutput($address['state']); } elseif (!empty($address['country'])) { $str .= cleanOutput($address['state']); } return $str; }