| 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 gradepenalty_duedate\output;
|
|
|
18 |
|
|
|
19 |
use core\output\single_button;
|
|
|
20 |
use core\url;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Renderable class for the action bar elements in the penalty rule page.
|
|
|
24 |
*
|
|
|
25 |
* @package gradepenalty_duedate
|
|
|
26 |
* @copyright 2024 Catalyst IT Australia Pty Ltd
|
|
|
27 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
28 |
*/
|
|
|
29 |
class edit_penalty_rule_action_bar extends view_penalty_rule_action_bar {
|
|
|
30 |
#[\Override]
|
|
|
31 |
public function get_template(): string {
|
|
|
32 |
return 'gradepenalty_duedate/edit_penalty_rule_action_bar';
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
#[\Override]
|
|
|
36 |
public function export_for_template(\renderer_base $output): array {
|
|
|
37 |
$data = [];
|
|
|
38 |
|
|
|
39 |
$contextid = $this->context->id;
|
|
|
40 |
|
|
|
41 |
// Title.
|
|
|
42 |
$data['title'] = $output->heading($this->title);
|
|
|
43 |
|
|
|
44 |
// Delete all rules button.
|
|
|
45 |
$deleteallruleurl = new url($this->url->out(), [
|
|
|
46 |
'contextid' => $contextid,
|
|
|
47 |
'deleteallrules' => 1,
|
|
|
48 |
]);
|
|
|
49 |
$deleteallrulebutton = new single_button(
|
|
|
50 |
$deleteallruleurl,
|
|
|
51 |
get_string('deleteallrules', 'gradepenalty_duedate'),
|
|
|
52 |
'get',
|
|
|
53 |
single_button::BUTTON_DANGER
|
|
|
54 |
);
|
|
|
55 |
$data['deleteallrulebutton'] = $deleteallrulebutton->export_for_template($output);
|
|
|
56 |
|
|
|
57 |
return $data;
|
|
|
58 |
}
|
|
|
59 |
}
|