Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

   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_discussion_posts' => array(
  52          'classname' => 'mod_forum_external',
  53          'methodname' => 'get_forum_discussion_posts',
  54          'classpath' => 'mod/forum/externallib.php',
  55          'description' => 'Returns a list of forum posts for a discussion.',
  56          'type' => 'read',
  57          'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
  58          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  59      ),
  60  
  61      'mod_forum_get_forum_discussions_paginated' => array(
  62          'classname' => 'mod_forum_external',
  63          'methodname' => 'get_forum_discussions_paginated',
  64          'classpath' => 'mod/forum/externallib.php',
  65          'description' => '** DEPRECATED ** Please do not call this function any more.
  66                            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_get_forum_discussions' => array(
  73          'classname' => 'mod_forum_external',
  74          'methodname' => 'get_forum_discussions',
  75          'classpath' => 'mod/forum/externallib.php',
  76          'description' => 'Returns a list of forum discussions optionally sorted and paginated.',
  77          'type' => 'read',
  78          'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
  79          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  80      ),
  81  
  82      'mod_forum_view_forum' => array(
  83          'classname' => 'mod_forum_external',
  84          'methodname' => 'view_forum',
  85          'classpath' => 'mod/forum/externallib.php',
  86          'description' => 'Trigger the course module viewed event and update the module completion status.',
  87          'type' => 'write',
  88          'capabilities' => 'mod/forum:viewdiscussion',
  89          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  90      ),
  91  
  92      'mod_forum_view_forum_discussion' => array(
  93          'classname' => 'mod_forum_external',
  94          'methodname' => 'view_forum_discussion',
  95          'classpath' => 'mod/forum/externallib.php',
  96          'description' => 'Trigger the forum discussion viewed event.',
  97          'type' => 'write',
  98          'capabilities' => 'mod/forum:viewdiscussion',
  99          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 100      ),
 101  
 102      'mod_forum_add_discussion_post' => array(
 103          'classname' => 'mod_forum_external',
 104          'methodname' => 'add_discussion_post',
 105          'classpath' => 'mod/forum/externallib.php',
 106          'description' => 'Create new posts into an existing discussion.',
 107          'type' => 'write',
 108          'ajax' => true,
 109          'capabilities' => 'mod/forum:replypost',
 110          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 111      ),
 112  
 113      'mod_forum_add_discussion' => array(
 114          'classname' => 'mod_forum_external',
 115          'methodname' => 'add_discussion',
 116          'classpath' => 'mod/forum/externallib.php',
 117          'description' => 'Add a new discussion into an existing forum.',
 118          'type' => 'write',
 119          'capabilities' => 'mod/forum:startdiscussion',
 120          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 121      ),
 122  
 123      'mod_forum_can_add_discussion' => array(
 124          'classname' => 'mod_forum_external',
 125          'methodname' => 'can_add_discussion',
 126          'classpath' => 'mod/forum/externallib.php',
 127          'description' => 'Check if the current user can add discussions in the given forum (and optionally for the given group).',
 128          'type' => 'read',
 129          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 130      ),
 131  
 132      'mod_forum_get_forum_access_information' => array(
 133          'classname'     => 'mod_forum_external',
 134          'methodname'    => 'get_forum_access_information',
 135          'description'   => 'Return capabilities information for a given forum.',
 136          'type'          => 'read',
 137          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 138      ),
 139  
 140      'mod_forum_set_subscription_state' => array(
 141          'classname' => 'mod_forum_external',
 142          'methodname' => 'set_subscription_state',
 143          'classpath' => 'mod/forum/externallib.php',
 144          'description' => 'Set the subscription state',
 145          'type' => 'write',
 146          'ajax' => true,
 147          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 148      ),
 149  
 150      'mod_forum_set_lock_state' => array(
 151          'classname' => 'mod_forum_external',
 152          'methodname' => 'set_lock_state',
 153          'classpath' => 'mod/forum/externallib.php',
 154          'description' => 'Set the lock state for the discussion',
 155          'type' => 'write',
 156          'ajax' => true,
 157          'capabilities' => 'moodle/course:manageactivities',
 158          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 159      ),
 160  
 161      'mod_forum_toggle_favourite_state' => array(
 162          'classname' => 'mod_forum_external',
 163          'methodname' => 'toggle_favourite_state',
 164          'classpath' => 'mod/forum/externallib.php',
 165          'description' => 'Toggle the favourite state',
 166          'type' => 'write',
 167          'ajax' => true,
 168          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 169      ),
 170      'mod_forum_set_pin_state' => array(
 171          'classname' => 'mod_forum_external',
 172          'methodname' => 'set_pin_state',
 173          'classpath' => 'mod/forum/externallib.php',
 174          'description' => 'Set the pin state',
 175          'type' => 'write',
 176          'ajax' => true,
 177          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 178      ),
 179  
 180      'mod_forum_delete_post' => array(
 181          'classname' => 'mod_forum_external',
 182          'methodname' => 'delete_post',
 183          'classpath' => 'mod/forum/externallib.php',
 184          'description' => 'Deletes a post or a discussion completely when the post is the discussion topic.',
 185          'type' => 'write',
 186          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
 187      ),
 188  
 189      'mod_forum_get_discussion_posts_by_userid' => array(
 190          'classname' => 'mod_forum_external',
 191          'methodname' => 'get_discussion_posts_by_userid',
 192          'classpath' => 'mod/forum/externallib.php',
 193          'description' => 'Returns a list of forum posts for a discussion for a user.',
 194          'type' => 'read',
 195          'ajax' => true,
 196          'capabilities' => 'mod/forum:viewdiscussion, mod/forum:viewqandawithoutposting',
 197      ),
 198      'mod_forum_get_discussion_post' => array(
 199          'classname' => 'mod_forum_external',
 200          'methodname' => 'get_discussion_post',
 201          'classpath' => 'mod/forum/externallib.php',
 202          'description' => 'Get a particular discussion post.',
 203          'type' => 'read',
 204          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 205      ),
 206      'mod_forum_prepare_draft_area_for_post' => array(
 207          'classname' => 'mod_forum_external',
 208          'methodname' => 'prepare_draft_area_for_post',
 209          'classpath' => 'mod/forum/externallib.php',
 210          'description' => 'Prepares a draft area for editing a post.',
 211          'type' => 'write',
 212          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 213      ),
 214      'mod_forum_update_discussion_post' => array(
 215          'classname' => 'mod_forum_external',
 216          'methodname' => 'update_discussion_post',
 217          'classpath' => 'mod/forum/externallib.php',
 218          'description' => 'Updates a post or a discussion topic post.',
 219          'type' => 'write',
 220          'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
 221      ),
 222  );