| 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 | /**
 | 
        
           |  |  | 18 |  * This file contains the polyfil to allow a plugin to operate with Moodle 3.3 up.
 | 
        
           |  |  | 19 |  *
 | 
        
           |  |  | 20 |  * @package    mod_quiz
 | 
        
           |  |  | 21 |  * @copyright  2018 Andrew Nicols <andrew@nicols.co.uk>
 | 
        
           |  |  | 22 |  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 | 
        
           |  |  | 23 |  */
 | 
        
           |  |  | 24 | namespace mod_quiz\privacy;
 | 
        
           |  |  | 25 |   | 
        
           |  |  | 26 | use core_privacy\local\request\approved_userlist;
 | 
        
           |  |  | 27 |   | 
        
           |  |  | 28 | defined('MOODLE_INTERNAL') || die();
 | 
        
           |  |  | 29 |   | 
        
           |  |  | 30 | /**
 | 
        
           |  |  | 31 |  * The trait used to provide a backwards compatibility for third-party plugins.
 | 
        
           |  |  | 32 |  *
 | 
        
           |  |  | 33 |  * @package    mod_quiz
 | 
        
           |  |  | 34 |  * @copyright  2018 Andrew Nicols <andrew@nicols.co.uk>
 | 
        
           |  |  | 35 |  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 | 
        
           |  |  | 36 |  */
 | 
        
           |  |  | 37 | trait legacy_quizaccess_polyfill {
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 |     /**
 | 
        
           |  |  | 40 |      * Export all user data for the specified user, for the specified quiz.
 | 
        
           |  |  | 41 |      *
 | 
        
           |  |  | 42 |      * @param   \mod_quiz\quiz_settings           $quiz The quiz being exported
 | 
        
           |  |  | 43 |      * @param   \stdClass       $user The user to export data for
 | 
        
           |  |  | 44 |      * @return  \stdClass       The data to be exported for this access rule.
 | 
        
           |  |  | 45 |      */
 | 
        
           |  |  | 46 |     public static function export_quizaccess_user_data(\mod_quiz\quiz_settings $quiz, \stdClass $user): \stdClass {
 | 
        
           |  |  | 47 |         return static::_export_quizaccess_user_data($quiz, $user);
 | 
        
           |  |  | 48 |     }
 | 
        
           |  |  | 49 |   | 
        
           |  |  | 50 |     /**
 | 
        
           |  |  | 51 |      * Delete all data for all users in the specified quiz.
 | 
        
           |  |  | 52 |      *
 | 
        
           |  |  | 53 |      * @param   \mod_quiz\quiz_settings           $quiz The quiz being deleted
 | 
        
           |  |  | 54 |      */
 | 
        
           |  |  | 55 |     public static function delete_quizaccess_data_for_all_users_in_context(\mod_quiz\quiz_settings $quiz) {
 | 
        
           |  |  | 56 |         static::_delete_quizaccess_data_for_all_users_in_context($quiz);
 | 
        
           |  |  | 57 |     }
 | 
        
           |  |  | 58 |   | 
        
           |  |  | 59 |     /**
 | 
        
           |  |  | 60 |      * Delete all user data for the specified user, in the specified quiz.
 | 
        
           |  |  | 61 |      *
 | 
        
           |  |  | 62 |      * @param   \mod_quiz\quiz_settings           $quiz The quiz being deleted
 | 
        
           |  |  | 63 |      * @param   \stdClass       $user The user to export data for
 | 
        
           |  |  | 64 |      */
 | 
        
           |  |  | 65 |     public static function delete_quizaccess_data_for_user(\mod_quiz\quiz_settings $quiz, \stdClass $user) {
 | 
        
           |  |  | 66 |         static::_delete_quizaccess_data_for_user($quiz, $user);
 | 
        
           |  |  | 67 |     }
 | 
        
           |  |  | 68 |   | 
        
           |  |  | 69 |     /**
 | 
        
           |  |  | 70 |      * Delete all user data for the specified users, in the specified context.
 | 
        
           |  |  | 71 |      *
 | 
        
           |  |  | 72 |      * @param   approved_userlist $userlist   The approved context and user information to delete information for.
 | 
        
           |  |  | 73 |      */
 | 
        
           |  |  | 74 |     public static function delete_quizaccess_data_for_users(approved_userlist $userlist) {
 | 
        
           |  |  | 75 |         static::_delete_quizaccess_data_for_users($userlist);
 | 
        
           |  |  | 76 |     }
 | 
        
           |  |  | 77 | }
 |