Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/user/views_handler_filter_user_name.inc | ||
---|---|---|
11 | 11 |
* @ingroup views_filter_handlers |
12 | 12 |
*/ |
13 | 13 |
class views_handler_filter_user_name extends views_handler_filter_in_operator { |
14 |
var $always_multiple = TRUE; |
|
15 | 14 |
|
16 |
function value_form(&$form, &$form_state) { |
|
15 |
/** |
|
16 |
* |
|
17 |
*/ |
|
18 |
public $always_multiple = TRUE; |
|
19 |
|
|
20 |
/** |
|
21 |
* {@inheritdoc} |
|
22 |
*/ |
|
23 |
public function value_form(&$form, &$form_state) { |
|
17 | 24 |
$values = array(); |
18 | 25 |
if ($this->value) { |
19 | 26 |
$result = db_query("SELECT * FROM {users} u WHERE uid IN (:uids)", array(':uids' => $this->value)); |
... | ... | |
22 | 29 |
$values[] = $account->name; |
23 | 30 |
} |
24 | 31 |
else { |
25 |
$values[] = 'Anonymous'; // Intentionally NOT translated. |
|
32 |
// Intentionally NOT translated. |
|
33 |
$values[] = 'Anonymous'; |
|
26 | 34 |
} |
27 | 35 |
} |
28 | 36 |
} |
... | ... | |
42 | 50 |
} |
43 | 51 |
} |
44 | 52 |
|
45 |
function value_validate($form, &$form_state) { |
|
53 |
/** |
|
54 |
* {@inheritdoc} |
|
55 |
*/ |
|
56 |
public function value_validate($form, &$form_state) { |
|
46 | 57 |
$values = drupal_explode_tags($form_state['values']['options']['value']); |
47 | 58 |
$uids = $this->validate_user_strings($form['value'], $values); |
48 | 59 |
|
... | ... | |
51 | 62 |
} |
52 | 63 |
} |
53 | 64 |
|
54 |
function accept_exposed_input($input) { |
|
65 |
/** |
|
66 |
* {@inheritdoc} |
|
67 |
*/ |
|
68 |
public function accept_exposed_input($input) { |
|
55 | 69 |
$rc = parent::accept_exposed_input($input); |
56 | 70 |
|
57 | 71 |
if ($rc) { |
... | ... | |
64 | 78 |
return $rc; |
65 | 79 |
} |
66 | 80 |
|
67 |
function exposed_validate(&$form, &$form_state) { |
|
81 |
/** |
|
82 |
* {@inheritdoc} |
|
83 |
*/ |
|
84 |
public function exposed_validate(&$form, &$form_state) { |
|
68 | 85 |
if (empty($this->options['exposed'])) { |
69 | 86 |
return; |
70 | 87 |
} |
... | ... | |
96 | 113 |
} |
97 | 114 |
|
98 | 115 |
/** |
99 |
* Validate the user string. Since this can come from either the form |
|
100 |
* or the exposed filter, this is abstracted out a bit so it can |
|
101 |
* handle the multiple input sources. |
|
116 |
* Validate the user string. |
|
117 |
* |
|
118 |
* Since this can come from either the form or the exposed filter, this is |
|
119 |
* abstracted out a bit so it can handle the multiple input sources. |
|
102 | 120 |
*/ |
103 |
function validate_user_strings(&$form, $values) { |
|
121 |
public function validate_user_strings(&$form, $values) {
|
|
104 | 122 |
$uids = array(); |
105 | 123 |
$placeholders = array(); |
106 | 124 |
$args = array(); |
... | ... | |
133 | 151 |
return $uids; |
134 | 152 |
} |
135 | 153 |
|
136 |
function value_submit($form, &$form_state) { |
|
137 |
// prevent array filter from removing our anonymous user. |
|
154 |
/** |
|
155 |
* {@inheritdoc} |
|
156 |
*/ |
|
157 |
public function value_submit($form, &$form_state) { |
|
158 |
// Prevent array filter from removing our anonymous user. |
|
138 | 159 |
} |
139 | 160 |
|
140 |
// Override to do nothing. |
|
141 |
function get_value_options() { } |
|
161 |
/** |
|
162 |
* {@inheritdoc} |
|
163 |
*/ |
|
164 |
public function get_value_options() { |
|
165 |
} |
|
142 | 166 |
|
143 |
function admin_summary() { |
|
144 |
// set up $this->value_options for the parent summary |
|
167 |
/** |
|
168 |
* {@inheritdoc} |
|
169 |
*/ |
|
170 |
public function admin_summary() { |
|
171 |
// Set up $this->value_options for the parent summary. |
|
145 | 172 |
$this->value_options = array(); |
146 | 173 |
|
147 | 174 |
if ($this->value) { |
... | ... | |
152 | 179 |
$this->value_options[$account->uid] = $account->name; |
153 | 180 |
} |
154 | 181 |
else { |
155 |
$this->value_options[$account->uid] = 'Anonymous'; // Intentionally NOT translated. |
|
182 |
// Intentionally NOT translated. |
|
183 |
$this->value_options[$account->uid] = 'Anonymous'; |
|
156 | 184 |
} |
157 | 185 |
} |
158 | 186 |
} |
159 | 187 |
|
160 | 188 |
return parent::admin_summary(); |
161 | 189 |
} |
190 |
|
|
162 | 191 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules