Editing the course settings form

2

I'm editing the course settings form in moodle and it works, it added the field but not saved, if I change in banco de dados the saved data is printed in input , only it does not 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);
    }

Do I need to edit other files?

    
asked by anonymous 04.11.2016 / 18:57

1 answer

2

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

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

Remembering that in the course table I created the field hora and local and added the course fields in the form as informed in the question.

    
07.11.2016 / 19:14