[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/admin/tool/mobile/classes/ -> external.php (source)

   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   * This is the external API for this tool.
  19   *
  20   * @package    tool_mobile
  21   * @copyright  2016 Juan Leyva
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  namespace tool_mobile;
  26  
  27  require_once("$CFG->libdir/externallib.php");
  28  
  29  use external_api;
  30  use external_function_parameters;
  31  use external_value;
  32  use external_single_structure;
  33  use external_multiple_structure;
  34  use external_warnings;
  35  
  36  /**
  37   * This is the external API for this tool.
  38   *
  39   * @copyright  2016 Juan Leyva
  40   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  41   */
  42  class external extends external_api {
  43  
  44      /**
  45       * Returns description of get_plugins_supporting_mobile() parameters.
  46       *
  47       * @return external_function_parameters
  48       * @since  Moodle 3.1
  49       */
  50      public static function get_plugins_supporting_mobile_parameters() {
  51          return new external_function_parameters(array());
  52      }
  53  
  54      /**
  55       * Returns a list of Moodle plugins supporting the mobile app.
  56       *
  57       * @return array an array of warnings and objects containing the plugin information
  58       * @since  Moodle 3.1
  59       */
  60      public static function get_plugins_supporting_mobile() {
  61          return array(
  62              'plugins' => api::get_plugins_supporting_mobile(),
  63              'warnings' => array(),
  64          );
  65      }
  66  
  67      /**
  68       * Returns description of get_plugins_supporting_mobile() result value.
  69       *
  70       * @return external_description
  71       * @since  Moodle 3.1
  72       */
  73      public static function get_plugins_supporting_mobile_returns() {
  74          return new external_single_structure(
  75              array(
  76                  'plugins' => new external_multiple_structure(
  77                      new external_single_structure(
  78                          array(
  79                              'component' => new external_value(PARAM_COMPONENT, 'The plugin component name.'),
  80                              'version' => new external_value(PARAM_NOTAGS, 'The plugin version number.'),
  81                              'addon' => new external_value(PARAM_COMPONENT, 'The Mobile addon (package) name.'),
  82                              'dependencies' => new external_multiple_structure(
  83                                                  new external_value(PARAM_COMPONENT, 'Mobile addon name.'),
  84                                                  'The list of Mobile addons this addon depends on.'
  85                                                 ),
  86                              'fileurl' => new external_value(PARAM_URL, 'The addon package url for download
  87                                                              or empty if it doesn\'t exist.'),
  88                              'filehash' => new external_value(PARAM_RAW, 'The addon package hash or empty if it doesn\'t exist.'),
  89                              'filesize' => new external_value(PARAM_INT, 'The addon package size or empty if it doesn\'t exist.')
  90                          )
  91                      )
  92                  ),
  93                  'warnings' => new external_warnings(),
  94              )
  95          );
  96      }
  97  
  98      /**
  99       * Returns description of get_site_public_settings() parameters.
 100       *
 101       * @return external_function_parameters
 102       * @since  Moodle 3.2
 103       */
 104      public static function get_site_public_settings_parameters() {
 105          return new external_function_parameters(array());
 106      }
 107  
 108      /**
 109       * Returns a list of the site public settings, those not requiring authentication.
 110       *
 111       * @return array with the settings and warnings
 112       * @since  Moodle 3.2
 113       */
 114      public static function get_site_public_settings() {
 115          $result = api::get_site_public_settings();
 116          $result['warnings'] = array();
 117          return $result;
 118      }
 119  
 120      /**
 121       * Returns description of get_site_public_settings() result value.
 122       *
 123       * @return external_description
 124       * @since  Moodle 3.2
 125       */
 126      public static function get_site_public_settings_returns() {
 127          return new external_single_structure(
 128              array(
 129                  'wwwroot' => new external_value(PARAM_RAW, 'Site URL.'),
 130                  'httpswwwroot' => new external_value(PARAM_RAW, 'Site https URL (if httpslogin is enabled).'),
 131                  'sitename' => new external_value(PARAM_TEXT, 'Site name.'),
 132                  'guestlogin' => new external_value(PARAM_INT, 'Whether guest login is enabled.'),
 133                  'rememberusername' => new external_value(PARAM_INT, 'Values: 0 for No, 1 for Yes, 2 for optional.'),
 134                  'authloginviaemail' => new external_value(PARAM_INT, 'Whether log in via email is enabled.'),
 135                  'registerauth' => new external_value(PARAM_PLUGIN, 'Authentication method for user registration.'),
 136                  'forgottenpasswordurl' => new external_value(PARAM_URL, 'Forgotten password URL.'),
 137                  'authinstructions' => new external_value(PARAM_RAW, 'Authentication instructions.'),
 138                  'authnoneenabled' => new external_value(PARAM_INT, 'Whether auth none is enabled.'),
 139                  'enablewebservices' => new external_value(PARAM_INT, 'Whether Web Services are enabled.'),
 140                  'enablemobilewebservice' => new external_value(PARAM_INT, 'Whether the Mobile service is enabled.'),
 141                  'maintenanceenabled' => new external_value(PARAM_INT, 'Whether site maintenance is enabled.'),
 142                  'maintenancemessage' => new external_value(PARAM_RAW, 'Maintenance message.'),
 143                  'warnings' => new external_warnings(),
 144              )
 145          );
 146      }
 147  
 148  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1