예제 #1
0
function save_form_data($record, $fields)
{
    $xml = new SimpleXMLElement('<form_data/>');
    foreach ($fields as $key => $value) {
        $xml->addChild($key, encode_xml($value));
    }
    $record->data = $xml->asXML();
    return write_form_data($record);
}
예제 #2
0
        if ($mform_data->submitbutton == get_string('save', 'local_obu_forms')) {
            if ($data->authorisation_level == 1) {
                $data->auth_1_id = $authoriser_id;
            } else {
                if ($data->authorisation_level == 2) {
                    $data->auth_2_id = $authoriser_id;
                } else {
                    if ($data->authorisation_level == 3) {
                        $data->auth_3_id = $authoriser_id;
                    } else {
                        echo get_string('invalid_data', 'local_obu_forms');
                        die;
                    }
                }
            }
            write_form_data($data);
            // Update the form data record
            update_authoriser($form, $data, $authoriser_id);
            // Update the authorisations and send notification emails
            redirect($home);
        }
    }
}
echo $OUTPUT->header();
echo $OUTPUT->heading($heading);
if ($message) {
    notice($message, $home);
} else {
    $mform->display();
}
echo $OUTPUT->footer();