Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 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 * 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 * @param moodleform $form 36 */ 37 public function define_form_specific($form) { 38 // Default data. 39 $form->addElement('text', 'defaultdata', get_string('profiledefaultdata', 'admin'), 'size="50"'); 40 $form->setType('defaultdata', PARAM_TEXT); 41 42 // Param 1 for text type is the size of the field. 43 $form->addElement('text', 'param1', get_string('profilefieldsize', 'admin'), 'size="6"'); 44 $form->setDefault('param1', 30); 45 $form->setType('param1', PARAM_INT); 46 47 // Param 2 for text type is the maxlength of the field. 48 $form->addElement('text', 'param2', get_string('profilefieldmaxlength', 'admin'), 'size="6"'); 49 $form->setDefault('param2', 2048); 50 $form->setType('param2', PARAM_INT); 51 52 // Param 3 for text type detemines if this is a password field or not. 53 $form->addElement('selectyesno', 'param3', get_string('profilefieldispassword', 'admin')); 54 $form->setDefault('param3', 0); // Defaults to 'no'. 55 $form->setType('param3', PARAM_INT); 56 57 // Param 4 for text type contains a link. 58 $form->addElement('text', 'param4', get_string('profilefieldlink', 'admin')); 59 $form->setType('param4', PARAM_URL); 60 $form->addHelpButton('param4', 'profilefieldlink', 'admin'); 61 62 // Param 5 for text type contains link target. 63 $targetoptions = array( '' => get_string('linktargetnone', 'editor'), 64 '_blank' => get_string('linktargetblank', 'editor'), 65 '_self' => get_string('linktargetself', 'editor'), 66 '_top' => get_string('linktargettop', 'editor') 67 ); 68 $form->addElement('select', 'param5', get_string('profilefieldlinktarget', 'admin'), $targetoptions); 69 $form->setType('param5', PARAM_RAW); 70 } 71 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body