Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.
   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_recent_activity.
  19   *
  20   * @package    block_recent_activity
  21   * @category   privacy
  22   * @copyright  2018 Shamim Rezaie <shamim@moodle.com>
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  namespace block_recent_activity\privacy;
  27  
  28  use core_privacy\local\metadata\collection;
  29  use core_privacy\local\request\approved_contextlist;
  30  use core_privacy\local\request\contextlist;
  31  use core_privacy\local\request\userlist;
  32  use core_privacy\local\request\approved_userlist;
  33  
  34  defined('MOODLE_INTERNAL') || die();
  35  
  36  /**
  37   * The block_recent_activity does not keep any data for more than COURSE_MAX_RECENT_PERIOD.
  38   *
  39   * @copyright  2018 Shamim Rezaie <shamim@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\core_userlist_provider,
  45          \core_privacy\local\request\plugin\provider {
  46  
  47      /**
  48       * Returns metadata.
  49       *
  50       * @param collection $collection The initialised collection to add items to.
  51       * @return collection A listing of user data stored through this system.
  52       */
  53      public static function get_metadata(collection $collection) : collection {
  54  
  55          // This plugin defines a db table but it is not considered personal data and, therefore, not exported or deleted.
  56          $collection->add_database_table('block_recent_activity', [
  57              'courseid' => 'privacy:metadata:block_recent_activity:courseid',
  58              'cmid' => 'privacy:metadata:block_recent_activity:cmid',
  59              'timecreated' => 'privacy:metadata:block_recent_activity:timecreated',
  60              'userid' => 'privacy:metadata:block_recent_activity:userid',
  61              'action' => 'privacy:metadata:block_recent_activity:action',
  62              'modname' => 'privacy:metadata:block_recent_activity:modname'
  63          ], 'privacy:metadata:block_recent_activity');
  64  
  65          return $collection;
  66      }
  67  
  68      /**
  69       * Get the list of contexts that contain user information for the specified user.
  70       *
  71       * @param   int $userid The user to search.
  72       * @return  contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
  73       */
  74      public static function get_contexts_for_userid(int $userid) : contextlist {
  75          return new contextlist();
  76      }
  77  
  78      /**
  79       * Get the list of users who have data within a context.
  80       *
  81       * @param userlist $userlist The userlist containing the list of users who have data in this context/plugin combination.
  82       */
  83      public static function get_users_in_context(userlist $userlist) {
  84      }
  85  
  86      /**
  87       * Export all user data for the specified user, in the specified contexts.
  88       *
  89       * @param approved_contextlist $contextlist The approved contexts to export information for.
  90       */
  91      public static function export_user_data(approved_contextlist $contextlist) {
  92      }
  93  
  94      /**
  95       * Delete all data for all users in the specified context.
  96       *
  97       * @param \context $context The specific context to delete data for.
  98       */
  99      public static function delete_data_for_all_users_in_context(\context $context) {
 100      }
 101  
 102      /**
 103       * Delete multiple users within a single context.
 104       *
 105       * @param approved_userlist $userlist The approved context and user information to delete information for.
 106       */
 107      public static function delete_data_for_users(approved_userlist $userlist) {
 108      }
 109  
 110      /**
 111       * Delete all user data for the specified user, in the specified contexts.
 112       *
 113       * @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
 114       */
 115      public static function delete_data_for_user(approved_contextlist $contextlist) {
 116      }
 117  }