mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 05:25:08 +02:00
MDL-49504 notes: Move note view triggering to API function
This commit is contained in:
parent
1d3fd63f97
commit
f0c5f8406c
@ -87,11 +87,7 @@ require_capability('moodle/notes:view', $coursecontext);
|
||||
$systemcontext = context_system::instance();
|
||||
|
||||
// Trigger event.
|
||||
$event = \core\event\notes_viewed::create(array(
|
||||
'relateduserid' => $userid,
|
||||
'context' => $coursecontext
|
||||
));
|
||||
$event->trigger();
|
||||
note_view($coursecontext, $userid);
|
||||
|
||||
$strnotes = get_string('notes', 'notes');
|
||||
if ($userid) {
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
/**
|
||||
* Library of functions and constants for notes
|
||||
*
|
||||
* @package core_notes
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -347,3 +350,20 @@ function note_delete_all($courseid) {
|
||||
function note_page_type_list($pagetype, $parentcontext, $currentcontext) {
|
||||
return array('notes-*' => get_string('page-notes-x', 'notes'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger notes viewed event
|
||||
*
|
||||
* @param stdClass $context context object
|
||||
* @param int $userid user id (the user we are viewing the notes)
|
||||
* @since Moodle 2.9
|
||||
*/
|
||||
function note_view($context, $userid) {
|
||||
|
||||
$event = \core\event\notes_viewed::create(array(
|
||||
'relateduserid' => $userid,
|
||||
'context' => $context
|
||||
));
|
||||
$event->trigger();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user