. /** * ${PLUGINNAME} file description here. * * @package ${PLUGINNAME} * @copyright 2022 alex <${USEREMAIL}> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once("$CFG->libdir/formslib.php"); require_once($CFG->dirroot . '/enrol/locallib.php'); class update_from extends moodleform { protected $id_change_fio; private function get_fio_default_value($id){ global $DB; return $DB->get_record('teacherskey_data', array('id' => $id)); } public function definition() { global $USER, $CFG, $PAGE; $myform = $this->_form; $id_change_fio = $this->_customdata; $row = $this->get_fio_default_value($id_change_fio); $attributes = array('size' => '30', 'placeholder' => get_string('fio', 'enrol_teacherskey')); $myform->addElement('text', 'fio', get_string('labelfio', 'enrol_teacherskey'), $attributes); $myform->setType('fio', PARAM_NOTAGS); $myform->setDefault('fio', $row->fio); $this->add_action_buttons(); $myform->addElement('hidden', 'id'); $myform->setType('id', PARAM_INT); $myform->setDefault('id', $id_change_fio); $myform->addElement('hidden', 'courseid'); $myform->setType('courseid', PARAM_INT); $myform->setDefault('courseid', $row->courseid); } function validate($data, $files) { return array(); } }