1441 |
ariadna |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
namespace core\output\actions;
|
|
|
18 |
|
|
|
19 |
/**
|
|
|
20 |
* Confirm action
|
|
|
21 |
*
|
|
|
22 |
* @copyright 2009 Nicolas Connault
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
* @since Moodle 2.0
|
|
|
25 |
* @package core
|
|
|
26 |
* @category output
|
|
|
27 |
*/
|
|
|
28 |
class confirm_action extends component_action {
|
|
|
29 |
/**
|
|
|
30 |
* Constructs the confirm action object
|
|
|
31 |
*
|
|
|
32 |
* @param string $message The message to display to the user when they are shown
|
|
|
33 |
* the confirm dialogue.
|
|
|
34 |
* @param string $callback Deprecated since 2.7
|
|
|
35 |
* @param string $continuelabel The string to use for he continue button
|
|
|
36 |
* @param string $cancellabel The string to use for the cancel button
|
|
|
37 |
*/
|
|
|
38 |
public function __construct($message, $callback = null, $continuelabel = null, $cancellabel = null) {
|
|
|
39 |
if ($callback !== null) {
|
|
|
40 |
debugging(
|
|
|
41 |
'The callback argument to new confirm_action() has been deprecated.' .
|
|
|
42 |
' If you need to use a callback, please write Javascript to use moodle-core-notification-confirmation ' .
|
|
|
43 |
'and attach to the provided events.',
|
|
|
44 |
DEBUG_DEVELOPER,
|
|
|
45 |
);
|
|
|
46 |
}
|
|
|
47 |
parent::__construct('click', 'M.util.show_confirm_dialog', [
|
|
|
48 |
'message' => $message,
|
|
|
49 |
'continuelabel' => $continuelabel,
|
|
|
50 |
'cancellabel' => $cancellabel,
|
|
|
51 |
]);
|
|
|
52 |
}
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
// Alias this class to the old name.
|
|
|
56 |
// This file will be autoloaded by the legacyclasses autoload system.
|
|
|
57 |
// In future all uses of this class will be corrected and the legacy references will be removed.
|
|
|
58 |
class_alias(confirm_action::class, \confirm_action::class);
|