Projet

Général

Profil

Paste
Télécharger (3,33 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / webform / includes / webform.options.inc @ ca0757b9

1
<?php
2

    
3
/**
4
 * @file
5
 * A collection of built-in select list options for Webform.
6
 */
7

    
8
/**
9
 * Private implementation of hook_webform_select_options_info().
10
 *
11
 * @see webform_webform_select_options_info()
12
 */
13
function _webform_options_info() {
14
  $items = array();
15

    
16
  $items['days'] = array(
17
    'title' => t('Days of the week'),
18
    'options callback' => 'webform_options_days',
19
    'file' => 'includes/webform.options.inc',
20
  );
21

    
22
  $items['countries'] = array(
23
    'title' => t('Countries'),
24
    'options callback' => 'webform_options_countries',
25
    'file' => 'includes/webform.options.inc',
26
  );
27

    
28
  $items['united_states'] = array(
29
    'title' => t('US states'),
30
    'options callback' => 'webform_options_united_states',
31
    'file' => 'includes/webform.options.inc',
32
  );
33

    
34
  return $items;
35
}
36

    
37
/**
38
 * Option list containing the days of the week.
39
 */
40
function webform_options_days($component, $flat, $filter, $arguments) {
41
  $days = array(
42
    'sunday' => t('Sunday'),
43
    'monday' => t('Monday'),
44
    'tuesday' => t('Tuesday'),
45
    'wednesday' => t('Wednesday'),
46
    'thursday' => t('Thursday'),
47
    'friday' => t('Friday'),
48
    'saturday' => t('Saturday'),
49
  );
50

    
51
  // Order according to site settings for first day.
52
  if ($first_day = variable_get('date_first_day', 0)) {
53
    $week = array_splice($days, $first_day);
54
    $days = array_merge($week, $days);
55
  }
56

    
57
  return $days;
58
}
59

    
60
/**
61
 * Options list containing country names.
62
 */
63
function webform_options_countries($component, $flat, $filter, $arguments) {
64
  include_once DRUPAL_ROOT . '/includes/locale.inc';
65
  return country_get_list();
66
}
67

    
68
/**
69
 * Options list containing United States states and territories.
70
 */
71
function webform_options_united_states($component, $flat, $filter, $arguments) {
72
  return array(
73
    'AL' => t('Alabama'),
74
    'AK' => t('Alaska'),
75
    'AS' => t('American Samoa'),
76
    'AZ' => t('Arizona'),
77
    'AR' => t('Arkansas'),
78
    'CA' => t('California'),
79
    'CO' => t('Colorado'),
80
    'CT' => t('Connecticut'),
81
    'DE' => t('Delaware'),
82
    'DC' => t('District of Columbia'),
83
    'FL' => t('Florida'),
84
    'GA' => t('Georgia'),
85
    'GU' => t('Guam'),
86
    'HI' => t('Hawaii'),
87
    'ID' => t('Idaho'),
88
    'IL' => t('Illinois'),
89
    'IN' => t('Indiana'),
90
    'IA' => t('Iowa'),
91
    'KS' => t('Kansas'),
92
    'KY' => t('Kentucky'),
93
    'LA' => t('Louisiana'),
94
    'ME' => t('Maine'),
95
    'MH' => t('Marshall Islands'),
96
    'MD' => t('Maryland'),
97
    'MA' => t('Massachusetts'),
98
    'MI' => t('Michigan'),
99
    'MN' => t('Minnesota'),
100
    'MS' => t('Mississippi'),
101
    'MO' => t('Missouri'),
102
    'MT' => t('Montana'),
103
    'NE' => t('Nebraska'),
104
    'NV' => t('Nevada'),
105
    'NH' => t('New Hampshire'),
106
    'NJ' => t('New Jersey'),
107
    'NM' => t('New Mexico'),
108
    'NY' => t('New York'),
109
    'NC' => t('North Carolina'),
110
    'ND' => t('North Dakota'),
111
    'MP' => t('Northern Marianas Islands'),
112
    'OH' => t('Ohio'),
113
    'OK' => t('Oklahoma'),
114
    'OR' => t('Oregon'),
115
    'PW' => t('Palau'),
116
    'PA' => t('Pennsylvania'),
117
    'PR' => t('Puerto Rico'),
118
    'RI' => t('Rhode Island'),
119
    'SC' => t('South Carolina'),
120
    'SD' => t('South Dakota'),
121
    'TN' => t('Tennessee'),
122
    'TX' => t('Texas'),
123
    'UT' => t('Utah'),
124
    'VT' => t('Vermont'),
125
    'VI' => t('Virgin Islands'),
126
    'VA' => t('Virginia'),
127
    'WA' => t('Washington'),
128
    'WV' => t('West Virginia'),
129
    'WI' => t('Wisconsin'),
130
    'WY' => t('Wyoming'),
131
  );
132
}