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   * Provides {@link mod_workshop\privacy\workshopform_legacy_polyfill} trait.
  19   *
  20   * @package     mod_workshop
  21   * @category    privacy
  22   * @copyright   2018 David Mudrák <david@moodle.com>
  23   * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  namespace mod_workshop\privacy;
  27  
  28  defined('MOODLE_INTERNAL') || die();
  29  
  30  /**
  31   * Trait allowing additional (contrib) plugins to have single codebase for 3.3 and 3.4.
  32   *
  33   * The signature of the method in the {@link \mod_workshop\privacy\workshopform_provider} interface makes use of scalar
  34   * type hinting that is available in PHP 7.0 only.  If a plugin wants to implement the interface in 3.3 (and therefore
  35   * PHP 5.6) with the same codebase, they can make use of this trait. Instead of implementing the interface directly, the
  36   * workshopform plugin can implement the required logic in the method (note the underscore and missing "int" hint):
  37   *
  38   *     public static function _export_assessment_form(\stdClass $user, \context $context, array $subcontext, $assessmentid)
  39   *
  40   * and then simply use this trait in their provider class.
  41   *
  42   * @copyright 2018 David Mudrák <david@moodle.com>
  43   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  44   */
  45  trait workshopform_legacy_polyfill {
  46  
  47      /**
  48       * Return details of the filled assessment form.
  49       *
  50       * @param stdClass $user User we are exporting data for
  51       * @param context $context The workshop activity context
  52       * @param array $subcontext Subcontext within the context to export to
  53       * @param int $assessmentid ID of the assessment
  54       */
  55      public static function export_assessment_form(\stdClass $user, \context $context, array $subcontext, int $assessmentid) {
  56          return static::_export_assessment_form($user, $context, $subcontext, $assessmentid);
  57      }
  58  }