See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
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 * Text profile field definition. 19 * 20 * @package profilefield_text 21 * @copyright 2007 onwards Shane Elliot {@link http://pukunui.com} 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 /** 26 * Class profile_define_text 27 * 28 * @copyright 2007 onwards Shane Elliot {@link http://pukunui.com} 29 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 30 */ 31 class profile_define_text extends profile_define_base { 32 33 /** 34 * Add elements for creating/editing a text profile field. 35 * 36 * @param MoodleQuickForm $form 37 */ 38 public function define_form_specific($form) { 39 // Default data. 40 $form->addElement('text', 'defaultdata', get_string('profiledefaultdata', 'admin'), 'size="50"'); 41 $form->setType('defaultdata', PARAM_TEXT); 42 43 // Param 1 for text type is the size of the field. 44 $form->addElement('text', 'param1', get_string('profilefieldsize', 'admin'), 'size="6"'); 45 $form->setDefault('param1', 30); 46 $form->setType('param1', PARAM_INT); 47 48 // Param 2 for text type is the maxlength of the field. 49 $form->addElement('text', 'param2', get_string('profilefieldmaxlength', 'admin'), 'size="6"'); 50 $form->setDefault('param2', 2048); 51 $form->setType('param2', PARAM_INT); 52 $form->addHelpButton('param2', 'profilefieldmaxlength', 'admin'); 53 54 // Param 3 for text type detemines if this is a password field or not. 55 $form->addElement('selectyesno', 'param3', get_string('profilefieldispassword', 'admin')); 56 $form->setDefault('param3', 0); // Defaults to 'no'. 57 $form->setType('param3', PARAM_INT); 58 59 // Param 4 for text type contains a link. 60 $form->addElement('text', 'param4', get_string('profilefieldlink', 'admin')); 61 $form->setType('param4', PARAM_URL); 62 $form->addHelpButton('param4', 'profilefieldlink', 'admin'); 63 64 // Param 5 for text type contains link target. 65 $targetoptions = array( '' => get_string('linktargetnone', 'editor'), 66 '_blank' => get_string('linktargetblank', 'editor'), 67 '_self' => get_string('linktargetself', 'editor'), 68 '_top' => get_string('linktargettop', 'editor') 69 ); 70 $form->addElement('select', 'param5', get_string('profilefieldlinktarget', 'admin'), $targetoptions); 71 $form->setType('param5', PARAM_RAW); 72 } 73 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body