See Release Notes
Long Term Support Release
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 * Privacy Subsystem implementation for block_myoverview. 19 * 20 * @package block_myoverview 21 * @copyright 2018 Zig Tan <zig@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace block_myoverview\privacy; 26 27 use core_privacy\local\request\user_preference_provider; 28 use core_privacy\local\metadata\collection; 29 use \core_privacy\local\request\writer; 30 31 defined('MOODLE_INTERNAL') || die(); 32 33 /** 34 * Privacy Subsystem for block_myoverview. 35 * 36 * @copyright 2018 Zig Tan <zig@moodle.com> 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 */ 39 class provider implements \core_privacy\local\metadata\provider, user_preference_provider { 40 41 /** 42 * Returns meta-data information about the myoverview block. 43 * 44 * @param \core_privacy\local\metadata\collection $collection A collection of meta-data. 45 * @return \core_privacy\local\metadata\collection Return the collection of meta-data. 46 */ 47 public static function get_metadata(collection $collection) : collection { 48 $collection->add_user_preference('block_myoverview_user_sort_preference', 'privacy:metadata:overviewsortpreference'); 49 $collection->add_user_preference('block_myoverview_user_view_preference', 'privacy:metadata:overviewviewpreference'); 50 $collection->add_user_preference('block_myoverview_user_grouping_preference', 51 'privacy:metadata:overviewgroupingpreference'); 52 $collection->add_user_preference('block_myoverview_user_paging_preference', 53 'privacy:metadata:overviewpagingpreference'); 54 return $collection; 55 } 56 /** 57 * Export all user preferences for the myoverview block 58 * 59 * @param int $userid The userid of the user whose data is to be exported. 60 */ 61 public static function export_user_preferences(int $userid) { 62 $preference = get_user_preferences('block_myoverview_user_sort_preference', null, $userid); 63 if (isset($preference)) { 64 writer::export_user_preference('block_myoverview', 65 'block_myoverview_user_sort_preference', get_string($preference, 'block_myoverview'), 66 get_string('privacy:metadata:overviewsortpreference', 'block_myoverview')); 67 } 68 69 $preference = get_user_preferences('block_myoverview_user_view_preference', null, $userid); 70 if (isset($preference)) { 71 writer::export_user_preference('block_myoverview', 72 'block_myoverview_user_view_preference', 73 get_string($preference, 'block_myoverview'), 74 get_string('privacy:metadata:overviewviewpreference', 'block_myoverview')); 75 } 76 77 $preference = get_user_preferences('block_myoverview_user_grouping_preference', null, $userid); 78 if (isset($preference)) { 79 writer::export_user_preference('block_myoverview', 80 'block_myoverview_user_grouping_preference', 81 get_string($preference, 'block_myoverview'), 82 get_string('privacy:metadata:overviewgroupingpreference', 'block_myoverview')); 83 } 84 85 $preferences = get_user_preferences(null, null, $userid); 86 foreach ($preferences as $name => $value) { 87 if ((substr($name, 0, 30) == 'block_myoverview_hidden_course')) { 88 writer::export_user_preference( 89 'block_myoverview', 90 $name, 91 $value, 92 get_string('privacy:request:preference:set', 'block_myoverview', (object) [ 93 'name' => $name, 94 'value' => $value, 95 ]) 96 ); 97 } 98 } 99 100 $preference = get_user_preferences('block_myoverview_user_paging_preference', null, $userid); 101 if (isset($preference)) { 102 \core_privacy\local\request\writer::export_user_preference('block_myoverview', 103 'block_myoverview_user_paging_preference', 104 $preference, 105 get_string('privacy:metadata:overviewpagingpreference', 'block_myoverview')); 106 } 107 } 108 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body