2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
20 * Course restored event.
23 * @copyright 2013 Mark Nelson <markn@moodle.com>
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 class course_restored extends base {
29 * Initialise the event data.
31 protected function init() {
32 $this->data['objecttable'] = 'course';
33 $this->data['crud'] = 'c';
34 $this->data['level'] = 50;
38 * Returns localised general event name.
42 public static function get_name() {
43 return get_string('eventcourserestored');
47 * Returns non-localised description of what happened.
51 public function get_description() {
52 return "Course {$this->objectid} was restored by user {$this->userid}";
56 * Returns relevant URL.
60 public function get_url() {
61 return new \moodle_url('/course/view.php', array('id' => $this->objectid));
65 * Returns the name of the legacy event.
67 * @return string legacy event name
69 public static function get_legacy_eventname() {
70 return 'course_restored';
74 * Returns the legacy event data.
76 * @return \stdClass the legacy event data
78 protected function get_legacy_eventdata() {
79 return (object) array(
80 'courseid' => $this->objectid,
81 'userid' => $this->userid,
82 'type' => $this->other['type'],
83 'target' => $this->other['target'],
84 'mode' => $this->other['mode'],
85 'operation' => $this->other['operation'],
86 'samesite' => $this->other['samesite'],