class multiple_email_handler_filter_current in Multiple E-mail Addresses 2.x
Same name and namespace in other branches
- 6 views/multiple_email_handler_filter_current.inc \multiple_email_handler_filter_current
- 7 views/multiple_email_handler_filter_current.inc \multiple_email_handler_filter_current
Filter handler for the current user's e-mail addresses to match a field.
Hierarchy
- class \multiple_email_handler_filter_current extends \views_handler_filter_boolean_operator
Expanded class hierarchy of multiple_email_handler_filter_current
1 string reference to 'multiple_email_handler_filter_current'
- multiple_email_views_data_alter in views/
multiple_email.views.inc - @todo Please document this function.
File
- views/
multiple_email_handler_filter_current.inc, line 11 - filter heandler for matching e-mail addresses to cck e-mail field.
View source
class multiple_email_handler_filter_current extends views_handler_filter_boolean_operator {
function construct() {
parent::construct();
$this->value_value = t('Matches one of the multiple e-mail addresses of the logged in user');
}
function query() {
$this
->ensure_my_table();
$where = "{$this->table_alias}.{$this->real_field} ";
// get the current user's addresses
global $user;
$emails = multiple_email_load_addresses($user->uid);
$addresses = array();
foreach ($emails as $email) {
if (is_object($email) && $email->confirm_code) {
$addresses[] = $email->email;
}
}
if (empty($this->value)) {
$where .= 'NOT ';
}
$where .= "IN ('" . implode("','", $addresses) . "') ";
$this->query
->add_where($this->options['group'], $where);
}
}