error('Incorrect course id found'); } /// locate user information if (!($user = get_record('user', 'id', $note->userid))) { error('Incorrect user id found'); } /// require login to access notes require_login($course); /// locate context information $context = get_context_instance(CONTEXT_COURSE, $course->id); require_capability('moodle/notes:manage', $context); if (empty($CFG->enablenotes)) { print_error('notesdisabled', 'notes'); } /// create form $noteform = new note_edit_form(); /// set defaults $noteform->set_data($note); /// if form was cancelled then return to the notes list of the note if ($noteform->is_cancelled()) { redirect($CFG->wwwroot . '/notes/index.php?course=' . $note->courseid . '&user='******'notes', 'update', 'index.php?course=' . $note->courseid . '&user='******'#note-' . $note->id, 'update note'); } // redirect to notes list that contains this note redirect($CFG->wwwroot . '/notes/index.php?course=' . $note->courseid . '&user=' . $note->userid); } if ($noteid) {
error('Incorrect course id found'); } /// require login to access notes require_login($course->id); /// locate context information $context = get_context_instance(CONTEXT_COURSE, $course->id); /// check capability require_capability('moodle/notes:manage', $context); /// locate user information if (!($user = get_record('user', 'id', $userid))) { error('Incorrect user id found'); } /// build-up form require_once 'edit_form.php'; /// create form $noteform = new note_edit_form(null, $extradata); /// if form was cancelled then return to the previous notes list if ($noteform->is_cancelled()) { redirect($CFG->wwwroot . '/notes/index.php?course=' . $courseid . '&user='******'notes', 'add', 'index.php?course=' . $note->courseid . '&user='******'#note-' . $note->id, 'add note'); }