Legacy event data.

@return \stdClass
176980
protected function get_legacy_eventdata() {
        $eventdata = new \stdClass();
        $eventdata->modulename = $this->other['modulename'];
        $eventdata->cmid       = $this->objectid;
        $eventdata->courseid   = $this->courseid;
        $eventdata->userid     = $this->userid;
        return $eventdata;
    }
1239722
protected function get_legacy_eventdata() {
        $attempt = $this->get_record_snapshot('quiz_attempts', $this->objectid);

        $legacyeventdata = new \stdClass();
        $legacyeventdata->component = 'mod_quiz';
        $legacyeventdata->attemptid = $this->objectid;
        $legacyeventdata->timestamp = $attempt->timemodified;
        $legacyeventdata->userid = $this->relateduserid;
        $legacyeventdata->quizid = $attempt->quiz;
        $legacyeventdata->cmid = $this->contextinstanceid;
        $legacyeventdata->courseid = $this->courseid;
        $legacyeventdata->submitterid = $this->other['submitterid'];

        return $legacyeventdata;
    }
364139
private function supportData()
    {
        $dataClass = $this->type->getDataClass();

        return $this->data instanceof $dataClass || $dataClass === get_class($this->data);
    }
862906
public static final function restore_legacy($legacy) {
        $classname = get_called_class();
        /** @var base $event */
        $event = new $classname();
        $event->restored = true;
        $event->triggered = true;
        $event->dispatched = true;

        $context = false;
        $component = 'legacy';
        if ($legacy->cmid) {
            $context = \context_module::instance($legacy->cmid, IGNORE_MISSING);
            $component = 'mod_'.$legacy->module;
        } else if ($legacy->course) {
            $context = \context_course::instance($legacy->course, IGNORE_MISSING);
        }
        if (!$context) {
            $context = \context_system::instance();
        }

        $event->data = array();

        $event->data['eventname'] = $legacy->module.'_'.$legacy->action;
        $event->data['component'] = $component;
        $event->data['action'] = $legacy->action;
        $event->data['target'] = null;
        $event->data['objecttable'] = null;
        $event->data['objectid'] = null;
        if (strpos($legacy->action, 'view') !== false) {
            $event->data['crud'] = 'r';
        } else if (strpos($legacy->action, 'print') !== false) {
            $event->data['crud'] = 'r';
        } else if (strpos($legacy->action, 'update') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'hide') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'move') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'write') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'tag') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'remove') !== false) {
            $event->data['crud'] = 'u';
        } else if (strpos($legacy->action, 'delete') !== false) {
            $event->data['crud'] = 'p';
        } else if (strpos($legacy->action, 'create') !== false) {
            $event->data['crud'] = 'c';
        } else if (strpos($legacy->action, 'post') !== false) {
            $event->data['crud'] = 'c';
        } else if (strpos($legacy->action, 'add') !== false) {
            $event->data['crud'] = 'c';
        } else {
            // End of guessing...
            $event->data['crud'] = 'r';
        }
        $event->data['edulevel'] = $event::LEVEL_OTHER;
        $event->data['contextid'] = $context->id;
        $event->data['contextlevel'] = $context->contextlevel;
        $event->data['contextinstanceid'] = $context->instanceid;
        $event->data['userid'] = ($legacy->userid ? $legacy->userid : null);
        $event->data['courseid'] = ($legacy->course ? $legacy->course : null);
        $event->data['relateduserid'] = ($legacy->userid ? $legacy->userid : null);
        $event->data['timecreated'] = $legacy->time;

        $event->logextra = array();
        if ($legacy->ip) {
            $event->logextra['origin'] = 'web';
            $event->logextra['ip'] = $legacy->ip;
        } else {
            $event->logextra['origin'] = 'cli';
            $event->logextra['ip'] = null;
        }
        $event->logextra['realuserid'] = null;

        $event->data['other'] = (array)$legacy;

        return $event;
    }
57523
protected function get_legacy_eventdata() {
        $user = $this->get_record_snapshot('user', $this->objectid);
        $user->deleted = 0;
        $user->username = $this->other['username'];
        $user->email = $this->other['email'];
        $user->idnumber = $this->other['idnumber'];
        $user->picture = $this->other['picture'];

        return $user;
    }
585791
protected function get_legacy_logdata() {
        $submission = $this->get_record_snapshot('assign_submission', $this->objectid);
        $this->set_legacy_logdata('submit for grading', $this->assign->format_submission_for_log($submission));
        return parent::get_legacy_logdata();
    }
790698
protected function get_legacy_logdata() {
        if ($this->other['associatetype'] === 'course') {
            return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
                    $this->other['blogid'], $this->other['subject'], 0, $this->relateduserid);
        }

        return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
                $this->other['blogid'], $this->other['subject'], $this->other['associateid'], $this->relateduserid);
    }
1275796
protected function get_legacy_logdata() {
        $logurl = new \moodle_url('index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
        $logurl->set_anchor('note-' . $this->objectid);
        return array($this->courseid, 'notes', 'add', $logurl, 'add note');
    }
1313168
public function from_data_to_event_properties(\stdClass $data) {
        $properties = clone($data);

        if ($data->eventtype == 'group') {
            if (isset($data->groupcourseid)) {
                $properties->courseid = $data->groupcourseid;
                unset($properties->groupcourseid);
            }
            if (isset($data->groupid)) {
                $properties->groupid = $data->groupid;
            }
        } else {
            // Default course id if none is set.
            if (empty($properties->courseid)) {
                if ($properties->eventtype == 'site') {
                    $properties->courseid = SITEID;
                } else {
                    $properties->courseid = 0;
                }
            } else {
                $properties->courseid = $data->courseid;
            }
        }

        // Decode the form fields back into valid event property.
        $properties->timeduration = $this->get_time_duration_from_form_data($data);

        return $properties;
    }
313904
public function getEventObject()
    {
        if ($this->currentOverriddenEvent) {
            return $this->currentOverriddenEvent;
        }

        $event = clone $this->masterEvent;

        // Ignoring the following block, because PHPUnit's code coverage
        // ignores most of these lines, and this messes with our stats.
        //
        // @codeCoverageIgnoreStart
        unset(
            $event->RRULE,
            $event->EXDATE,
            $event->RDATE,
            $event->EXRULE,
            $event->{'RECURRENCE-ID'}
        );
        // @codeCoverageIgnoreEnd

        $event->DTSTART->setDateTime($this->getDtStart(), $event->DTSTART->isFloating());
        if (isset($event->DTEND)) {
            $event->DTEND->setDateTime($this->getDtEnd(), $event->DTEND->isFloating());
        }
        $recurid = clone $event->DTSTART;
        $recurid->name = 'RECURRENCE-ID';
        $event->add($recurid);

        return $event;
    }
526846
protected function get_legacy_logdata() {
        if (!empty($this->legacylogdata)) {
            return $this->legacylogdata;
        }

        return array(SITEID, 'category', 'update', 'editcategory.php?id=' . $this->objectid, $this->objectid);
    }
609822
public function currentEvent()
    {
        if ($this->currentEvent) {
            return $this->currentEvent;
        }

        // The the current event
        $event = $this->eventManager()->entry();

        // Format the event
        if ($event) {
            $this->currentEvent = $this->eventFormatFull($event);
        }

        return $this->currentEvent;
    }
353739
protected function get_legacy_eventdata() {
        $eventdata = new \stdClass();
        $eventdata->groupid = $this->objectid;
        $eventdata->userid  = $this->relateduserid;
        $eventdata->component = $this->other['component'];
        $eventdata->itemid = $this->other['itemid'];
        return $eventdata;
    }
1257109
protected function get_legacy_eventdata() {
        $eventdata = new \stdClass();
        $eventdata->modulename = 'assign';
        $eventdata->cmid = $this->contextinstanceid;
        $eventdata->itemid = $this->objectid;
        $eventdata->courseid = $this->courseid;
        $eventdata->userid = $this->userid;
        if (count($this->legacyfiles) > 1) {
            $eventdata->files = $this->legacyfiles;
        }
        $eventdata->file = $this->legacyfiles;
        $eventdata->pathnamehashes = array_keys($this->legacyfiles);
        return $eventdata;
    }
372585
public function get_legacy_logdata() {
        $hook = $mode = '';
        if (isset($this->other['hook'])) {
            $hook = $this->other['hook'];
        }
        if (isset($this->other['mode'])) {
            $mode = $this->other['mode'];
        }
        return array($this->courseid, 'glossary', 'delete entry',
            "view.php?id={$this->contextinstanceid}&amp;mode={$mode}&amp;hook={$hook}",
            $this->objectid, $this->contextinstanceid);
    }
136331
private function getDatabaseStructureEvents()
    {
        // Listing all events from database
        if ($this->dumpSettings['events']) {
            foreach ($this->dbHandler->query($this->typeAdapter->show_events($this->dbName)) as $row) {
                array_push($this->events, $row['event_name']);
            }
        }
        return;
    }
312372
public function getEventModel()
    {
        if ($this->eventModel === null) {
            $this->load->model('extension/event');
            /** @noinspection PhpUndefinedFieldInspection */
            $this->eventModel = $this->model_extension_event;
        }
        return $this->eventModel;
    }