Commit 15d5f7a9 authored by Paul Holden's avatar Paul Holden
Browse files

MDL-72774 reportbuilder: consistent layout of date/duration filters.

parent 9145d80b
......@@ -41,11 +41,10 @@ Feature: View task logs report and use its filters
And I set the following fields in the "Duration" "core_reportbuilder > Filter" to these values:
| Duration operator | <operator> |
| Duration value | 2 |
| Duration unit | minutes |
| Duration unit | minute(s) |
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then I should see "Filters applied"
And I <shouldornotsee> "Nothing to display"
Examples:
| operator | shouldornotsee |
| Less than | should not see |
......
......@@ -35,14 +35,17 @@ $string['errorsourceinvalid'] = 'Could not find valid report source';
$string['errorsourceunavailable'] = 'Report source is not available';
$string['filtercontains'] = 'Contains';
$string['filterdatecurrent'] = 'Current';
$string['filterdatedays'] = 'Day(s)';
$string['filterdatedays'] = 'day(s)';
$string['filterdatefrom'] = 'Date from';
$string['filterdatemonths'] = 'Month(s)';
$string['filterdatehours'] = 'hour(s)';
$string['filterdateminutes'] = 'minute(s)';
$string['filterdatemonths'] = 'month(s)';
$string['filterdatenext'] = 'Next';
$string['filterdateprevious'] = 'Previous';
$string['filterdateseconds'] = 'second(s)';
$string['filterdateto'] = 'Date to';
$string['filterdateweeks'] = 'Week(s)';
$string['filterdateyears'] = 'Year(s)';
$string['filterdateweeks'] = 'week(s)';
$string['filterdateyears'] = 'year(s)';
$string['filterdoesnotcontain'] = 'Does not contain';
$string['filterdurationunit'] = '{$a} unit';
$string['filterendswith'] = 'Ends with';
......
......@@ -109,7 +109,7 @@ class date extends base {
$mform->hideIf("{$this->name}_value", "{$this->name}_operator", 'eq', self::DATE_NOT_EMPTY);
$mform->hideIf("{$this->name}_value", "{$this->name}_operator", 'eq', self::DATE_EMPTY);
$mform->hideIf("{$this->name}_value", "{$this->name}_operator", 'eq', self::DATE_RANGE);
$mform->disabledIf("{$this->name}_value", "{$this->name}_operator", 'eq', self::DATE_CURRENT);
$mform->hideIf("{$this->name}_value", "{$this->name}_operator", 'eq', self::DATE_CURRENT);
// Unit selector for previous and next operators.
$unitlabel = get_string('filterdurationunit', 'core_reportbuilder', $this->get_header());
......@@ -129,7 +129,7 @@ class date extends base {
$mform->hideIf("{$this->name}_unit", "{$this->name}_operator", 'eq', self::DATE_RANGE);
// Add operator/value/unit group.
$mform->addGroup($elements, "{$this->name}_group", '', null, false);
$mform->addGroup($elements, "{$this->name}_group", '', '', false);
// Date selectors for range operator.
$mform->addElement('date_selector', "{$this->name}_from", get_string('filterdatefrom', 'core_reportbuilder'),
......
......@@ -84,10 +84,10 @@ class duration extends base {
// Unit.
$unitlabel = get_string('filterdurationunit', 'core_reportbuilder', $this->get_header());
$units = [
1 => get_string('seconds'),
MINSECS => get_string('minutes'),
HOURSECS => get_string('hours'),
DAYSECS => get_string('days'),
1 => get_string('filterdateseconds', 'core_reportbuilder'),
MINSECS => get_string('filterdateminutes', 'core_reportbuilder'),
HOURSECS => get_string('filterdatehours', 'core_reportbuilder'),
DAYSECS => get_string('filterdatedays', 'core_reportbuilder'),
];
$elements[] = $mform->createElement('select', "{$this->name}_unit", $unitlabel, $units);
......@@ -95,7 +95,7 @@ class duration extends base {
$mform->setDefault("{$this->name}_unit", 1);
$mform->hideIf("{$this->name}_unit", "{$this->name}_operator", 'eq', self::DURATION_ANY);
$mform->addGroup($elements, "{$this->name}_group", '', null, false);
$mform->addGroup($elements, "{$this->name}_group", '', '', false);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment