Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 14... Línea 14...
14
// You should have received a copy of the GNU General Public License
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/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
Línea -... Línea 17...
-
 
17
namespace qbank_managecategories\privacy;
-
 
18
 
-
 
19
use core_privacy\local\metadata\collection;
17
namespace qbank_managecategories\privacy;
20
use core_privacy\local\request\writer;
18
 
21
 
19
/**
22
/**
20
 * Privacy Subsystem for qbank_managecategories implementing null_provider.
23
 * Privacy Subsystem for qbank_managecategories implementing null_provider.
21
 *
24
 *
22
 * @package   qbank_managecategories
25
 * @package   qbank_managecategories
23
 * @category  privacy
26
 * @category  privacy
24
 * @copyright 2021 Catalyst IT Australia Pty Ltd
27
 * @copyright 2021 Catalyst IT Australia Pty Ltd
25
 * @author    Guillermo Gomez Arias <guillermogomez@catalyst-au.net>
28
 * @author    Guillermo Gomez Arias <guillermogomez@catalyst-au.net>
-
 
29
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
-
 
31
class provider implements
27
 */
32
    \core_privacy\local\metadata\provider,
28
class provider implements \core_privacy\local\metadata\null_provider {
-
 
29
    /**
33
    \core_privacy\local\request\user_preference_provider {
30
     * Get the language string identifier with the component's language
34
    /**
-
 
35
     * Returns meta data about this system.
31
     * file to explain why this plugin stores no data.
36
     *
32
     *
37
     * @param   collection $collection The initialised collection to add items to.
33
     * @return  string
38
     * @return  collection A listing of user data stored through this system.
-
 
39
     */
-
 
40
    public static function get_metadata(collection $collection): collection {
-
 
41
        $collection->add_user_preference('qbank_managecategories_showdescriptions', 'privacy:preference:showdescriptions');
34
     */
42
        $collection->add_user_preference('qbank_managecategories_includesubcategories_filter_default',
-
 
43
            'privacy:preference:includesubcategories_filter_default');
-
 
44
        return $collection;
-
 
45
    }
-
 
46
 
-
 
47
    /**
-
 
48
     * Export all user preferences for the plugin.
-
 
49
     *
-
 
50
     * @param int $userid The userid of the user whose data is to be exported.
-
 
51
     */
-
 
52
    public static function export_user_preferences(int $userid) {
-
 
53
        $showdescription = get_user_preferences('qbank_managecategories_showdescriptions', null, $userid);
-
 
54
        if ($showdescription !== null) {
-
 
55
            $displaydescription = $showdescription ? 'displaydescription' : 'descriptionnotdisplayed';
-
 
56
            writer::export_user_preference(
-
 
57
                'qbank_managecategories',
-
 
58
                'showdescr',
-
 
59
                $showdescription,
-
 
60
                get_string($displaydescription, 'qbank_managecategories')
-
 
61
            );
-
 
62
        }
-
 
63
 
-
 
64
        $includesubcategories = get_user_preferences('qbank_managecategories_includesubcategories_filter_default', null, $userid);
-
 
65
        if (isset($includesubcategories)) {
-
 
66
            $displayquestions = $includesubcategories ? 'questionsubcategoriesdisplayed' : 'questionsubcategoriesnotdisplayed';
-
 
67
            writer::export_user_preference(
-
 
68
                'qbank_managecategories',
-
 
69
                'includesubcategories',
-
 
70
                $includesubcategories,
-
 
71
                get_string($displayquestions, 'qbank_managecategories')
35
    public static function get_reason(): string {
72
            );
36
        return 'privacy:metadata';
73
        }