Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400]

   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * Forum external functions and service definitions.
  20   *
  21   * @package    mod_forum
  22   * @copyright  2012 Mark Nelson <markn@moodle.com>
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  $functions = array(
  27  
  28      'mod_forum_get_forums_by_courses' => array(
  29          'classname' => 'mod_forum_external',
  30          'methodname' => 'get_forums_by_courses',
  31          'classpath' => 'mod/forum/externallib.php',
  32          'description' => 'Returns a list of forum instances in a provided set of courses, if
  33              no courses are provided then all the forum instances the user has access to will be
  34              returned.',
  35          'type' => 'read',
  36          'capabilities' => 'mod/forum:viewdiscussion',
  37          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  38      ),
  39  
  40      'mod_forum_get_discussion_posts' => array(
  41          'classname' => 'mod_forum_external',
  42          'methodname' => 'get_discussion_posts',
  43          'classpath' => 'mod/forum/externallib.php',
  44          'description' => 'Returns a list of forum posts for a discussion.',
  45          'type' => 'read',
  46          'ajax' => true,
  47          'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
  48          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  49      ),
  50  
  51      'mod_forum_get_forum_discussions_paginated' => array(
  52          'classname' => 'mod_forum_external',
  53          'methodname' => 'get_forum_discussions_paginated',
  54          'classpath' => 'mod/forum/externallib.php',
  55          'description' => '** DEPRECATED ** Please do not call this function any more.
  56                            Returns a list of forum discussions optionally sorted and paginated.',
  57          'type' => 'read',
  58          'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
  59          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  60      ),
  61  
  62      'mod_forum_get_forum_discussions' => array(
  63          'classname' => 'mod_forum_external',
  64          'methodname' => 'get_forum_discussions',
  65          'classpath' => 'mod/forum/externallib.php',
  66          'description' => 'Returns a list of forum discussions optionally sorted and paginated.',
  67          'type' => 'read',
  68          'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
  69          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  70      ),
  71  
  72      'mod_forum_view_forum' => array(
  73          'classname' => 'mod_forum_external',
  74          'methodname' => 'view_forum',
  75          'classpath' => 'mod/forum/externallib.php',
  76          'description' => 'Trigger the course module viewed event and update the module completion status.',
  77          'type' => 'write',
  78          'capabilities' => 'mod/forum:viewdiscussion',
  79          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  80      ),
  81  
  82      'mod_forum_view_forum_discussion' => array(
  83          'classname' => 'mod_forum_external',
  84          'methodname' => 'view_forum_discussion',
  85          'classpath' => 'mod/forum/externallib.php',
  86          'description' => 'Trigger the forum discussion viewed event.',
  87          'type' => 'write',
  88          'capabilities' => 'mod/forum:viewdiscussion',
  89          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  90      ),
  91  
  92      'mod_forum_add_discussion_post' => array(
  93          'classname' => 'mod_forum_external',
  94          'methodname' => 'add_discussion_post',
  95          'classpath' => 'mod/forum/externallib.php',
  96          'description' => 'Create new posts into an existing discussion.',
  97          'type' => 'write',
  98          'ajax' => true,
  99          'capabilities' => 'mod/forum:replypost',
 100          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 101      ),
 102  
 103      'mod_forum_add_discussion' => array(
 104          'classname' => 'mod_forum_external',
 105          'methodname' => 'add_discussion',
 106          'classpath' => 'mod/forum/externallib.php',
 107          'description' => 'Add a new discussion into an existing forum.',
 108          'type' => 'write',
 109          'capabilities' => 'mod/forum:startdiscussion',
 110          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 111      ),
 112  
 113      'mod_forum_can_add_discussion' => array(
 114          'classname' => 'mod_forum_external',
 115          'methodname' => 'can_add_discussion',
 116          'classpath' => 'mod/forum/externallib.php',
 117          'description' => 'Check if the current user can add discussions in the given forum (and optionally for the given group).',
 118          'type' => 'read',
 119          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 120      ),
 121  
 122      'mod_forum_get_forum_access_information' => array(
 123          'classname'     => 'mod_forum_external',
 124          'methodname'    => 'get_forum_access_information',
 125          'description'   => 'Return capabilities information for a given forum.',
 126          'type'          => 'read',
 127          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 128      ),
 129  
 130      'mod_forum_set_subscription_state' => array(
 131          'classname' => 'mod_forum_external',
 132          'methodname' => 'set_subscription_state',
 133          'classpath' => 'mod/forum/externallib.php',
 134          'description' => 'Set the subscription state',
 135          'type' => 'write',
 136          'ajax' => true,
 137          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 138      ),
 139  
 140      'mod_forum_set_lock_state' => array(
 141          'classname' => 'mod_forum_external',
 142          'methodname' => 'set_lock_state',
 143          'classpath' => 'mod/forum/externallib.php',
 144          'description' => 'Set the lock state for the discussion',
 145          'type' => 'write',
 146          'ajax' => true,
 147          'capabilities' => 'moodle/course:manageactivities',
 148          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 149      ),
 150  
 151      'mod_forum_toggle_favourite_state' => array(
 152          'classname' => 'mod_forum_external',
 153          'methodname' => 'toggle_favourite_state',
 154          'classpath' => 'mod/forum/externallib.php',
 155          'description' => 'Toggle the favourite state',
 156          'type' => 'write',
 157          'ajax' => true,
 158          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 159      ),
 160      'mod_forum_set_pin_state' => array(
 161          'classname' => 'mod_forum_external',
 162          'methodname' => 'set_pin_state',
 163          'classpath' => 'mod/forum/externallib.php',
 164          'description' => 'Set the pin state',
 165          'type' => 'write',
 166          'ajax' => true,
 167          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 168      ),
 169  
 170      'mod_forum_delete_post' => array(
 171          'classname' => 'mod_forum_external',
 172          'methodname' => 'delete_post',
 173          'classpath' => 'mod/forum/externallib.php',
 174          'description' => 'Deletes a post or a discussion completely when the post is the discussion topic.',
 175          'type' => 'write',
 176          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 177      ),
 178  
 179      'mod_forum_get_discussion_posts_by_userid' => array(
 180          'classname' => 'mod_forum_external',
 181          'methodname' => 'get_discussion_posts_by_userid',
 182          'classpath' => 'mod/forum/externallib.php',
 183          'description' => 'Returns a list of forum posts for a discussion for a user.',
 184          'type' => 'read',
 185          'ajax' => true,
 186          'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
 187      ),
 188      'mod_forum_get_discussion_post' => array(
 189          'classname' => 'mod_forum_external',
 190          'methodname' => 'get_discussion_post',
 191          'classpath' => 'mod/forum/externallib.php',
 192          'description' => 'Get a particular discussion post.',
 193          'type' => 'read',
 194          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 195      ),
 196      'mod_forum_prepare_draft_area_for_post' => array(
 197          'classname' => 'mod_forum_external',
 198          'methodname' => 'prepare_draft_area_for_post',
 199          'classpath' => 'mod/forum/externallib.php',
 200          'description' => 'Prepares a draft area for editing a post.',
 201          'type' => 'write',
 202          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 203      ),
 204      'mod_forum_update_discussion_post' => array(
 205          'classname' => 'mod_forum_external',
 206          'methodname' => 'update_discussion_post',
 207          'classpath' => 'mod/forum/externallib.php',
 208          'description' => 'Updates a post or a discussion topic post.',
 209          'type' => 'write',
 210          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 211      ),
 212  );