Browse Source

Adicionado filtro por e-mail

master
Sesostris Vieira 11 years ago
parent
commit
372fdd5b33
  1. 8
      index.php
  2. 3
      report_form.php

8
index.php

@ -132,10 +132,16 @@ if ($formdata = $mform->get_data()) {
$where_params = $where_params + $param_options; $where_params = $where_params + $param_options;
} }
} }
// Email filter
if (array_key_exists('email', $formdata)) {
$email_like = $DB->sql_like('u.email', "'%{$formdata->email}%'", false);
$whereors[] = "($email_like)";
}
} }
// Role filter // Role filter
if (array_key_exists('role', $formdata)) { if ($formdata and array_key_exists('role', $formdata)) {
list($in_roles, $param_roles) = $DB->get_in_or_equal(array_keys($formdata->role), SQL_PARAMS_NAMED); list($in_roles, $param_roles) = $DB->get_in_or_equal(array_keys($formdata->role), SQL_PARAMS_NAMED);
} else { } else {
list($in_roles, $param_roles) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED); list($in_roles, $param_roles) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED);

3
report_form.php

@ -52,6 +52,9 @@ class filter_form extends moodleform {
$filterfields = $this->_filterfields; $filterfields = $this->_filterfields;
$roles = $this->_roles; $roles = $this->_roles;
// User fields filter
$mform->addElement('text', 'email', get_string('email'));
// Role filter // Role filter
$mform->addElement('header', 'filter', get_string('roles')); $mform->addElement('header', 'filter', get_string('roles'));
foreach ($roles as $role) { foreach ($roles as $role) {

Loading…
Cancel
Save