Merge branch 'MDL-46218_disabled2_27' of https://github.com/andyjdavis/moodle into MOODLE_27_STABLE

This commit is contained in:
Dan Poltawski
2014-07-14 15:33:13 +01:00
4 changed files with 47 additions and 50 deletions
+8 -9
View File
@@ -18,14 +18,17 @@ if (!$course = $DB->get_record('course', array('id'=>$note->courseid))) {
print_error('invalidcourseid');
}
// locate user information
if (!$user = $DB->get_record('user', array('id'=>$note->userid))) {
print_error('invaliduserid');
}
// require login to access notes
require_login($course);
if (empty($CFG->enablenotes)) {
print_error('notesdisabled', 'notes');
}
if (!$user = $DB->get_record('user', array('id' => $note->userid))) {
print_error('invaliduserid');
}
// locate context information
$context = context_course::instance($course->id);
@@ -34,10 +37,6 @@ if (!has_capability('moodle/notes:manage', $context)) {
print_error('nopermissiontodelete', 'notes');
}
if (empty($CFG->enablenotes)) {
print_error('notesdisabled', 'notes');
}
if (data_submitted() && confirm_sesskey()) {
//if data was submitted and is valid, then delete note
$returnurl = $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&user=' . $note->userid;
+6 -7
View File
@@ -41,20 +41,19 @@ if (!$course = $DB->get_record('course', array('id'=>$note->courseid))) {
print_error('invalidcourseid');
}
/// locate user information
if (!$user = $DB->get_record('user', array('id'=>$note->userid))) {
print_error('invaliduserid');
}
/// require login to access notes
require_login($course);
if (empty($CFG->enablenotes)) {
print_error('notesdisabled', 'notes');
}
/// locate context information
$context = context_course::instance($course->id);
require_capability('moodle/notes:manage', $context);
if (empty($CFG->enablenotes)) {
print_error('notesdisabled', 'notes');
if (!$user = $DB->get_record('user', array('id' => $note->userid))) {
print_error('invaliduserid');
}
/// create form