// 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;
    }
    // If there is submitted data (no errors).
    if ($submitteddata = $platform_form->get_data()) {
        // Updates the host, with all data.
        $olddata = $DB->get_record('local_vmoodle', array('id' => $submitteddata->id));
        $success = false;
        if (!$DB->update_record('local_vmoodle', $submitteddata)) {
            // If updating data in 'local_vmoodle' table has failed.
            $message_object->message = get_string('badblockupdate', 'local_vmoodle');
            $SESSION->vmoodle_ma['confirm_message'] = $message_object;
            redirect(new moodle_url('/local/vmoodle/view.php', array('view' => 'management')));
//
// 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();