Skip to content

Commit

Permalink
MDL-48519 accessibility: improved accessibility of user filters
Browse files Browse the repository at this point in the history
  • Loading branch information
marsh0lion authored and andrewnicols committed Feb 24, 2015
1 parent 2d7c31b commit ede8ae0
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
6 changes: 6 additions & 0 deletions lang/en/filters.php
Expand Up @@ -35,9 +35,11 @@
$string['contains'] = 'contains';
$string['content'] = 'Content';
$string['contentandheadings'] = 'Content and headings';
$string['coursecategory'] = 'course category';
$string['courserole'] = 'Course role';
$string['courserolelabel'] = '{$a->label} is {$a->rolename} in {$a->coursename} from {$a->categoryname}';
$string['courserolelabelerror'] = '{$a->label} error: course {$a->coursename} does not exist';
$string['coursevalue'] = 'course value';
$string['datelabelisafter'] = '{$a->label} is after {$a->after}';
$string['datelabelisbefore'] = '{$a->label} is before {$a->before}';
$string['datelabelisbetween'] = '{$a->label} is between {$a->after} and {$a->before}';
Expand All @@ -63,13 +65,16 @@
$string['isequalto'] = 'is equal to';
$string['isnotdefined'] = 'isn\'t defined';
$string['isnotequalto'] = 'isn\'t equal to';
$string['limiterfor'] = '{$a} field limiter';
$string['neveraccessed'] = 'Never accessed';
$string['nevermodified'] = 'Never modified';
$string['newfilter'] = 'New filter';
$string['nofiltersenabled'] = 'No filter plugins have been enabled on this site.';
$string['off'] = 'Off';
$string['offbutavailable'] = 'Off, but available';
$string['on'] = 'On';
$string['profilefilterfield'] = 'Profile field name';
$string['profilefilterlimiter'] = 'Profile field operator';
$string['profilelabel'] = '{$a->label}: {$a->profile} {$a->operator} {$a->value}';
$string['profilelabelnovalue'] = '{$a->label}: {$a->profile} {$a->operator}';
$string['removeall'] = 'Remove all filters';
Expand All @@ -79,3 +84,4 @@
$string['tablenosave'] = 'Changes in table above are saved automatically.';
$string['textlabel'] = '{$a->label} {$a->operator} {$a->value}';
$string['textlabelnovalue'] = '{$a->label} {$a->operator}';
$string['valuefor'] = '{$a} value';
7 changes: 2 additions & 5 deletions user/filters/checkbox.php
Expand Up @@ -76,13 +76,10 @@ public function __construct($name, $label, $advanced, $field, $disableelements=n
* @param moodleform $mform a MoodleQuickForm object in which element will be added
*/
public function setupForm(&$mform) {
$objs = array();

$objs[] = $mform->createElement('checkbox', $this->_name, null, '');
$grp = $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);
$mform->addElement('checkbox', $this->_name, $this->_label, '');

if ($this->_advanced) {
$mform->setAdvanced($this->_name.'_grp');
$mform->setAdvanced($this->_name);
}
// Check if disable if options are set. if yes then set rules.
if (!empty($this->disableelements) && is_array($this->disableelements)) {
Expand Down
6 changes: 4 additions & 2 deletions user/filters/cohort.php
Expand Up @@ -60,8 +60,10 @@ public function getOperators() {
*/
public function setupForm(&$mform) {
$objs = array();
$objs[] = $mform->createElement('select', $this->_name.'_op', null, $this->getOperators());
$objs[] = $mform->createElement('text', $this->_name, null);
$objs['select'] = $mform->createElement('select', $this->_name.'_op', null, $this->getOperators());
$objs['text'] = $mform->createElement('text', $this->_name, null);
$objs['select']->setLabel(get_string('limiterfor', 'filters', $this->_label));
$objs['text']->setLabel(get_string('valuefor', 'filters', $this->_label));
$grp =& $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);
$mform->setType($this->_name, PARAM_RAW);
$mform->disabledIf($this->_name, $this->_name.'_op', 'eq', 5);
Expand Down
9 changes: 6 additions & 3 deletions user/filters/courserole.php
Expand Up @@ -67,9 +67,12 @@ public function get_course_categories() {
*/
public function setupForm(&$mform) {
$objs = array();
$objs[] = $mform->createElement('select', $this->_name .'_rl', null, $this->get_roles());
$objs[] = $mform->createElement('select', $this->_name .'_ct', null, $this->get_course_categories());
$objs[] = $mform->createElement('text', $this->_name, null);
$objs['role'] = $mform->createElement('select', $this->_name .'_rl', null, $this->get_roles());
$objs['role']->setLabel(get_string('courserole', 'filters'));
$objs['category'] = $mform->createElement('select', $this->_name .'_ct', null, $this->get_course_categories());
$objs['category']->setLabel(get_string('coursecategory', 'filters'));
$objs['value'] = $mform->createElement('text', $this->_name, null);
$objs['value']->setLabel(get_string('coursevalue', 'filters'));
$grp =& $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);
$mform->setType($this->_name, PARAM_TEXT);
if ($this->_advanced) {
Expand Down
9 changes: 6 additions & 3 deletions user/filters/profilefield.php
Expand Up @@ -84,9 +84,12 @@ public function setupForm(&$mform) {
return;
}
$objs = array();
$objs[] = $mform->createElement('select', $this->_name.'_fld', null, $profilefields);
$objs[] = $mform->createElement('select', $this->_name.'_op', null, $this->get_operators());
$objs[] = $mform->createElement('text', $this->_name, null);
$objs['field'] = $mform->createElement('select', $this->_name.'_fld', null, $profilefields);
$objs['op'] = $mform->createElement('select', $this->_name.'_op', null, $this->get_operators());
$objs['value'] = $mform->createElement('text', $this->_name, null);
$objs['field']->setLabel(get_string('profilefilterfield', 'filters'));
$objs['op']->setLabel(get_string('profilefilterlimiter', 'filters'));
$objs['value']->setLabel(get_string('valuefor', 'filters', $this->_label));
$grp =& $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);
$mform->setType($this->_name, PARAM_RAW);
if ($this->_advanced) {
Expand Down
6 changes: 4 additions & 2 deletions user/filters/select.php
Expand Up @@ -75,8 +75,10 @@ public function get_operators() {
*/
public function setupForm(&$mform) {
$objs = array();
$objs[] = $mform->createElement('select', $this->_name.'_op', null, $this->get_operators());
$objs[] = $mform->createElement('select', $this->_name, null, $this->_options);
$objs['limiter'] = $mform->createElement('select', $this->_name.'_op', null, $this->get_operators());
$objs['limiter']->setLabel(get_string('limiterfor', 'filters', $this->_label));
$objs['country'] = $mform->createElement('select', $this->_name, null, $this->_options);
$objs['country']->setLabel(get_string('valuefor', 'filters', $this->_label));
$grp =& $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);
$mform->disabledIf($this->_name, $this->_name.'_op', 'eq', 0);
if (!is_null($this->_default)) {
Expand Down
6 changes: 4 additions & 2 deletions user/filters/text.php
Expand Up @@ -65,8 +65,10 @@ public function getOperators() {
*/
public function setupForm(&$mform) {
$objs = array();
$objs[] = $mform->createElement('select', $this->_name.'_op', null, $this->getOperators());
$objs[] = $mform->createElement('text', $this->_name, null);
$objs['select'] = $mform->createElement('select', $this->_name.'_op', null, $this->getOperators());
$objs['text'] = $mform->createElement('text', $this->_name, null);
$objs['select']->setLabel(get_string('limiterfor', 'filters', $this->_label));
$objs['text']->setLabel(get_string('valuefor', 'filters', $this->_label));
$grp =& $mform->addElement('group', $this->_name.'_grp', $this->_label, $objs, '', false);
$mform->setType($this->_name, PARAM_RAW);
$mform->disabledIf($this->_name, $this->_name.'_op', 'eq', 5);
Expand Down

0 comments on commit ede8ae0

Please sign in to comment.