protected function buffer_event(\core\event\base $event) {

        // If there are no subscriptions for this event do not buffer it.
        if (!\tool_monitor\subscription_manager::event_has_subscriptions($event->eventname, $event->courseid)) {
            return;
        }

        $eventdata = $event->get_data();
        $eventobj = new \stdClass();
        $eventobj->eventname = $eventdata['eventname'];
        $eventobj->contextid = $eventdata['contextid'];
        $eventobj->contextlevel = $eventdata['contextlevel'];
        $eventobj->contextinstanceid = $eventdata['contextinstanceid'];
        if ($event->get_url()) {
            // Get link url if exists.
            $eventobj->link = $event->get_url()->out();
        } else {
            $eventobj->link = '';
        }
        $eventobj->courseid = $eventdata['courseid'];
        $eventobj->timecreated = $eventdata['timecreated'];

        $this->buffer[] = $eventobj;
        $this->count++;
    }
protected function buffer_event(\core\event\base $event) {

        // If there are no subscriptions for this event do not buffer it.
        if (!\tool_monitor\subscription_manager::event_has_subscriptions($event->eventname, $event->courseid)) {
            return;
        }

        $eventdata = $event->get_data();
        $eventobj = new \stdClass();
        $eventobj->eventname = $eventdata['eventname'];
        $eventobj->contextid = $eventdata['contextid'];
        $eventobj->contextlevel = $eventdata['contextlevel'];
        $eventobj->contextinstanceid = $eventdata['contextinstanceid'];
        if ($event->get_url()) {
            // Get link url if exists.
            $eventobj->link = $event->get_url()->out();
        } else {
            $eventobj->link = '';
        }
        $eventobj->courseid = $eventdata['courseid'];
        $eventobj->timecreated = $eventdata['timecreated'];

        $this->buffer[] = $eventobj;
        $this->count++;
    }
protected function buffer_event ( \ core \ event \ base $ event ) { // If there are no subscriptions for this event do not buffer it. if ( ! \ tool_monitor \ subscription_manager :: event_has_subscriptions ( $ event -> eventname , $ event -> courseid ) ) { return ; } $ eventdata = $ event -> get_data ( ) ; $ eventobj = new \ stdClass ( ) ; $ eventobj -> eventname = $ eventdata [ 'eventname' ] ; $ eventobj -> contextid = $ eventdata [ 'contextid' ] ; $ eventobj -> contextlevel = $ eventdata [ 'contextlevel' ] ; $ eventobj -> contextinstanceid = $ eventdata [ 'contextinstanceid' ] ; if ( $ event -> get_url ( ) ) { // Get link url if exists. $ eventobj -> link = $ event -> get_url ( ) -> out ( ) ; } else { $ eventobj -> link = '' ; } $ eventobj -> courseid = $ eventdata [ 'courseid' ] ; $ eventobj -> timecreated = $ eventdata [ 'timecreated' ] ; $ this -> buffer [ ] = $ eventobj ; $ this -> count ++ ; }
Api to buffer events to store, to reduce db queries.

@param \core\event\base $event
Api to buffer events to store to reduce db queries .