MDL-48012 core: fixed failing unit tests
[moodle.git] / admin / tool / recyclebin / settings.php
CommitLineData
60444e53
SK
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/**
18 * Recycle bin settings.
19 *
e78cd9b7 20 * @package tool_recyclebin
60444e53
SK
21 * @copyright 2015 University of Kent
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die();
26
27global $PAGE;
28
29if ($hassiteconfig) {
e78cd9b7
MN
30 $settings = new admin_settingpage('tool_recyclebin', get_string('pluginname', 'tool_recyclebin'));
31 $ADMIN->add('tools', $settings);
60444e53
SK
32
33 $lifetimes = array(
e78cd9b7 34 0 => new lang_string('neverdelete', 'tool_recyclebin'),
60444e53
SK
35 1000 => new lang_string('numdays', '', 1000),
36 365 => new lang_string('numdays', '', 365),
37 180 => new lang_string('numdays', '', 180),
38 150 => new lang_string('numdays', '', 150),
39 120 => new lang_string('numdays', '', 120),
40 90 => new lang_string('numdays', '', 90),
41 60 => new lang_string('numdays', '', 60),
42 35 => new lang_string('numdays', '', 35),
43 21 => new lang_string('numdays', '', 21),
44 14 => new lang_string('numdays', '', 14),
45 10 => new lang_string('numdays', '', 10),
46 5 => new lang_string('numdays', '', 5),
47 2 => new lang_string('numdays', '', 2)
48 );
49
50 $settings->add(new admin_setting_configcheckbox(
e78cd9b7
MN
51 'tool_recyclebin/enablecourse',
52 new lang_string('enablecourse', 'tool_recyclebin'),
53 new lang_string('enablecourse_desc', 'tool_recyclebin'),
60444e53
SK
54 1
55 ));
56
57 $settings->add(new admin_setting_configselect(
e78cd9b7
MN
58 'tool_recyclebin/expiry',
59 new lang_string('expiry', 'tool_recyclebin'),
60 new lang_string('expiry_desc', 'tool_recyclebin'),
60444e53
SK
61 0,
62 $lifetimes
63 ));
64
65
66 $settings->add(new admin_setting_configcheckbox(
e78cd9b7
MN
67 'tool_recyclebin/enablecategory',
68 new lang_string('enablecategory', 'tool_recyclebin'),
69 new lang_string('enablecategory_desc', 'tool_recyclebin'),
60444e53
SK
70 1
71 ));
72
73 $settings->add(new admin_setting_configselect(
e78cd9b7
MN
74 'tool_recyclebin/course_expiry',
75 new lang_string('course_expiry', 'tool_recyclebin'),
76 new lang_string('course_expiry_desc', 'tool_recyclebin'),
60444e53
SK
77 0,
78 $lifetimes
79 ));
80
81 unset($lifetimes);
82
83 $settings->add(new admin_setting_configcheckbox(
e78cd9b7
MN
84 'tool_recyclebin/autohide',
85 new lang_string('autohide', 'tool_recyclebin'),
86 new lang_string('autohide_desc', 'tool_recyclebin'),
60444e53
SK
87 0
88 ));
89
90 $settings->add(new admin_setting_configmultiselect(
e78cd9b7
MN
91 'tool_recyclebin/protectedmods',
92 new lang_string('protectedmods', 'tool_recyclebin'),
93 new lang_string('protectedmods_desc', 'tool_recyclebin'),
60444e53
SK
94 array(),
95 $DB->get_records_menu('modules', array('visible' => 1), 'name ASC', 'id, name')
96 ));
97}