See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 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 namespace mod_bigbluebuttonbn\external; 18 19 use context_module; 20 use external_api; 21 use external_description; 22 use external_function_parameters; 23 use external_single_structure; 24 use external_value; 25 use external_warnings; 26 use mod_bigbluebuttonbn\instance; 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 global $CFG; 31 require_once($CFG->libdir . '/externallib.php'); 32 33 /** 34 * External service to trigger the course module viewed event and update the module completion status 35 * 36 * This is mainly used by the mobile application. 37 * 38 * @package mod_bigbluebuttonbn 39 * @category external 40 * @copyright 2018 onwards, Blindside Networks Inc 41 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 42 */ 43 class view_bigbluebuttonbn extends external_api { 44 /** 45 * Returns description of method parameters 46 * 47 * @return external_function_parameters 48 * @since Moodle 3.0 49 */ 50 public static function execute_parameters() { 51 return new external_function_parameters([ 52 'bigbluebuttonbnid' => new external_value(PARAM_INT, 'bigbluebuttonbn instance id'), 53 ] 54 ); 55 } 56 57 /** 58 * Trigger the course module viewed event and update the module completion status. 59 * 60 * @param int $instanceid the bigbluebuttonbn instance id 61 * @return array of warnings and status result 62 * @since Moodle 3.0 63 */ 64 public static function execute($instanceid) { 65 global $CFG; 66 require_once($CFG->dirroot . "/mod/bigbluebuttonbn/lib.php"); 67 68 ['bigbluebuttonbnid' => $instanceid] = self::validate_parameters( 69 self::execute_parameters(), 70 ['bigbluebuttonbnid' => $instanceid] 71 ); 72 73 $instance = instance::get_from_instanceid($instanceid); 74 75 if (empty($instance)) { 76 return [ 77 'status' => false, 78 'warnings' => [ 79 [ 80 'item' => 'mod_bigbluebuttonbn', 81 'itemid' => 0, 82 'warningcode' => 'nosuchinstance', 83 'message' => get_string('nosuchinstance', 'mod_bigbluebuttonbn', 84 (object) ['id' => $instanceid, 'entity' => 'bigbluebuttonbn']) 85 ] 86 ] 87 ]; 88 } 89 $context = context_module::instance($instance->get_cm_id()); 90 self::validate_context($context); 91 92 require_capability('mod/bigbluebuttonbn:view', $context); 93 // Call the bigbluebuttonbn/lib API. 94 bigbluebuttonbn_view($instance->get_instance_data(), $instance->get_course(), $instance->get_cm(), $context); 95 return [ 96 'status' => true, 97 'warnings' => [] 98 ]; 99 } 100 101 /** 102 * Returns description of method result value 103 * 104 * @return external_description 105 * @since Moodle 3.0 106 */ 107 public static function execute_returns() { 108 return new external_single_structure([ 109 'status' => new external_value(PARAM_BOOL, 'status: true if success'), 110 'warnings' => new external_warnings() 111 ] 112 ); 113 } 114 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body