From 372fdd5b330cfdf3b3f6c48621a39dcab76b4af8 Mon Sep 17 00:00:00 2001 From: Sesostris Vieira Date: Thu, 14 Aug 2014 14:46:46 -0300 Subject: [PATCH] Adicionado filtro por e-mail --- index.php | 8 +++++++- report_form.php | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index aad2d46..e77e675 100644 --- a/index.php +++ b/index.php @@ -132,10 +132,16 @@ if ($formdata = $mform->get_data()) { $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 -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); } else { list($in_roles, $param_roles) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED); diff --git a/report_form.php b/report_form.php index ae68973..f2419b7 100644 --- a/report_form.php +++ b/report_form.php @@ -52,6 +52,9 @@ class filter_form extends moodleform { $filterfields = $this->_filterfields; $roles = $this->_roles; + // User fields filter + $mform->addElement('text', 'email', get_string('email')); + // Role filter $mform->addElement('header', 'filter', get_string('roles')); foreach ($roles as $role) {