mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 18:04:43 +02:00
Merge branch 'MDL-50816-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
72d3fd1035
@ -10,3 +10,4 @@ myfilesmanage,core
|
||||
mypreferences,core_grades
|
||||
myprofile,core
|
||||
viewallmyentries,core_blog
|
||||
cannotdeletepost,core_notes
|
@ -26,7 +26,6 @@
|
||||
$string['addnewnote'] = 'Add a new note';
|
||||
$string['addnewnoteselect'] = 'Select users to write notes about';
|
||||
$string['bynameondate'] = 'by {$a->name} - {$a->date}';
|
||||
$string['cannotdeletepost'] = 'Error occurred while deleting post';
|
||||
$string['configenablenotes'] = 'Enable storing of notes about individual users.';
|
||||
$string['content'] = 'Content';
|
||||
$string['course'] = 'course';
|
||||
@ -66,3 +65,6 @@ $string['selectnotestate'] = "Select note state";
|
||||
$string['site'] = 'site';
|
||||
$string['sitenotes'] = 'Site notes';
|
||||
$string['unknown'] = 'unknown';
|
||||
|
||||
// Deprecated since Moodle 3.0.
|
||||
$string['cannotdeletepost'] = 'Error occurred while deleting post';
|
||||
|
@ -48,9 +48,7 @@ if (!has_capability('moodle/notes:manage', $context)) {
|
||||
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;
|
||||
if (!note_delete($note)) {
|
||||
print_error('cannotdeletepost', 'notes', $returnurl);
|
||||
}
|
||||
note_delete($note);
|
||||
redirect($returnurl);
|
||||
|
||||
} else {
|
||||
|
@ -239,12 +239,7 @@ class core_notes_external extends external_api {
|
||||
$context = context_course::instance($note->courseid);
|
||||
self::validate_context($context);
|
||||
require_capability('moodle/notes:manage', $context);
|
||||
if (!note_delete($note)) {
|
||||
$warnings[] = array(array('item' => 'note',
|
||||
'itemid' => $noteid,
|
||||
'warningcode' => 'savedfailed',
|
||||
'message' => 'Note could not be modified'));
|
||||
}
|
||||
note_delete($note);
|
||||
} else {
|
||||
$warnings[] = array('item'=>'note', 'itemid'=>$noteid, 'warningcode'=>'badid', 'message'=>'Note does not exist');
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ function note_save(&$note) {
|
||||
* Deletes a note object based on its id.
|
||||
*
|
||||
* @param int|object $note id of the note to delete, or a note object which is to be deleted.
|
||||
* @return boolean true if the object was deleted; false otherwise
|
||||
* @return boolean true always
|
||||
*/
|
||||
function note_delete($note) {
|
||||
global $DB;
|
||||
|
Loading…
x
Reference in New Issue
Block a user