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 310 and 402] [Versions 311 and 402] [Versions 39 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   * Settings that allow turning on and off recordrtc features
  19   *
  20   * @package    atto_recordrtc
  21   * @author     Jesus Federico (jesus [at] blindsidenetworks [dt] com)
  22   * @author     Jacob Prud'homme (jacob [dt] prudhomme [at] blindsidenetworks [dt] com)
  23   * @copyright  2017 Blindside Networks Inc.
  24   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25   */
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  // Needed for constants.
  30  require_once($CFG->dirroot . '/lib/editor/atto/plugins/recordrtc/lib.php');
  31  
  32  $ADMIN->add('editoratto', new admin_category('atto_recordrtc', new lang_string('pluginname', 'atto_recordrtc')));
  33  
  34  if ($ADMIN->fulltree) {
  35      // Types allowed.
  36      $options = array(
  37          'both' => new lang_string('audioandvideo', 'atto_recordrtc'),
  38          'audio' => new lang_string('onlyaudio', 'atto_recordrtc'),
  39          'video' => new lang_string('onlyvideo', 'atto_recordrtc')
  40      );
  41      $name = get_string('allowedtypes', 'atto_recordrtc');
  42      $desc = get_string('allowedtypes_desc', 'atto_recordrtc');
  43      $default = 'both';
  44      $setting = new admin_setting_configselect('atto_recordrtc/allowedtypes', $name, $desc, $default, $options);
  45      $settings->add($setting);
  46  
  47      // Audio bitrate.
  48      $name = get_string('audiobitrate', 'atto_recordrtc');
  49      $desc = get_string('audiobitrate_desc', 'atto_recordrtc');
  50      $default = '128000';
  51      $setting = new admin_setting_configtext('atto_recordrtc/audiobitrate', $name, $desc, $default, PARAM_INT, 8);
  52      $settings->add($setting);
  53  
  54      // Video bitrate.
  55      $name = get_string('videobitrate', 'atto_recordrtc');
  56      $desc = get_string('videobitrate_desc', 'atto_recordrtc');
  57      $default = '2500000';
  58      $setting = new admin_setting_configtext('atto_recordrtc/videobitrate', $name, $desc, $default, PARAM_INT, 8);
  59      $settings->add($setting);
  60  
  61      // Audio recording time limit.
  62      $name = get_string('audiotimelimit', 'atto_recordrtc');
  63      $desc = get_string('audiotimelimit_desc', 'atto_recordrtc');
  64      // Validate audiotimelimit greater than 0.
  65      $setting = new admin_setting_configduration('atto_recordrtc/audiotimelimit', $name, $desc, DEFAULT_TIME_LIMIT);
  66      $setting->set_validate_function(function(int $value): string {
  67          if ($value <= 0) {
  68              return get_string('timelimitwarning', 'atto_recordrtc');
  69          }
  70          return '';
  71      });
  72      $settings->add($setting);
  73  
  74      // Video recording time limit.
  75      $name = get_string('videotimelimit', 'atto_recordrtc');
  76      $desc = get_string('videotimelimit_desc', 'atto_recordrtc');
  77      // Validate videotimelimit greater than 0.
  78      $setting = new admin_setting_configduration('atto_recordrtc/videotimelimit', $name, $desc, DEFAULT_TIME_LIMIT);
  79      $setting->set_validate_function(function(int $value): string {
  80          if ($value <= 0) {
  81              return get_string('timelimitwarning', 'atto_recordrtc');
  82          }
  83          return '';
  84      });
  85      $settings->add($setting);
  86  }