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.

Differences Between: [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  namespace mod_bigbluebuttonbn\task;
  18  
  19  use html_writer;
  20  
  21  /**
  22   * Class containing the adhoc task to send a recording ready notification.
  23   *
  24   * @package   mod_bigbluebuttonbn
  25   * @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
  26   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  27   */
  28  class send_recording_ready_notification extends base_send_notification {
  29      /**
  30       * Get the notification type.
  31       *
  32       * @return string
  33       */
  34      protected function get_notification_type(): string {
  35          return 'recording_ready';
  36      }
  37  
  38      /**
  39       * Get the subject of the notification.
  40       *
  41       * @return string
  42       */
  43      protected function get_subject(): string {
  44          $instance = $this->get_instance();
  45  
  46          return get_string('notification_recording_ready_subject', 'mod_bigbluebuttonbn', $this->get_string_vars());
  47      }
  48  
  49      /**
  50       * Get the short summary message.
  51       *
  52       * @return string
  53       */
  54      protected function get_small_message(): string {
  55          return get_string('notification_recording_ready_small', 'mod_bigbluebuttonbn', $this->get_string_vars());
  56      }
  57  
  58      /**
  59       * Get the HTML message content.
  60       *
  61       * @return string
  62       */
  63      protected function get_html_message(): string {
  64          return html_writer::tag(
  65              'p',
  66              get_string('notification_recording_ready_html', 'mod_bigbluebuttonbn', $this->get_string_vars())
  67          );
  68      }
  69  
  70      /**
  71       * Get variables to make available to strings.
  72       *
  73       * @return array
  74       */
  75      protected function get_string_vars(): array {
  76          return [
  77              'course_fullname' => $this->instance->get_course()->fullname,
  78              'course_shortname' => $this->instance->get_course()->shortname,
  79              'name' => $this->instance->get_cm()->name,
  80              'link' => $this->instance->get_view_url()->out(),
  81          ];
  82      }
  83  }