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] [Versions 401 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\output;
  18  
  19  use mod_bigbluebuttonbn\instance;
  20  use mod_bigbluebuttonbn\local\helpers\roles;
  21  use moodle_url;
  22  use renderable;
  23  use renderer_base;
  24  use stdClass;
  25  use templatable;
  26  
  27  /**
  28   * Renderable for the instance notification updated message
  29   *
  30   * @package   mod_bigbluebuttonbn
  31   * @copyright 2010 onwards, Blindside Networks Inc
  32   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  33   * @author    Darko Miletic  (darko.miletic [at] gmail [dt] com)
  34   */
  35  class instance_updated_message implements renderable, templatable {
  36  
  37      /** @var int The activity was created */
  38      const TYPE_CREATED = 0;
  39  
  40      /** @var int The activity was updated */
  41      const TYPE_UPDATED = 1;
  42  
  43      /**
  44       * @var instance $instance
  45       */
  46      protected $instance;
  47  
  48      /** @var int activity type. */
  49      protected $type;
  50  
  51      /**
  52       * Instance updated constructor
  53       *
  54       * @param instance $instance
  55       * @param int $type
  56       */
  57      public function __construct(instance $instance, int $type) {
  58          $this->instance = $instance;
  59          $this->type = $type;
  60      }
  61  
  62      /**
  63       * Defer to template.
  64       *
  65       * @param renderer_base $output
  66       * @return stdClass
  67       */
  68      public function export_for_template(renderer_base $output): stdClass {
  69          return (object) [
  70              'is_update' => $this->type === self::TYPE_UPDATED,
  71              'is_create' => $this->type === self::TYPE_CREATED,
  72              'name' => $this->instance->get_meeting_name(),
  73              'link' => $this->instance->get_view_url()->out(),
  74              'description' => $this->instance->get_meeting_description(),
  75              'openingtime' => $this->instance->get_instance_var('openingtime'),
  76              'closingtime' => $this->instance->get_instance_var('closingtime'),
  77          ];
  78      }
  79  }