Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are 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   * This file contains the assignsubmission_provider interface.
  19   *
  20   * Assignment Sub plugins should implement this if they store personal information.
  21   *
  22   * @package mod_assign
  23   * @copyright 2018 Adrian Greeve <adrian@moodle.com>
  24   *
  25   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  26   */
  27  namespace mod_assign\privacy;
  28  
  29  use core_privacy\local\request\contextlist;
  30  
  31  defined('MOODLE_INTERNAL') || die();
  32  
  33  interface assignsubmission_provider extends \core_privacy\local\request\plugin\subplugin_provider {
  34  
  35      /**
  36       * Retrieves the contextids associated with the provided userid for this subplugin.
  37       * NOTE if your subplugin must have an entry in the assign_submission table to work, then this
  38       * method can be empty.
  39       *
  40       * @param int $userid The user ID to get context IDs for.
  41       * @param \core_privacy\local\request\contextlist $contextlist Use add_from_sql with this object to add your context IDs.
  42       */
  43      public static function get_context_for_userid_within_submission(int $userid, contextlist $contextlist);
  44  
  45      /**
  46       * Returns student user ids related to the provided teacher ID. If it is possible that a student ID will not be returned by
  47       * the sql query in \mod_assign\privacy\provider::find_grader_info() Then you need to provide some sql to retrive those
  48       * student IDs. This is highly likely if you had to fill in get_context_for_userid_within_submission above.
  49       *
  50       * @param  useridlist $useridlist A user ID list object that you can append your user IDs to.
  51       */
  52      public static function get_student_user_ids(useridlist $useridlist);
  53  
  54      /**
  55       * This method is used to export any user data this sub-plugin has using the assign_plugin_request_data object to get the
  56       * context and userid.
  57       * assign_plugin_request_data contains:
  58       * - context
  59       * - submission object
  60       * - current path (subcontext)
  61       * - user object
  62       *
  63       * @param  assign_plugin_request_data $exportdata Information to use to export user data for this sub-plugin.
  64       */
  65      public static function export_submission_user_data(assign_plugin_request_data $exportdata);
  66  
  67      /**
  68       * Any call to this method should delete all user data for the context defined in the deletion_criteria.
  69       * assign_plugin_request_data contains:
  70       * - context
  71       * - assign object
  72       *
  73       * @param assign_plugin_request_data $requestdata Information to use to delete user data for this submission.
  74       */
  75      public static function delete_submission_for_context(assign_plugin_request_data $requestdata);
  76  
  77      /**
  78       * A call to this method should delete user data (where practicle) from the userid and context.
  79       * assign_plugin_request_data contains:
  80       * - context
  81       * - submission object
  82       * - user object
  83       * - assign object
  84       *
  85       * @param  assign_plugin_request_data $exportdata Details about the user and context to focus the deletion.
  86       */
  87      public static function delete_submission_for_userid(assign_plugin_request_data $exportdata);
  88  }