new drop downs for province/country
Showing
3 changed files
with
455 additions
and
112 deletions
| ... | @@ -116,6 +116,131 @@ function validate_creditcard($cc_num, $type) { | ... | @@ -116,6 +116,131 @@ function validate_creditcard($cc_num, $type) { |
| 116 | return $verified; | 116 | return $verified; |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | if ( ! function_exists('form_dropdown')) | ||
| 120 | { | ||
| 121 | function form_dropdown($name = '', $options = array(), $selected = array(), $extra = '') | ||
| 122 | { | ||
| 123 | if ( ! is_array($selected)) | ||
| 124 | { | ||
| 125 | $selected = array($selected); | ||
| 126 | } | ||
| 127 | |||
| 128 | // If no selected state was submitted we will attempt to set it automatically | ||
| 129 | if (count($selected) === 0) | ||
| 130 | { | ||
| 131 | // If the form name appears in the $_POST array we have a winner! | ||
| 132 | if (isset($_POST[$name])) | ||
| 133 | { | ||
| 134 | $selected = array($_POST[$name]); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 138 | if ($extra != '') $extra = ' '.$extra; | ||
| 139 | |||
| 140 | $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; | ||
| 141 | |||
| 142 | $form = '<select name="'.$name.'"'.$extra.$multiple.">\n"; | ||
| 143 | |||
| 144 | foreach ($options as $key => $val) | ||
| 145 | { | ||
| 146 | $key = (string) $key; | ||
| 147 | |||
| 148 | if (is_array($val) && ! empty($val)) | ||
| 149 | { | ||
| 150 | $form .= '<optgroup label="'.$key.'">'."\n"; | ||
| 151 | |||
| 152 | foreach ($val as $optgroup_key => $optgroup_val) | ||
| 153 | { | ||
| 154 | $sel = (in_array($optgroup_key, $selected)) ? ' selected="selected"' : ''; | ||
| 155 | |||
| 156 | $form .= '<option value="'.$optgroup_key.'"'.$sel.'>'.(string) $optgroup_val."</option>\n"; | ||
| 157 | } | ||
| 158 | |||
| 159 | $form .= '</optgroup>'."\n"; | ||
| 160 | } | ||
| 161 | else | ||
| 162 | { | ||
| 163 | $sel = (in_array($key, $selected)) ? ' selected="selected"' : ''; | ||
| 164 | |||
| 165 | $form .= '<option value="'.$key.'"'.$sel.'>'.(string) $val."</option>\n"; | ||
| 166 | } | ||
| 167 | } | ||
| 168 | |||
| 169 | $form .= '</select>'; | ||
| 170 | |||
| 171 | return $form; | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 175 | function form_linked_dropdown($name = '', $parent = '', $options = array(), $parent_selected = '', $selected = '', $extra = '') | ||
| 176 | { | ||
| 177 | if ($extra != '') $extra = ' '.$extra; | ||
| 178 | |||
| 179 | $form = '<select name="'.$name.'" id="'.$name.'"'.$extra.">\n"; | ||
| 180 | |||
| 181 | if (isset($options[$parent_selected])) | ||
| 182 | { | ||
| 183 | foreach ($options[$parent_selected] as $key => $val) | ||
| 184 | { | ||
| 185 | $sel = ($selected != $key) ? '' : ' selected="selected"'; | ||
| 186 | |||
| 187 | $form .= '<option value="'.$key.'"'.$sel.'>'.$val."</option>\n"; | ||
| 188 | } | ||
| 189 | } | ||
| 190 | |||
| 191 | $form .= '</select> | ||
| 192 | <script> | ||
| 193 | function update_' . $name . '(value) { | ||
| 194 | |||
| 195 | jQuery("#'.$name.'_custom").attr("disabled","disabled").hide(); | ||
| 196 | jQuery("#'.$name.'").show(); | ||
| 197 | |||
| 198 | |||
| 199 | var options = new Array(); | ||
| 200 | var select = document.getElementById("' . $name . '"); | ||
| 201 | select.disabled = false; | ||
| 202 | while (select.firstChild) | ||
| 203 | select.removeChild(select.firstChild); | ||
| 204 | switch (value.toString()) {'; | ||
| 205 | foreach ($options as $k => $v) { | ||
| 206 | $form .= 'case "' . $k . '": | ||
| 207 | options = new Array('; | ||
| 208 | foreach ($v as $value => $content) { | ||
| 209 | $form .= '"' . $value . '","' . $content . '",'; | ||
| 210 | } | ||
| 211 | $form = substr($form,0,-1); | ||
| 212 | $form .= '); | ||
| 213 | break;'; | ||
| 214 | } | ||
| 215 | $form .= 'default: | ||
| 216 | select.disabled = true; | ||
| 217 | |||
| 218 | jQuery("#'.$name.'").after("<input type=\'text\' name=\''.$name.'\' id=\''.$name.'_custom\' class=\'input-field-css input-large\' value=\''.$selected.'\' />").removeAttr("disabled").show(); | ||
| 219 | jQuery("#'.$name.'").hide(); | ||
| 220 | //options = new Array("other","Other"); | ||
| 221 | return; | ||
| 222 | } | ||
| 223 | |||
| 224 | for(var i = 0; i < options.length;) { | ||
| 225 | var option = document.createElement("option"); | ||
| 226 | var val = options[i++]; | ||
| 227 | option.value = val; | ||
| 228 | option.innerHTML = options[i++]; | ||
| 229 | if (val == "'.$selected.'") { | ||
| 230 | option.selected = true; | ||
| 231 | } | ||
| 232 | select.appendChild(option); | ||
| 233 | } | ||
| 234 | |||
| 235 | } | ||
| 236 | update_'.$name.'(document.getElementById("'.$parent.'").value); | ||
| 237 | document.getElementById("' . $parent . '").onchange = function() { update_' . $name . '(this.value); } | ||
| 238 | </script> | ||
| 239 | '; | ||
| 240 | |||
| 241 | return $form; | ||
| 242 | } | ||
| 243 | |||
| 119 | class Vars { | 244 | class Vars { |
| 120 | 245 | ||
| 121 | public static $prefixes = Array( | 246 | public static $prefixes = Array( |
| ... | @@ -130,26 +255,321 @@ class Vars { | ... | @@ -130,26 +255,321 @@ class Vars { |
| 130 | ); | 255 | ); |
| 131 | 256 | ||
| 132 | public static $countries = Array( | 257 | public static $countries = Array( |
| 133 | 'CA' => 'Canada' | 258 | 'CA' => 'Canada' |
| 134 | , 'US' => 'United States' | 259 | , 'US' => 'United States' |
| 135 | , 'MX' => 'Mexico' | 260 | , 'MX' => 'Mexico' |
| 136 | , 'Other' => 'Other' | 261 | , 'AF' => 'Afghanistan' |
| 262 | , 'AR' => 'Argentina' | ||
| 263 | , 'AX' => 'Åland Islands' | ||
| 264 | , 'AL' => 'Albania' | ||
| 265 | , 'DZ' => 'Algeria' | ||
| 266 | , 'AS' => 'American Samoa' | ||
| 267 | , 'AD' => 'Andorra' | ||
| 268 | , 'AO' => 'Angola' | ||
| 269 | , 'AI' => 'Anguilla' | ||
| 270 | , 'AQ' => 'Antarctica' | ||
| 271 | , 'AG' => 'Antigua and Barbuda' | ||
| 272 | , 'AM' => 'Armenia' | ||
| 273 | , 'AW' => 'Aruba' | ||
| 274 | , 'AU' => 'Australia' | ||
| 275 | , 'AT' => 'Austria' | ||
| 276 | , 'AZ' => 'Azerbaijan' | ||
| 277 | , 'BS' => 'Bahamas' | ||
| 278 | , 'BH' => 'Bahrain' | ||
| 279 | , 'BD' => 'Bangladesh' | ||
| 280 | , 'BB' => 'Barbados' | ||
| 281 | , 'BY' => 'Belarus' | ||
| 282 | , 'BE' => 'Belgium' | ||
| 283 | , 'BZ' => 'Belize' | ||
| 284 | , 'BJ' => 'Benin' | ||
| 285 | , 'BM' => 'Bermuda' | ||
| 286 | , 'BT' => 'Bhutan' | ||
| 287 | , 'BO' => 'Bolivia' | ||
| 288 | , 'BA' => 'Bosnia and Herzegovina' | ||
| 289 | , 'BW' => 'Botswana' | ||
| 290 | , 'BV' => 'Bouvet Island' | ||
| 291 | , 'BR' => 'Brazil' | ||
| 292 | , 'IO' => 'British Indian Ocean Territory' | ||
| 293 | , 'BN' => 'Brunei Darussalam' | ||
| 294 | , 'BG' => 'Bulgaria' | ||
| 295 | , 'BF' => 'Burkina Faso' | ||
| 296 | , 'BI' => 'Burundi' | ||
| 297 | , 'KH' => 'Cambodia' | ||
| 298 | , 'CM' => 'Cameroon' | ||
| 299 | , 'CV' => 'Cape Verde' | ||
| 300 | , 'KY' => 'Cayman Islands' | ||
| 301 | , 'CF' => 'Central African Republic' | ||
| 302 | , 'TD' => 'Chad' | ||
| 303 | , 'CL' => 'Chile' | ||
| 304 | , 'CN' => 'China' | ||
| 305 | , 'CX' => 'Christmas Island' | ||
| 306 | , 'CC' => 'Cocos (Keeling) Islands' | ||
| 307 | , 'CO' => 'Columbia' | ||
| 308 | , 'KM' => 'Comoros' | ||
| 309 | , 'CG' => 'Congo' | ||
| 310 | , 'CD' => 'Congo, The Democratic Republic' | ||
| 311 | , 'CK' => 'Cook Islands' | ||
| 312 | , 'CR' => 'Costa Rica' | ||
| 313 | , 'CI' => 'Cote d’Ivoire – Really Ivory Coast' | ||
| 314 | , 'HR' => 'Croatia' | ||
| 315 | , 'CU' => 'Cuba' | ||
| 316 | , 'CY' => 'Cyprus' | ||
| 317 | , 'CZ' => 'Czech Republic' | ||
| 318 | , 'DK' => 'Denmark' | ||
| 319 | , 'DJ' => 'Djibouti' | ||
| 320 | , 'DM' => 'Dominica' | ||
| 321 | , 'DO' => 'Dominican Republic' | ||
| 322 | , 'TL' => 'East Timor' | ||
| 323 | , 'EC' => 'Ecuador' | ||
| 324 | , 'EG' => 'Egypt' | ||
| 325 | , 'SV' => 'El Salvador' | ||
| 326 | , 'GQ' => 'Equatorial Guinea' | ||
| 327 | , 'ER' => 'Eritrea' | ||
| 328 | , 'EE' => 'Estonia' | ||
| 329 | , 'ET' => 'Ethiopia' | ||
| 330 | , 'FK' => 'Falkland Islands' | ||
| 331 | , 'FO' => 'Faroe Islands' | ||
| 332 | , 'FJ' => 'Fiji' | ||
| 333 | , 'FI' => 'Finland' | ||
| 334 | , 'FR' => 'France' | ||
| 335 | , 'GF' => 'French Guiana' | ||
| 336 | , 'PF' => 'French Polynesia' | ||
| 337 | , 'TF' => 'French Southern Territories' | ||
| 338 | , 'GA' => 'Gabon' | ||
| 339 | , 'GM' => 'Gambia' | ||
| 340 | , 'GE' => 'Georgia' | ||
| 341 | , 'DE' => 'Germany' | ||
| 342 | , 'GH' => 'Ghana' | ||
| 343 | , 'GI' => 'Gibraltar' | ||
| 344 | , 'GB' => 'Great Britain' | ||
| 345 | , 'GR' => 'Greece' | ||
| 346 | , 'GL' => 'Greenland' | ||
| 347 | , 'GD' => 'Grenada' | ||
| 348 | , 'GP' => 'Guadeloupe' | ||
| 349 | , 'GU' => 'Guam' | ||
| 350 | , 'GT' => 'Guatemala' | ||
| 351 | , 'GN' => 'Guinea' | ||
| 352 | , 'GW' => 'Guinea Bissau' | ||
| 353 | , 'GY' => 'Guyana' | ||
| 354 | , 'HT' => 'Haiti' | ||
| 355 | , 'HM' => 'Heard and McDonald Islands' | ||
| 356 | , 'HN' => 'Honduras' | ||
| 357 | , 'HK' => 'Hong Kong' | ||
| 358 | , 'HU' => 'Hungary' | ||
| 359 | , 'IS' => 'Iceland' | ||
| 360 | , 'IN' => 'India' | ||
| 361 | , 'ID' => 'Indonesia' | ||
| 362 | , 'IR' => 'Iran, Islamic Republic of' | ||
| 363 | , 'IQ' => 'Iraq' | ||
| 364 | , 'IE' => 'Ireland' | ||
| 365 | , 'IL' => 'Israel' | ||
| 366 | , 'IT' => 'Italy' | ||
| 367 | , 'JM' => 'Jamaica' | ||
| 368 | , 'JP' => 'Japan' | ||
| 369 | , 'JO' => 'Jordan' | ||
| 370 | , 'KZ' => 'Kazakhstan' | ||
| 371 | , 'KE' => 'Kenya' | ||
| 372 | , 'KI' => 'Kiribati' | ||
| 373 | , 'KP' => "Korea, Democratic People's Republic" | ||
| 374 | , 'KR' => 'Korea, Republic of' | ||
| 375 | , 'KW' => 'Kuwait' | ||
| 376 | , 'KG' => 'Kyrgyzstan' | ||
| 377 | , 'LA' => "Lao People's Democratic Republic" | ||
| 378 | , 'LV' => 'Latvia' | ||
| 379 | , 'LB' => 'Lebanon' | ||
| 380 | , 'LI' => 'Liechtenstein' | ||
| 381 | , 'LS' => 'Lesotho' | ||
| 382 | , 'LR' => 'Liberia' | ||
| 383 | , 'LY' => 'Libyan Arab Jamahiriya' | ||
| 384 | , 'LT' => 'Lithuania' | ||
| 385 | , 'LU' => 'Luxembourg' | ||
| 386 | , 'MO' => 'Macau' | ||
| 387 | , 'MK' => 'Macedonia' | ||
| 388 | , 'MG' => 'Madagascar' | ||
| 389 | , 'MW' => 'Malawi' | ||
| 390 | , 'MY' => 'Malaysia' | ||
| 391 | , 'MV' => 'Maldives' | ||
| 392 | , 'ML' => 'Mali' | ||
| 393 | , 'MT' => 'Malta' | ||
| 394 | , 'MH' => 'Marshall Islands' | ||
| 395 | , 'MQ' => 'Martinique' | ||
| 396 | , 'MR' => 'Mauritania' | ||
| 397 | , 'MU' => 'Mauritius' | ||
| 398 | , 'YT' => 'Mayotte' | ||
| 399 | , 'MX' => 'Mexico' | ||
| 400 | , 'FM' => "Micronesia, Federated States of" | ||
| 401 | , 'MD' => 'Moldova, Republic of' | ||
| 402 | , 'MC' => 'Monaco' | ||
| 403 | , 'MN' => 'Mongolia' | ||
| 404 | , 'MS' => 'Montserrat' | ||
| 405 | , 'MA' => 'Morocco' | ||
| 406 | , 'MZ' => "Mozambique" | ||
| 407 | , 'MM' => 'Myanmar' | ||
| 408 | , 'NA' => 'Namibia' | ||
| 409 | , 'NR' => 'Nauru' | ||
| 410 | , 'NP' => 'Nepal' | ||
| 411 | , 'NL' => 'Netherlands' | ||
| 412 | , 'NA' => 'Netherlands Antilles' | ||
| 413 | , 'NC' => 'New Caledonia' | ||
| 414 | , 'NZ' => 'New Zealand' | ||
| 415 | , 'NI' => 'Nicaragua' | ||
| 416 | , 'NE' => 'Niger' | ||
| 417 | , 'NG' => 'Nigeria' | ||
| 418 | , 'NU' => 'Niue' | ||
| 419 | , 'NF' => 'Norfolk Island' | ||
| 420 | , 'MP' => 'Northern Mariana Islands' | ||
| 421 | , 'NO' => "Norway" | ||
| 422 | , 'OM' => 'Oman' | ||
| 423 | , 'PK' => 'Pakistan' | ||
| 424 | , 'PW' => 'Palau' | ||
| 425 | , 'PS' => 'Palestinian Territory, Occupied' | ||
| 426 | , 'PA' => 'Panama' | ||
| 427 | , 'PG' => 'Papua New Guinea' | ||
| 428 | , 'PY' => 'Paraguay' | ||
| 429 | , 'PE' => 'Peru' | ||
| 430 | , 'PH' => 'Philippines' | ||
| 431 | , 'PN' => 'Pitcairn' | ||
| 432 | , 'PL' => 'Poland' | ||
| 433 | , 'PT' => 'Portugal' | ||
| 434 | , 'PR' => 'Puerto Rico' | ||
| 435 | , 'QA' => 'Qatar' | ||
| 436 | , 'RE' => 'Reunion' | ||
| 437 | , 'RO' => 'Romania' | ||
| 438 | , 'RU' => 'Russian Federation' | ||
| 439 | , 'RW' => 'Rwanda' | ||
| 440 | , 'KN' => 'Saint Kitts and Nevis' | ||
| 441 | , 'LC' => 'Saint Lucia' | ||
| 442 | , 'VC' => 'Saint Vincent and the Grenadines' | ||
| 443 | , 'WS' => 'Samoa' | ||
| 444 | , 'SM' => 'San Marino' | ||
| 445 | , 'ST' => 'Sao Tome and Principe' | ||
| 446 | , 'SA' => 'Saudi Arabia' | ||
| 447 | , 'SN' => 'Senegal' | ||
| 448 | , 'CS' => 'Serbia and Montenegro' | ||
| 449 | , 'SC' => 'Seychelles' | ||
| 450 | , 'SL' => 'Sierra Leone' | ||
| 451 | , 'SG' => 'Singapore' | ||
| 452 | , 'SK' => 'Slovakia' | ||
| 453 | , 'SI' => 'Slovenia' | ||
| 454 | , 'SB' => 'Solomon Islands' | ||
| 455 | , 'SO' => 'Somalia' | ||
| 456 | , 'ZA' => 'South Africa' | ||
| 457 | , 'GS' => 'South Georgia – South Sandwich Islands' | ||
| 458 | , 'ES' => 'Spain' | ||
| 459 | , 'LK' => 'Sri Lanka' | ||
| 460 | , 'SH' => 'St. Helena' | ||
| 461 | , 'PM' => 'St. Pierre and Miquelon' | ||
| 462 | , 'SD' => 'Sudan' | ||
| 463 | , 'SR' => 'Suriname' | ||
| 464 | , 'SJ' => 'Svalbard and Jan Mayen' | ||
| 465 | , 'SZ' => 'Swaziland' | ||
| 466 | , 'SE' => 'Sweden' | ||
| 467 | , 'CH' => 'Switzerland' | ||
| 468 | , 'SY' => 'Syrian Arab Republic' | ||
| 469 | , 'TW' => 'Taiwan' | ||
| 470 | , 'TJ' => 'Tajikistan' | ||
| 471 | , 'TZ' => 'Tanzania, United Republic of' | ||
| 472 | , 'TH' => 'Thailand' | ||
| 473 | , 'TG' => 'Togo' | ||
| 474 | , 'TK' => 'Tokelau' | ||
| 475 | , 'TO' => 'Tonga' | ||
| 476 | , 'TT' => 'Trinidad and Tobago' | ||
| 477 | , 'TN' => 'Tunisia' | ||
| 478 | , 'TR' => 'Turkey' | ||
| 479 | , 'TM' => 'Turkmenistan' | ||
| 480 | , 'TC' => 'Turks and Caicos Islands' | ||
| 481 | , 'TV' => 'Tuvalu' | ||
| 482 | , 'UG' => 'Uganda' | ||
| 483 | , 'UA' => 'Ukraine' | ||
| 484 | , 'AE' => 'United Arab Emirates' | ||
| 485 | , 'UM' => 'United States Minor Outlying Islands' | ||
| 486 | , 'UY' => 'Uruguay' | ||
| 487 | , 'UZ' => 'Uzbekistan' | ||
| 488 | , 'VU' => 'Vanuatu' | ||
| 489 | , 'VA' => 'Vatican City state' | ||
| 490 | , 'VE' => 'Venezuela' | ||
| 491 | , 'VN' => 'Viet Nam' | ||
| 492 | , 'VG' => 'Virgin Islands (British)' | ||
| 493 | , 'VI' => 'Virgin Islands (US)' | ||
| 494 | , 'WF' => 'Wallis and Futuna' | ||
| 495 | , 'EH' => 'Western Sahara' | ||
| 496 | , 'YE' => 'Yemen' | ||
| 497 | , 'ZM' => 'Zambia' | ||
| 498 | , 'ZW' => 'Zimbabwe' | ||
| 137 | ); | 499 | ); |
| 138 | 500 | ||
| 139 | public static $provinces = Array( | 501 | public static $provinces = Array( |
| 140 | 'AB' => 'Alberta' | 502 | 'CA' => array( |
| 141 | , 'BC' => 'British Columbia' | 503 | 'AB' => 'Alberta' |
| 142 | , 'MB' => 'Manitoba' | 504 | , 'BC' => 'British Columbia' |
| 143 | , 'NB' => 'New Brunswick' | 505 | , 'MB' => 'Manitoba' |
| 144 | , 'NL' => 'Newfoundland and Labrador' | 506 | , 'NB' => 'New Brunswick' |
| 145 | , 'NT' => 'Northwest Territories' | 507 | , 'NL' => 'Newfoundland and Labrador' |
| 146 | , 'NS' => 'Nova Scotia' | 508 | , 'NT' => 'Northwest Territories' |
| 147 | , 'NU' => 'Nunavut' | 509 | , 'NS' => 'Nova Scotia' |
| 148 | , 'PE' => 'Prince Edward Island' | 510 | , 'NU' => 'Nunavut' |
| 149 | , 'SK' => 'Saskatchewan' | 511 | , 'PE' => 'Prince Edward Island' |
| 150 | , 'ON' => 'Ontario' | 512 | , 'SK' => 'Saskatchewan' |
| 151 | , 'QC' => 'Quebec' | 513 | , 'ON' => 'Ontario' |
| 152 | , 'YT' => 'Yukon' | 514 | , 'QC' => 'Quebec' |
| 515 | , 'YT' => 'Yukon' | ||
| 516 | ) | ||
| 517 | , 'US' => array( | ||
| 518 | 'AL' => 'Alabama' | ||
| 519 | , 'AK' => 'Alaska' | ||
| 520 | , 'AZ' => 'Arizona' | ||
| 521 | , 'AR' => 'Arkansas' | ||
| 522 | , 'CA' => 'California' | ||
| 523 | , 'CO' => 'Colorado' | ||
| 524 | , 'CT' => 'Connecticut' | ||
| 525 | , 'DE' => 'Delaware' | ||
| 526 | , 'DC' => 'District of Columbia' | ||
| 527 | , 'FL' => 'Florida' | ||
| 528 | , 'GA' => 'Georgia' | ||
| 529 | , 'GU' => 'Guam' | ||
| 530 | , 'HI' => 'Hawaii' | ||
| 531 | , 'ID' => 'Idaho' | ||
| 532 | , 'IL' => 'Illinois' | ||
| 533 | , 'IN' => 'Indiana' | ||
| 534 | , 'IA' => 'Iowa' | ||
| 535 | , 'KS' => 'Kansas' | ||
| 536 | , 'KY' => 'Kentucky' | ||
| 537 | , 'LA' => 'Louisiana' | ||
| 538 | , 'ME' => 'Maine' | ||
| 539 | , 'MD' => 'Maryland' | ||
| 540 | , 'MA' => 'Massachusetts' | ||
| 541 | , 'MI' => 'Michigan' | ||
| 542 | , 'MN' => 'Minnesota' | ||
| 543 | , 'MS' => 'Mississippi' | ||
| 544 | , 'MO' => 'Missouri' | ||
| 545 | , 'MT' => 'Montana' | ||
| 546 | , 'NE' => 'Nebraska' | ||
| 547 | , 'NV' => 'Nevada' | ||
| 548 | , 'NH' => 'New Hampshire' | ||
| 549 | , 'NJ' => 'New Jersey' | ||
| 550 | , 'NM' => 'New Mexico' | ||
| 551 | , 'NY' => 'New York' | ||
| 552 | , 'NC' => 'North Carolina' | ||
| 553 | , 'ND' => 'North Dakota' | ||
| 554 | , 'OH' => 'Ohio' | ||
| 555 | , 'OK' => 'Oklahoma' | ||
| 556 | , 'OR' => 'Oregon' | ||
| 557 | , 'PA' => 'Pennyslvania' | ||
| 558 | , 'PR' => 'Puerto Rico' | ||
| 559 | , 'RI' => 'Rhode Island' | ||
| 560 | , 'SC' => 'South Carolina' | ||
| 561 | , 'SD' => 'South Dakota' | ||
| 562 | , 'TN' => 'Tennessee' | ||
| 563 | , 'TX' => 'Texas' | ||
| 564 | , 'UT' => 'Utah' | ||
| 565 | , 'VT' => 'Vermont' | ||
| 566 | , 'VA' => 'Virginia' | ||
| 567 | , 'VI' => 'Virgin Islands' | ||
| 568 | , 'WA' => 'Washington' | ||
| 569 | , 'WV' => 'West Virginia' | ||
| 570 | , 'WI' => 'Wisconsin' | ||
| 571 | , 'WY' => 'Wyoming' | ||
| 572 | ) | ||
| 153 | ); | 573 | ); |
| 154 | 574 | ||
| 155 | public static $securities = Array( | 575 | public static $securities = Array( | ... | ... |
| ... | @@ -16,18 +16,20 @@ use WP_User, WP_Roles; | ... | @@ -16,18 +16,20 @@ use WP_User, WP_Roles; |
| 16 | 16 | ||
| 17 | $uid = $user->ID; | 17 | $uid = $user->ID; |
| 18 | $account = new User\Account($uid); | 18 | $account = new User\Account($uid); |
| 19 | |||
| 20 | $pp = get_user_meta($uid, 'profile_preference', true).'_'; | ||
| 19 | 21 | ||
| 20 | $first_name = get_user_meta($uid, 'first_name', true); | 22 | $first_name = get_user_meta($uid, 'first_name', true); |
| 21 | $last_name = get_user_meta($uid, 'last_name', true); | 23 | $last_name = get_user_meta($uid, 'last_name', true); |
| 22 | 24 | ||
| 23 | // contact info. | 25 | // contact info. |
| 24 | $country = get_user_meta($uid, 'country', true); | 26 | $country = get_user_meta($uid, $pp.'country', true); |
| 25 | $mobile = get_user_meta($uid, 'mobile', true); | 27 | $mobile = get_user_meta($uid, 'mobile', true); |
| 26 | $email = $user->user_email;//get_user_meta($uid, 'email', true); | 28 | $email = $user->user_email;//get_user_meta($uid, 'email', true); |
| 27 | 29 | ||
| 28 | // professional stuff | 30 | // professional stuff |
| 29 | $title = get_user_meta($uid, 'title', true); | 31 | $title = get_user_meta($uid, 'title', true); |
| 30 | $company = get_user_meta($uid, 'company', true); | 32 | $company = get_user_meta($uid, 'company_name', true); |
| 31 | 33 | ||
| 32 | // status | 34 | // status |
| 33 | $status = get_user_meta($uid, 'status', true); | 35 | $status = get_user_meta($uid, 'status', true); |
| ... | @@ -80,54 +82,7 @@ use WP_User, WP_Roles; | ... | @@ -80,54 +82,7 @@ use WP_User, WP_Roles; |
| 80 | </tr> | 82 | </tr> |
| 81 | <?php endif; ?> | 83 | <?php endif; ?> |
| 82 | 84 | ||
| 83 | <?php if (!empty($address)): ?> | ||
| 84 | <tr> | ||
| 85 | <th>Address:</th> | ||
| 86 | <td><?php echo $address; if (!empty($address2)) { echo "<br />".$address2; }?></td> | ||
| 87 | </tr> | ||
| 88 | <?php endif; ?> | ||
| 89 | |||
| 90 | <?php if (!empty($city)): ?> | ||
| 91 | <tr> | ||
| 92 | <th>City:</th> | ||
| 93 | <td><?php echo $city; ?></td> | ||
| 94 | </tr> | ||
| 95 | <?php endif; ?> | ||
| 96 | |||
| 97 | <?php if (!empty($province)): ?> | ||
| 98 | <tr> | ||
| 99 | <th>Province:</th> | ||
| 100 | <td><?php echo $province; ?></td> | ||
| 101 | </tr> | ||
| 102 | <?php endif; ?> | ||
| 103 | 85 | ||
| 104 | <?php if (!empty($country)): ?> | ||
| 105 | <tr> | ||
| 106 | <th>Country:</th> | ||
| 107 | <td><?php echo $country; ?></td> | ||
| 108 | </tr> | ||
| 109 | <?php endif; ?> | ||
| 110 | |||
| 111 | <?php if (!empty($phone)): ?> | ||
| 112 | <tr> | ||
| 113 | <th>Phone:</th> | ||
| 114 | <td><?php echo $phone; ?></td> | ||
| 115 | </tr> | ||
| 116 | <?php endif; ?> | ||
| 117 | |||
| 118 | <?php if (!empty($fax)): ?> | ||
| 119 | <tr> | ||
| 120 | <th>Fax:</th> | ||
| 121 | <td><?php echo $fax; ?></td> | ||
| 122 | </tr> | ||
| 123 | <?php endif; ?> | ||
| 124 | |||
| 125 | <?php if (!empty($mobile)): ?> | ||
| 126 | <tr> | ||
| 127 | <th>Mobile:</th> | ||
| 128 | <td><?php echo $mobile; ?></td> | ||
| 129 | </tr> | ||
| 130 | <?php endif; ?> | ||
| 131 | 86 | ||
| 132 | <?php if (!empty($email)): ?> | 87 | <?php if (!empty($email)): ?> |
| 133 | <tr> | 88 | <tr> |
| ... | @@ -136,12 +91,7 @@ use WP_User, WP_Roles; | ... | @@ -136,12 +91,7 @@ use WP_User, WP_Roles; |
| 136 | </tr> | 91 | </tr> |
| 137 | <?php endif; ?> | 92 | <?php endif; ?> |
| 138 | 93 | ||
| 139 | <?php if (!empty($website)): ?> | 94 | |
| 140 | <tr> | ||
| 141 | <th>Website:</th> | ||
| 142 | <td><?php echo $website; ?></td> | ||
| 143 | </tr> | ||
| 144 | <?php endif; ?> | ||
| 145 | 95 | ||
| 146 | </tbody> | 96 | </tbody> |
| 147 | </table> | 97 | </table> | ... | ... |
| ... | @@ -131,32 +131,18 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); | ... | @@ -131,32 +131,18 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); |
| 131 | <td><input type="text" name="home_city" value="<?php echo get_user_meta($_GET['uid'], 'home_city', true);?>" /></td> | 131 | <td><input type="text" name="home_city" value="<?php echo get_user_meta($_GET['uid'], 'home_city', true);?>" /></td> |
| 132 | </tr> | 132 | </tr> |
| 133 | <tr> | 133 | <tr> |
| 134 | <th>Country:</th> | ||
| 135 | <td><?php echo HTML\form_dropdown('home_country', HTML\Vars::$countries, get_user_meta($_GET['uid'], 'home_country', true), "id='home_country'"); ?></td> | ||
| 136 | </tr> | ||
| 137 | <tr> | ||
| 134 | <th>State/Province:</th> | 138 | <th>State/Province:</th> |
| 135 | <td> | 139 | <td><?php echo HTML\form_linked_dropdown('home_province', 'home_country', HTML\Vars::$provinces,get_user_meta($_GET['uid'], 'home_country', true), get_user_meta($_GET['uid'], 'home_province', true)); ?></td> |
| 136 | <select name="home_province"> | ||
| 137 | <option disabled value="">Select a State/Province</option> | ||
| 138 | <optgroup label="Canada"> | ||
| 139 | <?php HTML\select_opts_provinces(get_user_meta($_GET['uid'], 'home_province', true)); ?> | ||
| 140 | </optgroup> | ||
| 141 | |||
| 142 | <optgroup label="United States"> | ||
| 143 | <?php HTML\select_opts_states(get_user_meta($_GET['uid'], 'home_province', true)); ?> | ||
| 144 | </optgroup> | ||
| 145 | </select> | ||
| 146 | </td> | ||
| 147 | </tr> | 140 | </tr> |
| 148 | <tr> | 141 | <tr> |
| 149 | <th>Postal:</th> | 142 | <th>Postal:</th> |
| 150 | <td><input type="text" name="home_postal" value="<?php echo get_user_meta($_GET['uid'], 'home_postal', true); ?>" /></td> | 143 | <td><input type="text" name="home_postal" value="<?php echo get_user_meta($_GET['uid'], 'home_postal', true); ?>" /></td> |
| 151 | </tr> | 144 | </tr> |
| 152 | <tr> | 145 | |
| 153 | <th>Country:</th> | ||
| 154 | <td> | ||
| 155 | <select name="home_country"> | ||
| 156 | <?php HTML\select_opts_countries(get_user_meta($_GET['uid'], 'home_country', true)); ?> | ||
| 157 | </select> | ||
| 158 | </td> | ||
| 159 | </tr> | ||
| 160 | <tr> | 146 | <tr> |
| 161 | <th>Phone:</th> | 147 | <th>Phone:</th> |
| 162 | <td><input type="text" name="home_phone" value="<?php echo get_user_meta($_GET['uid'], 'home_phone', true);?>" rel="mask-phone" /></td> | 148 | <td><input type="text" name="home_phone" value="<?php echo get_user_meta($_GET['uid'], 'home_phone', true);?>" rel="mask-phone" /></td> |
| ... | @@ -200,32 +186,19 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); | ... | @@ -200,32 +186,19 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); |
| 200 | <td><input type="text" name="work_city" value="<?php echo get_user_meta($_GET['uid'], 'work_city', true);?>" /></td> | 186 | <td><input type="text" name="work_city" value="<?php echo get_user_meta($_GET['uid'], 'work_city', true);?>" /></td> |
| 201 | </tr> | 187 | </tr> |
| 202 | <tr> | 188 | <tr> |
| 189 | <th>Country:</th> | ||
| 190 | <td><?php echo HTML\form_dropdown('work_country', HTML\Vars::$countries, get_user_meta($_GET['uid'], 'work_country', true), "id='work_country'"); ?></td> | ||
| 191 | </tr> | ||
| 192 | <tr> | ||
| 203 | <th>State/Province:</th> | 193 | <th>State/Province:</th> |
| 204 | <td> | 194 | <td><?php echo HTML\form_linked_dropdown('work_province', 'work_country', HTML\Vars::$provinces,get_user_meta($_GET['uid'], 'work_country', true), get_user_meta($_GET['uid'], 'work_province', true)); ?></td> |
| 205 | <select name="work_province"> | ||
| 206 | <option disabled value="">Select a State/Province</option> | ||
| 207 | <optgroup label="Canada"> | ||
| 208 | <?php HTML\select_opts_provinces(get_user_meta($_GET['uid'], 'work_province', true)); ?> | ||
| 209 | </optgroup> | ||
| 210 | |||
| 211 | <optgroup label="United States"> | ||
| 212 | <?php HTML\select_opts_states(get_user_meta($_GET['uid'], 'work_province', true)); ?> | ||
| 213 | </optgroup> | ||
| 214 | </select> | ||
| 215 | </td> | ||
| 216 | </tr> | 195 | </tr> |
| 196 | |||
| 217 | <tr> | 197 | <tr> |
| 218 | <th>Postal:</th> | 198 | <th>Postal:</th> |
| 219 | <td><input type="text" name="work_postal" value="<?php echo get_user_meta($_GET['uid'], 'work_postal', true); ?>" /></td> | 199 | <td><input type="text" name="work_postal" value="<?php echo get_user_meta($_GET['uid'], 'work_postal', true); ?>" /></td> |
| 220 | </tr> | 200 | </tr> |
| 221 | <tr> | 201 | |
| 222 | <th>Country:</th> | ||
| 223 | <td> | ||
| 224 | <select name="work_country"> | ||
| 225 | <?php HTML\select_opts_countries(get_user_meta($_GET['uid'], 'work_country', true)); ?> | ||
| 226 | </select> | ||
| 227 | </td> | ||
| 228 | </tr> | ||
| 229 | <tr> | 202 | <tr> |
| 230 | <th>Phone:</th> | 203 | <th>Phone:</th> |
| 231 | <td><input type="text" name="work_phone" value="<?php echo get_user_meta($_GET['uid'], 'work_phone', true);?>" rel="mask-phone" /></td> | 204 | <td><input type="text" name="work_phone" value="<?php echo get_user_meta($_GET['uid'], 'work_phone', true);?>" rel="mask-phone" /></td> | ... | ... |
-
Please register or sign in to post a comment