⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 field.class.php

📁 很棒的在线教学系统
💻 PHP
字号:
<?php // $Id: field.class.php,v 1.1.2.2 2008/07/15 04:28:39 moodler Exp $class profile_field_checkbox extends profile_field_base {    /**     * Constructor method.     * Pulls out the options for the checkbox from the database and sets the     * the corresponding key for the data if it exists     */    function profile_field_checkbox($fieldid=0, $userid=0) {        //first call parent constructor        $this->profile_field_base($fieldid, $userid);        if (!empty($this->field)) {            $datafield = get_field('user_info_data', 'data', 'userid', $this->userid, 'fieldid', $this->fieldid);            if ($datafield !== false) {                $this->data = $datafield;            } else {                $this->data = $this->field->defaultdata;            }        }    }    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', get_context_instance(CONTEXT_SYSTEM, SITEID))) {            $mform->addRule($this->inputname, get_string('required'), 'nonzero', null, 'client');        }    }    /**     * Display the data for this field     */    function display_data() {        $options->para = false;        $checked = intval($this->data) === 1 ? 'checked="checked"' : '';        return '<input disabled="disabled" type="checkbox" name="'.$this->inputname.'" '.$checked.' />';    }}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -