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 core_external; 18 19 /** 20 * External structure representing a set of files. 21 * 22 * @package core_external 23 * @copyright 2016 Juan Leyva 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 class external_files extends external_multiple_structure { 27 /** 28 * Constructor 29 * @param string $desc Description for the multiple structure. 30 * @param int $required The type of value (VALUE_REQUIRED OR VALUE_OPTIONAL). 31 */ 32 public function __construct($desc = 'List of files.', $required = VALUE_REQUIRED) { 33 parent::__construct( 34 new external_single_structure([ 35 'filename' => new external_value(PARAM_FILE, 'File name.', VALUE_OPTIONAL), 36 'filepath' => new external_value(PARAM_PATH, 'File path.', VALUE_OPTIONAL), 37 'filesize' => new external_value(PARAM_INT, 'File size.', VALUE_OPTIONAL), 38 'fileurl' => new external_value(PARAM_URL, 'Downloadable file url.', VALUE_OPTIONAL), 39 'timemodified' => new external_value(PARAM_INT, 'Time modified.', VALUE_OPTIONAL), 40 'mimetype' => new external_value(PARAM_RAW, 'File mime type.', VALUE_OPTIONAL), 41 'isexternalfile' => new external_value(PARAM_BOOL, 'Whether is an external file.', VALUE_OPTIONAL), 42 'repositorytype' => new external_value(PARAM_PLUGIN, 'The repository type for external files.', VALUE_OPTIONAL), 43 ], 'File.'), 44 $desc, 45 $required, 46 ); 47 } 48 49 /** 50 * Return the properties ready to be used by an exporter. 51 * 52 * @return array properties 53 * @since Moodle 3.3 54 */ 55 public static function get_properties_for_exporter() { 56 return [ 57 'filename' => [ 58 'type' => PARAM_FILE, 59 'description' => 'File name.', 60 'optional' => true, 61 'null' => NULL_NOT_ALLOWED, 62 ], 63 'filepath' => [ 64 'type' => PARAM_PATH, 65 'description' => 'File path.', 66 'optional' => true, 67 'null' => NULL_NOT_ALLOWED, 68 ], 69 'filesize' => [ 70 'type' => PARAM_INT, 71 'description' => 'File size.', 72 'optional' => true, 73 'null' => NULL_NOT_ALLOWED, 74 ], 75 'fileurl' => [ 76 'type' => PARAM_URL, 77 'description' => 'Downloadable file url.', 78 'optional' => true, 79 'null' => NULL_NOT_ALLOWED, 80 ], 81 'timemodified' => [ 82 'type' => PARAM_INT, 83 'description' => 'Time modified.', 84 'optional' => true, 85 'null' => NULL_NOT_ALLOWED, 86 ], 87 'mimetype' => [ 88 'type' => PARAM_RAW, 89 'description' => 'File mime type.', 90 'optional' => true, 91 'null' => NULL_NOT_ALLOWED, 92 ], 93 'isexternalfile' => [ 94 'type' => PARAM_BOOL, 95 'description' => 'Whether is an external file.', 96 'optional' => true, 97 'null' => NULL_NOT_ALLOWED, 98 ], 99 'repositorytype' => [ 100 'type' => PARAM_PLUGIN, 101 'description' => 'The repository type for the external files.', 102 'optional' => true, 103 'null' => NULL_ALLOWED, 104 ], 105 ]; 106 } 107 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body