Skip to content

Commit

Permalink
MDL-49498 user: Move user/index event triggering to new API function
Browse files Browse the repository at this point in the history
New function in user/lib.php: user_list_view
  • Loading branch information
jleyva committed Apr 2, 2015
1 parent 1d3fd63 commit 0ff203b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
13 changes: 3 additions & 10 deletions user/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

require_once('../config.php');
require_once($CFG->dirroot.'/user/lib.php');
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/filelib.php');

Expand Down Expand Up @@ -105,16 +106,8 @@
}
}

$event = \core\event\user_list_viewed::create(array(
'objectid' => $course->id,
'courseid' => $course->id,
'context' => $context,
'other' => array(
'courseshortname' => $course->shortname,
'coursefullname' => $course->fullname
)
));
$event->trigger();
// Trigger events.
user_list_view($course, $context);

$bulkoperations = has_capability('moodle/course:bulkmessaging', $context);

Expand Down
21 changes: 21 additions & 0 deletions user/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1002,3 +1002,24 @@ function user_remove_user_device($uuid, $appid = "") {

return true;
}

/**
* Trigger user_list_viewed event.
*
* @param stdClass $course course object
* @param stdClass $context course context object
* @since Moodle 2.9
*/
function user_list_view($course, $context) {

$event = \core\event\user_list_viewed::create(array(
'objectid' => $course->id,
'courseid' => $course->id,
'context' => $context,
'other' => array(
'courseshortname' => $course->shortname,
'coursefullname' => $course->fullname
)
));
$event->trigger();
}

0 comments on commit 0ff203b

Please sign in to comment.