1 |
efrain |
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 qtype_ordering\privacy;
|
|
|
18 |
|
|
|
19 |
use core_privacy\local\metadata\collection;
|
|
|
20 |
use core_privacy\local\request\writer;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Privacy Subsystem for qtype_numerical implementing null_provider.
|
|
|
24 |
*
|
|
|
25 |
* @package qtype_ordering
|
|
|
26 |
* @copyright 2013 Gordon Bateson (gordon.bateson@gmail.com)
|
|
|
27 |
* @author rdebleu@eWallah.net
|
|
|
28 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
29 |
*/
|
|
|
30 |
class provider implements \core_privacy\local\metadata\provider, \core_privacy\local\request\user_preference_provider {
|
|
|
31 |
/**
|
|
|
32 |
* Returns metadata about this question.
|
|
|
33 |
*
|
|
|
34 |
* @param collection $collection The initialised collection to add items to.
|
|
|
35 |
* @return collection A listing of user data stored through this question.
|
|
|
36 |
*/
|
|
|
37 |
public static function get_metadata(collection $collection): collection {
|
|
|
38 |
$collection->add_user_preference('qtype_ordering_layouttype', 'privacy:preference:layouttype');
|
|
|
39 |
$collection->add_user_preference('qtype_ordering_selecttype', 'privacy:preference:selecttype');
|
|
|
40 |
$collection->add_user_preference('qtype_ordering_selectcount', 'privacy:preference:selectcount');
|
|
|
41 |
$collection->add_user_preference('qtype_ordering_gradingtype', 'privacy:preference:gradingtype');
|
|
|
42 |
$collection->add_user_preference('qtype_ordering_showgrading', 'privacy:preference:showgrading');
|
|
|
43 |
$collection->add_user_preference('qtype_ordering_numberingstyle', 'privacy:preference:numberingstyle');
|
|
|
44 |
return $collection;
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* Export all user preferences for the question.
|
|
|
49 |
*
|
|
|
50 |
* @param int $userid The userid of the user whose data is to be exported.
|
|
|
51 |
* @return void
|
|
|
52 |
*/
|
|
|
53 |
public static function export_user_preferences(int $userid): void {
|
|
|
54 |
$preference = get_user_preferences('qtype_ordering_layouttype', null, $userid);
|
|
|
55 |
if (null !== $preference) {
|
|
|
56 |
writer::export_user_preference(
|
|
|
57 |
'qtype_ordering',
|
|
|
58 |
'layouttype',
|
|
|
59 |
$preference,
|
|
|
60 |
get_string('privacy:preference:layouttype', 'qtype_ordering')
|
|
|
61 |
);
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
$preference = get_user_preferences('qtype_ordering_selecttype', null, $userid);
|
|
|
65 |
if (null !== $preference) {
|
|
|
66 |
writer::export_user_preference(
|
|
|
67 |
'qtype_ordering',
|
|
|
68 |
'selecttype',
|
|
|
69 |
$preference,
|
|
|
70 |
get_string('privacy:preference:selecttype', 'qtype_ordering')
|
|
|
71 |
);
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
$preference = get_user_preferences('qtype_ordering_selectcount', null, $userid);
|
|
|
75 |
if (null !== $preference) {
|
|
|
76 |
writer::export_user_preference(
|
|
|
77 |
'qtype_ordering',
|
|
|
78 |
'selectcount',
|
|
|
79 |
$preference,
|
|
|
80 |
get_string('privacy:preference:selectcount', 'qtype_ordering')
|
|
|
81 |
);
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
$preference = get_user_preferences('qtype_ordering_gradingtype', null, $userid);
|
|
|
85 |
if (null !== $preference) {
|
|
|
86 |
writer::export_user_preference(
|
|
|
87 |
'qtype_ordering',
|
|
|
88 |
'gradingtype',
|
|
|
89 |
$preference,
|
|
|
90 |
get_string('privacy:preference:gradingtype', 'qtype_ordering')
|
|
|
91 |
);
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
$preference = get_user_preferences('qtype_ordering_showgrading', null, $userid);
|
|
|
95 |
if (null !== $preference) {
|
|
|
96 |
writer::export_user_preference(
|
|
|
97 |
'qtype_ordering',
|
|
|
98 |
'showgrading',
|
|
|
99 |
$preference,
|
|
|
100 |
get_string('privacy:preference:showgrading', 'qtype_ordering')
|
|
|
101 |
);
|
|
|
102 |
}
|
|
|
103 |
|
|
|
104 |
$preference = get_user_preferences('qtype_ordering_numberingstyle', null, $userid);
|
|
|
105 |
if (null !== $preference) {
|
|
|
106 |
writer::export_user_preference(
|
|
|
107 |
'qtype_ordering',
|
|
|
108 |
'numberingstyle',
|
|
|
109 |
$preference,
|
|
|
110 |
get_string('privacy:preference:numberingstyle', 'qtype_ordering')
|
|
|
111 |
);
|
|
|
112 |
}
|
|
|
113 |
}
|
|
|
114 |
}
|