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.
/lib/db/ -> events.php (source)

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]

   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   * Definition of core event observers.
  19   *
  20   * The observers defined in this file are notified when respective events are triggered. All plugins
  21   * support this.
  22   *
  23   * For more information, take a look to the documentation available:
  24   *     - Events API: {@link https://docs.moodle.org/dev/Events_API}
  25   *     - Upgrade API: {@link https://moodledev.io/docs/guides/upgrade}
  26   *
  27   * @package   core
  28   * @category  event
  29   * @copyright 2007 onwards Martin Dougiamas  http://dougiamas.com
  30   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  31   */
  32  
  33  defined('MOODLE_INTERNAL') || die();
  34  
  35  // List of legacy event handlers.
  36  
  37  $handlers = array(
  38      // No more old events!
  39  );
  40  
  41  // List of events_2 observers.
  42  
  43  $observers = array(
  44  
  45      array(
  46          'eventname'   => '\core\event\course_module_completion_updated',
  47          'callback'    => 'core_badges_observer::course_module_criteria_review',
  48      ),
  49      array(
  50          'eventname'   => '\core\event\badge_awarded',
  51          'callback'    => 'core_badges_observer::badge_criteria_review',
  52      ),
  53      array(
  54          'eventname'   => '\core\event\course_completed',
  55          'callback'    => 'core_badges_observer::course_criteria_review',
  56      ),
  57      array(
  58          'eventname'   => '\core\event\user_updated',
  59          'callback'    => 'core_badges_observer::profile_criteria_review',
  60      ),
  61      array(
  62          'eventname'   => '\core\event\cohort_member_added',
  63          'callback'    => 'core_badges_observer::cohort_criteria_review',
  64      ),
  65      array(
  66          'eventname'   => '\core\event\competency_evidence_created',
  67          'callback'    => 'core_badges_observer::competency_criteria_review',
  68      ),
  69      // Competencies.
  70      array(
  71          'eventname'   => '\core\event\course_completed',
  72          'callback'    => 'core_competency\api::observe_course_completed',
  73      ),
  74      array(
  75          'eventname'   => '\core\event\course_module_completion_updated',
  76          'callback'    => 'core_competency\api::observe_course_module_completion_updated',
  77      ),
  78  );
  79  
  80  // List of all events triggered by Moodle can be found using Events list report.