Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   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 polyfill to allow a plugin to operate with Moodle 3.3 up.
  19   *
  20   * @package mod_assign
  21   * @copyright 2018 Adrian Greeve <adrian@moodle.com>
  22   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  namespace mod_assign\privacy;
  25  
  26  use core_privacy\local\request\contextlist;
  27  
  28  defined('MOODLE_INTERNAL') || die();
  29  
  30  /**
  31   * The trait used to provide backwards compatability for third-party plugins.
  32   *
  33   * @copyright 2018 Adrian Greeve <adrian@moodle.com>
  34   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  35   */
  36  trait feedback_legacy_polyfill {
  37  
  38      /**
  39       * Retrieves the contextids associated with the provided userid for this subplugin.
  40       * NOTE if your subplugin must have an entry in the assign_grade table to work, then this
  41       * method can be empty.
  42       *
  43       * @param  int $userid The user ID to get context IDs for.
  44       * @param  \core_privacy\local\request\contextlist $contextlist Use add_from_sql with this object to add your context IDs.
  45       */
  46      public static function get_context_for_userid_within_feedback(int $userid, contextlist $contextlist) {
  47          return static::_get_context_for_userid_within_feedback($userid, $contextlist);
  48      }
  49  
  50      /**
  51       * Returns student user ids related to the provided teacher ID. If an entry must be present in the assign_grade table for
  52       * your plugin to work then there is no need to fill in this method. If you filled in get_context_for_userid_within_feedback()
  53       * then you probably have to fill this in as well.
  54       *
  55       * @param  useridlist $useridlist A list of user IDs of students graded by this user.
  56       */
  57      public static function get_student_user_ids(useridlist $useridlist) {
  58          return static::_get_student_user_ids($useridlist);
  59      }
  60  
  61      /**
  62       * Export feedback data with the available grade and userid information provided.
  63       * assign_plugin_request_data contains:
  64       * - context
  65       * - grade object
  66       * - current path (subcontext)
  67       * - user object
  68       *
  69       * @param  assign_plugin_request_data $exportdata Contains data to help export the user information.
  70       */
  71      public static function export_feedback_user_data(assign_plugin_request_data $exportdata) {
  72          return static::_export_feedback_user_data($exportdata);
  73      }
  74  
  75      /**
  76       * Any call to this method should delete all user data for the context defined in the deletion_criteria.
  77       * assign_plugin_request_data contains:
  78       * - context
  79       * - assign object
  80       *
  81       * @param  assign_plugin_request_data $requestdata Data useful for deleting user data from this sub-plugin.
  82       */
  83      public static function delete_feedback_for_context(assign_plugin_request_data $requestdata) {
  84          return static::_delete_feedback_for_context($requestdata);
  85      }
  86  
  87      /**
  88       * Calling this function should delete all user data associated with this grade.
  89       * assign_plugin_request_data contains:
  90       * - context
  91       * - grade object
  92       * - user object
  93       * - assign object
  94       *
  95       * @param  assign_plugin_request_data $requestdata Data useful for deleting user data.
  96       */
  97      public static function delete_feedback_for_grade(assign_plugin_request_data $requestdata) {
  98          return static::_delete_feedback_for_grade($requestdata);
  99      }
 100  }