forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-29693 report_configlog: implement report search filtering.
- Loading branch information
1 parent
a00801c
commit fdd3cca
Showing
5 changed files
with
194 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Report search form class. | ||
* | ||
* @package report_configlog | ||
* @copyright 2019 Paul Holden ([email protected]) | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace report_configlog\form; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
require_once($CFG->libdir . '/formslib.php'); | ||
|
||
/** | ||
* Report search form class. | ||
* | ||
* @package report_configlog | ||
* @copyright 2019 Paul Holden ([email protected]) | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class search extends \moodleform { | ||
|
||
/** | ||
* Form definition | ||
* | ||
* @return void | ||
*/ | ||
public function definition() { | ||
$mform = $this->_form; | ||
|
||
// By default just show the 'setting' field. | ||
$mform->addElement('header', 'heading', get_string('search')); | ||
$mform->addElement('text', 'setting', get_string('setting', 'report_configlog')); | ||
$mform->setType('setting', PARAM_TEXT); | ||
|
||
// Rest of the search fields. | ||
$mform->addElement('text', 'value', get_string('value', 'report_configlog')); | ||
$mform->setType('value', PARAM_TEXT); | ||
$mform->addHelpButton('value', 'value', 'report_configlog'); | ||
$mform->setAdvanced('value', true); | ||
|
||
$mform->addElement('text', 'user', get_string('user', 'report_configlog')); | ||
$mform->setType('user', PARAM_TEXT); | ||
$mform->addHelpButton('user', 'user', 'report_configlog'); | ||
$mform->setAdvanced('user', true); | ||
|
||
$mform->addElement('date_selector', 'datefrom', get_string('datefrom', 'report_configlog'), ['optional' => true]); | ||
$mform->setAdvanced('datefrom', true); | ||
|
||
$mform->addElement('date_selector', 'dateto', get_string('dateto', 'report_configlog'), ['optional' => true]); | ||
$mform->setAdvanced('dateto', true); | ||
|
||
$this->add_action_buttons(false, get_string('search')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@report @report_configlog | ||
Feature: In a report, admin can see configuration changes | ||
In order see configuration changes | ||
As an admin | ||
I need to view the configuration changes report and use search to filter the report | ||
|
||
# Set some config values so the report contains known data. | ||
Background: | ||
Given I log in as "admin" | ||
And I change the window size to "large" | ||
And I set the following administration settings values: | ||
| Initial number of overall feedback fields | 5 | | ||
| Maximum folder download size | 2048 | | ||
| Default city | Perth | | ||
|
||
@javascript | ||
Scenario: Display configuration changes report | ||
When I navigate to "Reports > Config changes" in site administration | ||
Then the following should exist in the "report-configlog-report-table" table: | ||
| User | Plugin | Setting | New value | Original value | | ||
| Admin User | quiz | initialnumfeedbacks | 5 | 2 | | ||
| Admin User | folder | maxsizetodownload | 2048 | 0 | | ||
| Admin User | core | defaultcity | Perth | | | ||
|
||
@javascript | ||
Scenario Outline: Search configuration changes report | ||
When I navigate to "Reports > Config changes" in site administration | ||
And I click on "Show more..." "link" | ||
And I set the field "<field>" to "<search>" | ||
And I click on "Search" "button" in the "#fitem_id_submitbutton" "css_element" | ||
Then the following should exist in the "report-configlog-report-table" table: | ||
| Plugin | Setting | New value | | ||
| <plugin> | <setting> | <value> | | ||
And I should not see "<excluded>" in the "report-configlog-report-table" "table" | ||
Examples: | ||
| field | search | plugin | setting | value | excluded | | ||
| Setting | initialnumfeedbacks | quiz | initialnumfeedbacks | 5 | maxsizetodownload | | ||
| Setting | maxsizetodownload | folder | maxsizetodownload | 2048 | initialnumfeedbacks | | ||
| Value | Perth | core | defaultcity | Perth | maxsizetodownload | | ||
| User | Admin | core | defaultcity | Perth | zzzzzzzzz | |