Merge branch 'MDL-46942-added-original-course' of https://github.com/jmalmsten-panopto/moodle
This commit is contained in:
@@ -169,16 +169,27 @@ class restore_plan extends base_plan implements loggable {
|
||||
|
||||
// Check if we are restoring a course.
|
||||
if ($this->controller->get_type() === backup::TYPE_1COURSE) {
|
||||
|
||||
// Check to see if we are on the same site to pass original course info.
|
||||
$issamesite = $this->controller->is_samesite();
|
||||
|
||||
$otherarray = array('type' => $this->controller->get_type(),
|
||||
'target' => $this->controller->get_target(),
|
||||
'mode' => $this->controller->get_mode(),
|
||||
'operation' => $this->controller->get_operation(),
|
||||
'samesite' => $issamesite
|
||||
);
|
||||
|
||||
if ($this->controller->is_samesite()) {
|
||||
$otherarray['original_course_id'] = $this->controller->get_info()->original_course_id;
|
||||
}
|
||||
|
||||
// Trigger a course restored event.
|
||||
$event = \core\event\course_restored::create(array(
|
||||
'objectid' => $this->get_courseid(),
|
||||
'userid' => $this->get_userid(),
|
||||
'context' => context_course::instance($this->get_courseid()),
|
||||
'other' => array('type' => $this->controller->get_type(),
|
||||
'target' => $this->controller->get_target(),
|
||||
'mode' => $this->controller->get_mode(),
|
||||
'operation' => $this->controller->get_operation(),
|
||||
'samesite' => $this->controller->is_samesite())
|
||||
'other' => $otherarray
|
||||
));
|
||||
$event->trigger();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* - int mode: execution mode.
|
||||
* - string operation: what operation are we performing?
|
||||
* - boolean samesite: true if restoring to same site.
|
||||
* - int original_course_id: the id of the course the course being restored, only included if samesite is true
|
||||
* }
|
||||
*
|
||||
* @package core
|
||||
@@ -70,7 +71,15 @@ class course_restored extends base {
|
||||
* @return string
|
||||
*/
|
||||
public function get_description() {
|
||||
return "The user with id '$this->userid' restored the course with id '$this->courseid'.";
|
||||
$retstring = "The user with id '$this->userid' restored the course with id '$this->courseid'.";
|
||||
|
||||
if (isset($this->other['original_course_id'])) {
|
||||
$originalcourseid = $this->other['original_course_id'];
|
||||
$retstring = "The user with id '$this->userid' restored old course with id " .
|
||||
"'$originalcourseid' to a new course with id '$this->courseid'.";
|
||||
}
|
||||
|
||||
return $retstring;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user