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 * A pre-filled external_value class for text format. 21 * 22 * Default is FORMAT_HTML 23 * This should be used all the time in external xxx_params()/xxx_returns functions 24 * as it is the standard way to implement text format param/return values. 25 * 26 * @package core_webservice 27 * @copyright 2012 Jerome Mouneyrac 28 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 29 * @since Moodle 2.3 30 */ 31 class external_format_value extends external_value { 32 33 /** 34 * Constructor 35 * 36 * @param string $textfieldname Name of the text field 37 * @param int $required if VALUE_REQUIRED then set standard default FORMAT_HTML 38 * @param int $default Default value. 39 */ 40 public function __construct($textfieldname, $required = VALUE_REQUIRED, $default = null) { 41 if ($default == null && $required == VALUE_DEFAULT) { 42 $default = FORMAT_HTML; 43 } 44 45 $desc = sprintf( 46 "%s format (%s = HTML, %s = MOODLE, %s = PLAIN, or %s = MARKDOWN", 47 $textfieldname, 48 FORMAT_HTML, 49 FORMAT_MOODLE, 50 FORMAT_PLAIN, 51 FORMAT_MARKDOWN, 52 ); 53 54 parent::__construct(PARAM_INT, $desc, $required, $default); 55 } 56 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body