2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * Privacy Subsystem implementation for tool_assignmentupgrade.
20 * @package tool_assignmentupgrade
21 * @copyright 2018 Zig Tan <zig@moodle.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 namespace tool_assignmentupgrade\privacy;
27 use core_privacy\local\metadata\collection;
28 use core_privacy\local\request\writer;
30 defined('MOODLE_INTERNAL') || die();
33 * Privacy Subsystem for tool_assignmentupgrade implementing metadata, plugin, and user_preference providers.
35 * @copyright 2018 Zig Tan <zig@moodle.com>
36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38 class provider implements
39 \core_privacy\local\metadata\provider,
40 \core_privacy\local\request\user_preference_provider {
43 * Returns meta data about this system.
45 * @param collection $collection The initialised collection to add items to.
46 * @return collection A listing of user data stored through this system.
48 public static function get_metadata(collection $collection) : collection {
49 $collection->add_user_preference(
50 'tool_assignmentupgrade_perpage',
51 'privacy:metadata:preference:perpage'
57 * Export all user preferences for the plugin.
59 * @param int $userid The userid of the user whose data is to be exported.
61 public static function export_user_preferences(int $userid) {
62 $perpage = get_user_preferences('tool_assignmentupgrade_perpage', null, $userid);
63 if ($perpage !== null) {
64 writer::export_user_preference(
65 'tool_assignmentupgrade',
68 get_string('privacy:metadata:preference:perpage', 'tool_assignmentupgrade')