Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 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 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 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   * Atto text editor integration version file.
  19   *
  20   * @package    atto_media
  21   * @copyright  2013 Damyon Wiese  <damyon@moodle.com>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  /**
  26   * Initialise the js strings required for this plugin
  27   */
  28  function atto_media_strings_for_js() {
  29      global $PAGE;
  30  
  31      $PAGE->requires->strings_for_js(array('add',
  32                                            'addcaptionstrack',
  33                                            'addchapterstrack',
  34                                            'adddescriptionstrack',
  35                                            'addmetadatatrack',
  36                                            'addsource',
  37                                            'addsubtitlestrack',
  38                                            'addtrack',
  39                                            'advancedsettings',
  40                                            'audio',
  41                                            'audiosourcelabel',
  42                                            'autoplay',
  43                                            'browserepositories',
  44                                            'browserepositories',
  45                                            'captions',
  46                                            'captionssourcelabel',
  47                                            'chapters',
  48                                            'chapterssourcelabel',
  49                                            'controls',
  50                                            'createmedia',
  51                                            'default',
  52                                            'descriptions',
  53                                            'descriptionssourcelabel',
  54                                            'displayoptions',
  55                                            'entername',
  56                                            'entertitle',
  57                                            'entersource',
  58                                            'enterurl',
  59                                            'height',
  60                                            'kind',
  61                                            'label',
  62                                            'languagesavailable',
  63                                            'languagesinstalled',
  64                                            'link',
  65                                            'loop',
  66                                            'metadata',
  67                                            'metadatasourcelabel',
  68                                            'mute',
  69                                            'poster',
  70                                            'remove',
  71                                            'size',
  72                                            'srclang',
  73                                            'subtitles',
  74                                            'subtitlessourcelabel',
  75                                            'track',
  76                                            'tracks',
  77                                            'video',
  78                                            'videoheight',
  79                                            'videosourcelabel',
  80                                            'videowidth',
  81                                            'width'),
  82                                            'atto_media');
  83  }
  84  
  85  /**
  86   * Sends the parameters to the JS module.
  87   *
  88   * @return array
  89   */
  90  function atto_media_params_for_js() {
  91      global $OUTPUT;
  92      global $PAGE;
  93      $currentlang = current_language();
  94      $langsinstalled = get_string_manager()->get_list_of_translations(true);
  95      $langsavailable = get_string_manager()->get_list_of_languages();
  96      $params = [
  97          'langs' => ['installed' => [], 'available' => []],
  98          'help' => []
  99      ];
 100  
 101      foreach ($langsinstalled as $code => $name) {
 102          $params['langs']['installed'][] = [
 103              'lang' => $name,
 104              'code' => $code,
 105              'default' => $currentlang == $code
 106          ];
 107      }
 108  
 109      foreach ($langsavailable as $code => $name) {
 110          // See MDL-50829 for an explanation of this lrm thing.
 111          $lrm = json_decode('"\u200E"');
 112          $params['langs']['available'][] = [
 113              'lang' => $name . ' ' . $lrm . '(' . $code . ')' . $lrm, 'code' => $code];
 114      }
 115  
 116      $params['help'] = [
 117          'addsource' => $OUTPUT->help_icon('addsource', 'atto_media'),
 118          'tracks' => $OUTPUT->help_icon('tracks', 'atto_media'),
 119          'subtitles' => $OUTPUT->help_icon('subtitles', 'atto_media'),
 120          'captions' => $OUTPUT->help_icon('captions', 'atto_media'),
 121          'descriptions' => $OUTPUT->help_icon('descriptions', 'atto_media'),
 122          'chapters' => $OUTPUT->help_icon('chapters', 'atto_media'),
 123          'metadata' => $OUTPUT->help_icon('metadata', 'atto_media')
 124      ];
 125  
 126      return $params;
 127  }