Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [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 /** 18 * This class contains a list of webservice functions related to session. 19 * 20 * @package core 21 * @copyright 2019 Damyon Wiese 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace core\session; 26 27 use core_external\external_api; 28 use core_external\external_description; 29 use core_external\external_function_parameters; 30 use core_external\external_single_structure; 31 use core_external\external_value; 32 33 /** 34 * This class contains a list of webservice functions related to session. 35 * 36 * @copyright 2019 Damyon Wiese 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 * @since 2.9 39 */ 40 class external extends external_api { 41 42 /** 43 * Returns description of touch_session() parameters. 44 * 45 * @return external_function_parameters 46 */ 47 public static function touch_session_parameters() { 48 return new external_function_parameters([]); 49 } 50 51 /** 52 * Extend the current session. 53 * 54 * @return array the mapping 55 */ 56 public static function touch_session() { 57 \core\session\manager::touch_session(session_id()); 58 return true; 59 } 60 61 /** 62 * Returns description of touch_session() result value. 63 * 64 * @return external_description 65 */ 66 public static function touch_session_returns() { 67 return new external_value(PARAM_BOOL, 'result'); 68 } 69 70 /** 71 * Returns description of time_remaining() parameters. 72 * 73 * @return external_function_parameters 74 */ 75 public static function time_remaining_parameters() { 76 return new external_function_parameters([]); 77 } 78 79 /** 80 * Extend the current session. 81 * 82 * @return array the mapping 83 */ 84 public static function time_remaining() { 85 return \core\session\manager::time_remaining(session_id()); 86 } 87 88 /** 89 * Returns description of touch_session() result value. 90 * 91 * @return external_description 92 */ 93 public static function time_remaining_returns() { 94 return new external_single_structure([ 95 'userid' => new external_value(PARAM_INT, 'The current user id.'), 96 'timeremaining' => new external_value(PARAM_INT, 'The number of seconds remaining in this session.'), 97 ]); 98 } 99 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body