芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/public_html/cepali/user/profile/field/checkbox/field.class.php
. /** * Strings for component 'profilefield_checkbox', language 'en', branch 'MOODLE_20_STABLE' * * @package profilefield_checkbox * @copyright 2008 onwards Shane Elliot {@link http://pukunui.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Class profile_field_checkbox * * @copyright 2008 onwards Shane Elliot {@link http://pukunui.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class profile_field_checkbox extends profile_field_base { /** * Add elements for editing the profile field value. * @param moodleform $mform */ public function edit_field_add($mform) { // Create the form field. $checkbox = $mform->addElement('advcheckbox', $this->inputname, format_string($this->field->name)); if ($this->data == '1') { $checkbox->setChecked(true); } $mform->setType($this->inputname, PARAM_BOOL); if ($this->is_required() and !has_capability('moodle/user:update', context_system::instance())) { $mform->addRule($this->inputname, get_string('required'), 'nonzero', null, 'client'); } } /** * Display the data for this field * * @return string HTML. */ public function display_data() { $options = new stdClass(); $options->para = false; $checked = intval($this->data) === 1 ? 'checked="checked"' : ''; return '
'; } /** * Return the field type and null properties. * This will be used for validating the data submitted by a user. * * @return array the param type and null property * @since Moodle 3.2 */ public function get_field_properties() { return array(PARAM_BOOL, NULL_NOT_ALLOWED); } }