mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
19168d0934
The problem with the previous implementation was that the table's $this->prefs can contain valid non-empty value in its default state - the default column to sort by. On resetting, we must not throw away these default prefs. This patch simplifies the TABLE_VAR_RESET interpretation. If such an HTTP parameter is passed via the request, the table simply behaves as if there were no previously stored preferences (does not matter if coming from the current session, or from the persistent cross-session storage). The logic that decides on whether or not the reset widget should be displayed is put into a new method can_be_reset() with unit tests attached. Finally, the previously private method render_reset_button() is now protected and the reset widget is given a new semantic CSS class.
46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?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/>.
|
|
|
|
/**
|
|
* Provides testable_flexible_table class.
|
|
*
|
|
* @package core
|
|
* @subpackage fixtures
|
|
* @category test
|
|
* @copyright 2015 David Mudrak <david@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
/**
|
|
* Testable subclass of flexible_table providing access to some protected methods.
|
|
*
|
|
* @copyright 2015 David Mudrak <david@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
class testable_flexible_table extends flexible_table {
|
|
|
|
/**
|
|
* Provides access to flexible_table::can_be_reset() method.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function can_be_reset() {
|
|
return parent::can_be_reset();
|
|
}
|
|
}
|