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 gradereport_user. 19 * 20 * @package gradereport_user 21 * @copyright 2018 Sara Arjona <sara@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace gradereport_user\privacy; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 use \core_privacy\local\metadata\collection; 30 use \core_privacy\local\request\transform; 31 use \core_privacy\local\request\writer; 32 33 require_once $CFG->libdir.'/grade/constants.php'; 34 35 36 /** 37 * Privacy Subsystem for gradereport_user implementing null_provider. 38 * 39 * @copyright 2018 Sara Arjona <sara@moodle.com> 40 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 41 */ 42 class provider implements 43 \core_privacy\local\metadata\provider, 44 \core_privacy\local\request\user_preference_provider { 45 46 /** 47 * Returns meta data about this system. 48 * 49 * @param collection $itemcollection The initialised item collection to add items to. 50 * @return collection A listing of user data stored through this system. 51 */ 52 public static function get_metadata(collection $items) : collection { 53 // User preferences (shared between different courses). 54 $items->add_user_preference('gradereport_user_view_user', 'privacy:metadata:preference:gradereport_user_view_user'); 55 56 return $items; 57 } 58 59 /** 60 * Store all user preferences for the plugin. 61 * 62 * @param int $userid The userid of the user whose data is to be exported. 63 */ 64 public static function export_user_preferences(int $userid) { 65 $prefvalue = get_user_preferences('gradereport_user_view_user', null, $userid); 66 if ($prefvalue !== null) { 67 $transformedvalue = transform::yesno($prefvalue); 68 writer::export_user_preference( 69 'gradereport_user', 70 'gradereport_user_view_user', 71 $transformedvalue, 72 get_string('privacy:metadata:preference:gradereport_user_view_user', 'gradereport_user') 73 ); 74 } 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body