function bigbluebuttonbn_event_log_standard($event_type, $bigbluebuttonbn, $context, $cm)
{
    $context = context_module::instance($cm->id);
    $event_properties = array('context' => $context, 'objectid' => $bigbluebuttonbn->id);
    switch ($event_type) {
        case BIGBLUEBUTTON_EVENT_MEETING_JOINED:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_meeting_joined::create($event_properties);
            break;
        case BIGBLUEBUTTON_EVENT_MEETING_CREATED:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_meeting_created::create($event_properties);
            break;
        case BIGBLUEBUTTON_EVENT_MEETING_ENDED:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_meeting_ended::create($event_properties);
            break;
        case BIGBLUEBUTTON_EVENT_MEETING_LEFT:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_meeting_left::create($event_properties);
            break;
        case BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_recording_published::create($event_properties);
            break;
        case BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_recording_unpublished::create($event_properties);
            break;
        case BIGBLUEBUTTON_EVENT_RECORDING_DELETED:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_recording_deleted::create($event_properties);
            break;
        case BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_activity_viewed::create($event_properties);
            break;
        case BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED:
            $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_activity_management_viewed::create($event_properties);
            break;
    }
    $event->trigger();
}
$submit = optional_param('submit', '', PARAM_TEXT);
if ($submit === 'end' && $moderator) {
    //
    // A request to end the meeting
    //
    if (!($bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $a), '*', MUST_EXIST))) {
        print_error("BigBlueButton ID {$a} is incorrect");
    }
    $course = $DB->get_record('course', array('id' => $bigbluebuttonbn->course), '*', MUST_EXIST);
    $cm = get_coursemodule_from_instance('bigbluebuttonbn', $bigbluebuttonbn->id, $course->id, false, MUST_EXIST);
    if ($CFG->version < '2014051200') {
        //This is valid before v2.7
        add_to_log($course->id, 'bigbluebuttonbn', 'meeting ended', "index.php?id={$course->id}", '');
    } else {
        //This is valid before v2.7
        $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_meeting_ended::create(array('context' => $context, 'objectid' => $bigbluebuttonbn->id));
        $event->trigger();
    }
    echo get_string('index_ending', 'bigbluebuttonbn');
    $meetingID = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id;
    $modPW = $bigbluebuttonbn->moderatorpass;
    if ($g != '0') {
        $getArray = bigbluebuttonbn_wrap_simplexml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID . '[' . $g . ']', $modPW, $url, $salt));
    } else {
        $getArray = bigbluebuttonbn_wrap_simplexml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $url, $salt));
    }
    redirect('index.php?id=' . $id);
} else {
    if ($CFG->version < '2014051200') {
        //This is valid before v2.7
        add_to_log($course->id, 'bigbluebuttonbn', 'activity management viewed', "index.php?id={$course->id}", '');