Editing the course settings form

Asked

Viewed 89 times

2

I’m editing the course settings form on moodle and it works, it added the field but not saved if I change in banco de dados the data saved are printed on the input, only it didn’t save.

edit_form.php

    $mform->addElement('text', 'hora', 'Hora do Curso', 'maxlength="100" size="20"');
    $mform->setType('hora', PARAM_TEXT);
    if (!empty($course->id)) {
        $mform->setConstant('hora', $course->hora);
    }

    $mform->addElement('text', 'local', 'Local do Curso', 'maxlength="100" size="20"');
    $mform->setType('local', PARAM_TEXT);
    if (!empty($course->id)) {
        $mform->setConstant('local', $course->local);
    }

I need to edit other files ?

1 answer

2


I managed to solve by editing the file edit.php, includes some lines in the code to add values to the $data object, example:

$data->hora = $_POST["hora"];
$data->local = $_POST["local"];

Remembering that in the table of courses I created the field hora and local and added the course fields to the form as entered in the question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.