Course Restored Event - Can an event handler tell what the original course was?

Course Restored Event - Can an event handler tell what the original course was?

by gonen r -
Number of replies: 3

Hi,

If I catch the course_restored event (https://github.com/moodle/moodle/blob/master/lib/classes/event/course_restored.php) is there any way for me, as an event handler, to know what was the original course that was backed-up?

specifically I'm interested in this information if the target is a new course.

in other words - I would like to be able to tell that a specific restore event was a "copy of a course" and know the "source course" and the "target course".


is that possible?

if not, what do you think the feasibility of such capability being added to this event?


Thanks,

Gonen

Average of ratings: -
In reply to gonen r

Re: Course Restored Event - Can an event handler tell what the original course was?

by gonen r -

anyone?

In reply to gonen r

Re: Course Restored Event - Can an event handler tell what the original course was?

by Jordi Pujol-Ahulló -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

For what I've checked, you have the id of the target/duplicated course ($this->objectid), but not the id from the source course. You should make checkings from the given event to see the whole set of information it provides. Maybe it appears under other name or it is that piece of data under $this->other['target']. I do not know.

Jordi

In reply to gonen r

Re: Course Restored Event - Can an event handler tell what the original course was?

by Darko Miletić -

That information is not passed within event data - hence not possible. As for can it be added, yes of course as long as you can convince Moodle HQ to do so. I would not hold my breath though.

You can see here outlined process for reporting an issue to Moodle tracker.

https://docs.moodle.org/dev/Tracker_introduction