Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-36767 Administration: user_filter_yesno use different name for sq…

…l filter

user_filter_yesno extends user_filter_simpleselect, so if user bulk action filter has both
user_filter_simpleselect and user_filter_yesno, they use the same filter name but counter is
different as they are different classes. Hence using different filter name will avoid confilts
  • Loading branch information...
commit 09153efa90a715ea9ebfaeb96d0e9e556bd97f9b 1 parent f42c34a
Rajesh Taneja rajeshtaneja authored

Showing 1 changed file with 18 additions and 0 deletions. Show diff stats Hide diff stats

  1. +18 0 user/filters/yesno.php
18 user/filters/yesno.php
@@ -15,4 +15,22 @@ class user_filter_yesno extends user_filter_simpleselect {
15 15 function user_filter_yesno($name, $label, $advanced, $field) {
16 16 parent::user_filter_simpleselect($name, $label, $advanced, $field, array(0=>get_string('no'), 1=>get_string('yes')));
17 17 }
  18 +
  19 + /**
  20 + * Returns the condition to be used with SQL
  21 + *
  22 + * @param array $data filter settings
  23 + * @return array sql string and $params
  24 + */
  25 + function get_sql_filter($data) {
  26 + static $counter = 0;
  27 + $name = 'ex_yesno'.$counter++;
  28 +
  29 + $value = $data['value'];
  30 + $field = $this->_field;
  31 + if ($value == '') {
  32 + return array();
  33 + }
  34 + return array("$field=:$name", array($name => $value));
  35 + }
18 36 }

0 comments on commit 09153ef

Please sign in to comment.
Something went wrong with that request. Please try again.