Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 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   * Adds messaging related settings links for Messaging category to admin tree.
  19   *
  20   * @copyright 2019 Amaia Anabitarte <amaia@moodle.com>
  21   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22   */
  23  
  24  defined('MOODLE_INTERNAL') || die();
  25  
  26  if ($hassiteconfig) {
  27      $temp = new admin_settingpage('messages', new lang_string('messagingssettings', 'admin'));
  28      $temp->add(new admin_setting_configcheckbox('messaging',
  29          new lang_string('messaging', 'admin'),
  30          new lang_string('configmessaging', 'admin'),
  31          1));
  32      $temp->add(new admin_setting_configcheckbox('messagingallusers',
  33              new lang_string('messagingallusers', 'admin'),
  34              new lang_string('configmessagingallusers', 'admin'),
  35               0)
  36      );
  37      $temp->add(new admin_setting_configcheckbox('messagingdefaultpressenter',
  38              new lang_string('messagingdefaultpressenter', 'admin'),
  39              new lang_string('configmessagingdefaultpressenter', 'admin'),
  40              1)
  41      );
  42      $options = array(
  43          DAYSECS => new lang_string('secondstotime86400'),
  44          WEEKSECS => new lang_string('secondstotime604800'),
  45          2620800 => new lang_string('nummonths', 'moodle', 1),
  46          7862400 => new lang_string('nummonths', 'moodle', 3),
  47          15724800 => new lang_string('nummonths', 'moodle', 6),
  48          0 => new lang_string('never')
  49      );
  50      $temp->add(new admin_setting_configselect(
  51              'messagingdeletereadnotificationsdelay',
  52              new lang_string('messagingdeletereadnotificationsdelay', 'admin'),
  53              new lang_string('configmessagingdeletereadnotificationsdelay', 'admin'),
  54              604800,
  55              $options)
  56      );
  57      $temp->add(new admin_setting_configselect(
  58              'messagingdeleteallnotificationsdelay',
  59              new lang_string('messagingdeleteallnotificationsdelay', 'admin'),
  60              new lang_string('configmessagingdeleteallnotificationsdelay', 'admin'),
  61              2620800,
  62              $options)
  63      );
  64      $temp->add(new admin_setting_configcheckbox('messagingallowemailoverride',
  65          new lang_string('messagingallowemailoverride', 'admin'),
  66          new lang_string('configmessagingallowemailoverride', 'admin'),
  67          0));
  68      $ADMIN->add('messaging', $temp);
  69      $ADMIN->add('messaging', new admin_page_managemessageoutputs());
  70  
  71      // Notification outputs plugins.
  72      $plugins = core_plugin_manager::instance()->get_plugins_of_type('message');
  73      core_collator::asort_objects_by_property($plugins, 'displayname');
  74      foreach ($plugins as $plugin) {
  75          /** @var \core\plugininfo\message $plugin */
  76          $plugin->load_settings($ADMIN, 'messaging', $hassiteconfig);
  77      }
  78  }