$fromform->subjectcode = $subject; $fromform->presentdata = $presentdata; $fromform->reason = $fromform->reason['text']; $fromform->requested_date = time(); $registrar = $DB->get_records_sql("select userid from {local_school_permissions} where roleid = 9 and schoolid = {$fromform->schoolid} group by userid"); foreach ($registrar as $reg) { $registrarid = $reg->userid; } $userto = $DB->get_record('user', array('id' => $registrarid)); $userfrom = $DB->get_record('user', array('id' => $USER->id)); $message = get_string('reqprofilechnagesmsg', 'local_request'); if (isset($fromform->changeto) && isset($fromform->reason)) { $DB->insert_record('local_request_profile_change', $fromform); message_post_message($userfrom, $userto, $message, FORMAT_HTML); $conmessage = get_string('requestsubmit', 'local_request'); $options = array('style' => 'notifysuccess'); $hierarchy->set_confirmation($conmessage, $nexturl, $options); } else { redirect($nexturl); } } echo $OUTPUT->header(); echo $OUTPUT->heading($strheading); $currenttab = 'request'; $requestpro->requesttabview($currenttab); echo $OUTPUT->box(get_string('profilerequestingdes', 'local_request')); $mform->display(); echo $OUTPUT->footer(); ?>