$id = required_param('id', PARAM_INT);
    if ($platform_form = $DB->get_record('local_vmoodle', array('id' => $id))) {
        /*
        $message_object->message = get_string('badmoodleid', 'local_vmoodle');
        $SESSION->vmoodle_ma['confirm_message'] = $message_object;
        header('Location: view.php?view=management');
        */
        // Print title (heading).
        echo $OUTPUT->header();
        echo $OUTPUT->heading(get_string('editvmoodle', 'local_vmoodle'));
        // Print beginning of a box.
        echo $OUTPUT->box_start();
        // Displays the form with data (and errors).
        $form = new \local_vmoodle\Host_Form('edit');
        $form->set_data($platform_form);
        $form->display();
        // Print ending of a box.
        echo $OUTPUT->box_end();
        echo $OUTPUT->footer();
        die;
    }
}
/**************************** Do EDIT actions ************/
if ($action == 'doedit') {
    // Retrieves data from the edit form.
    $platform_form = new \local_vmoodle\Host_Form('edit');
    // Checks if form is cancelled
    if ($platform_form->is_cancelled()) {
        redirect(new moodle_url('/local/vmoodle/view.php', array('view' => 'management')));
        die;
    }
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Form for editing a virtual host.
 *
 * @package local_vmoodle
 * @category local
 * @author Moheissen Fabien (fabien.moheissen@gmail.com)
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
 */
// Print title (heading).
echo $OUTPUT->heading(get_string('editvmoodle', 'local_vmoodle'));
echo $OUTPUT->box_start();
// Displays the form with data (and errors).
if (!isset($platform_form)) {
    $datas = isset($SESSION->vmoodle_mg['dataform']) ? $SESSION->vmoodle_mg['dataform'] : null;
    $platform_form = new \local_vmoodle\Host_Form('edit', $datas);
}
$platform_form->display();
echo $OUTPUT->box_end();