[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/lti/amd/src/ -> tool_proxy.js (source)

   1  // This file is part of Moodle - http://moodle.org/
   2  //
   3  // Moodle is free software: you can redistribute it and/or modify
   4  // it under the terms of the GNU General Public License as published by
   5  // the Free Software Foundation, either version 3 of the License, or
   6  // (at your option) any later version.
   7  //
   8  // Moodle is distributed in the hope that it will be useful,
   9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11  // GNU General Public License for more details.
  12  //
  13  // You should have received a copy of the GNU General Public License
  14  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  15  
  16  /**
  17   * Provides an interface for a tool proxy in the Moodle server.
  18   *
  19   * @module     mod_lti/tool_proxy
  20   * @class      tool_proxy
  21   * @package    mod_lti
  22   * @copyright  2015 Ryan Wyllie <ryan@moodle.com>
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   * @since      3.1
  25   */
  26  define(['core/ajax', 'core/notification'], function(ajax, notification) {
  27      return /** @alias module:mod_lti/tool_proxy */ {
  28          /**
  29           * Get a list of tool types from Moodle for the given
  30           * search args.
  31           *
  32           * See also:
  33           * mod/lti/classes/external.php get_tool_types_parameters()
  34           *
  35           * @method query
  36           * @public
  37           * @param {Object} args Search parameters
  38           * @return {Promise} jQuery Deferred object
  39           */
  40          query: function(args) {
  41              var request = {
  42                  methodname: 'mod_lti_get_tool_proxies',
  43                  args: args || {}
  44              };
  45  
  46              var promise = ajax.call([request])[0];
  47  
  48              promise.fail(notification.exception);
  49  
  50              return promise;
  51          },
  52          /**
  53           * Delete a tool proxy from Moodle.
  54           *
  55           * @method delete
  56           * @public
  57           * @param {Integer} id Tool proxy ID
  58           * @return {Promise} jQuery Deferred object
  59           */
  60          'delete': function(id) {
  61              var request = {
  62                  methodname: 'mod_lti_delete_tool_proxy',
  63                  args: {
  64                      id: id
  65                  }
  66              };
  67  
  68              var promise = ajax.call([request])[0];
  69  
  70              promise.fail(notification.exception);
  71  
  72              return promise;
  73          },
  74  
  75          /**
  76           * Create a tool proxy in Moodle.
  77           *
  78           * The promise will fail if the proxy cannot be created, so you must handle the fail result.
  79           *
  80           * See mod/lti/classes/external.php create_tool_proxy_parameters
  81           *
  82           * @method create
  83           * @public
  84           * @param {Object} args Tool proxy properties
  85           * @return {Promise} jQuery Deferred object
  86           */
  87          create: function(args) {
  88              var request = {
  89                  methodname: 'mod_lti_create_tool_proxy',
  90                  args: args
  91              };
  92  
  93              var promise = ajax.call([request])[0];
  94  
  95              return promise;
  96          }
  97      };
  98  });


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