Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 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.

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

   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   * Defines message providers (types of messages being sent)
  19   *
  20   * The providers defined on this file are processed and registered into
  21   * the Moodle DB after any install or upgrade operation. All plugins
  22   * support this.
  23   *
  24   * For more information, take a look to the documentation available:
  25   *     - Message API: {@link http://docs.moodle.org/dev/Message_API}
  26   *     - Upgrade API: {@link http://docs.moodle.org/dev/Upgrade_API}
  27   *
  28   * @package   core
  29   * @category  message
  30   * @copyright 2008 onwards Martin Dougiamas  http://dougiamas.com
  31   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  32   */
  33  
  34  defined('MOODLE_INTERNAL') || die();
  35  
  36  $messageproviders = array (
  37  
  38      // Notices that an admin might be interested in
  39      'notices' => array (
  40           'capability'  => 'moodle/site:config'
  41      ),
  42  
  43      // Important errors that an admin ought to know about
  44      'errors' => array (
  45           'capability'  => 'moodle/site:config'
  46      ),
  47  
  48      // cron-based notifications about available moodle and/or additional plugin updates
  49      'availableupdate' => array(
  50          'capability' => 'moodle/site:config',
  51          'defaults' => array(
  52              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF
  53          ),
  54  
  55      ),
  56  
  57      'instantmessage' => array (
  58          'defaults' => array(
  59              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
  60              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
  61          ),
  62      ),
  63  
  64      'backup' => array (
  65          'capability'  => 'moodle/site:config'
  66      ),
  67  
  68      // Course creation request notification
  69      'courserequested' => array (
  70          'capability'  => 'moodle/site:approvecourse'
  71      ),
  72  
  73      // Course request approval notification
  74      'courserequestapproved' => array (
  75           'capability'  => 'moodle/course:request',
  76           'defaults' => array(
  77              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
  78          ),
  79      ),
  80  
  81      // Course request rejection notification
  82      'courserequestrejected' => array (
  83          'capability'  => 'moodle/course:request',
  84          'defaults' => array(
  85              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
  86          ),
  87      ),
  88  
  89      // Badge award notification to a badge recipient.
  90      'badgerecipientnotice' => array (
  91          'defaults' => array(
  92              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
  93              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
  94              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
  95          ),
  96          'capability'  => 'moodle/badges:earnbadge'
  97      ),
  98  
  99      // Badge award notification to a badge creator (mostly cron-based).
 100      'badgecreatornotice' => array (
 101          'defaults' => array(
 102              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
 103          )
 104      ),
 105  
 106      // A comment was left on a plan.
 107      'competencyplancomment' => array(),
 108  
 109      // A comment was left on a user competency.
 110      'competencyusercompcomment' => array(),
 111  
 112      // User insights.
 113      'insights' => array (
 114          'defaults' => [
 115              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
 116              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
 117              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
 118          ]
 119      ),
 120  
 121      // Message contact requests.
 122      'messagecontactrequests' => [
 123          'defaults' => [
 124              // We don't need to notify in the popup output here because the message drawer
 125              // already notifies users of contact requests.
 126              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
 127              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
 128          ]
 129      ],
 130  
 131      // Asyncronhous backup/restore notifications.
 132      'asyncbackupnotification' => array(
 133          'defaults' => array(
 134              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
 135              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
 136          )
 137      ),
 138  
 139      'gradenotifications' => [
 140          'defaults' => array(
 141              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDIN + MESSAGE_DEFAULT_LOGGEDOFF,
 142              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_LOGGEDOFF,
 143          ),
 144      ],
 145  );