MDL-46455 mod_*: added restore mapping to events

This commit is contained in:
Mark Nelson 2015-09-24 17:02:57 -07:00
parent ef15eae433
commit 0bfafc5ba0
170 changed files with 1364 additions and 19 deletions

View file

@ -86,4 +86,8 @@ class content_page_viewed extends \core\event\base {
throw new \coding_exception('Context level must be CONTEXT_MODULE.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_pages', 'restore' => 'lesson_page');
}
}

View file

@ -45,4 +45,8 @@ class course_module_viewed extends \core\event\course_module_viewed {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
public static function get_objectid_mapping() {
return array('db' => 'lesson', 'restore' => 'lesson');
}
}

View file

@ -111,4 +111,16 @@ class essay_assessed extends \core\event\base {
throw new \coding_exception('The \'attemptid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_grades', 'restore' => 'lesson_grade');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson');
$othermapped['attemptid'] = array('db' => 'lesson_attempts', 'restore' => 'lesson_attept');
return $othermapped;
}
}

View file

@ -97,4 +97,8 @@ class essay_attempt_viewed extends \core\event\base {
throw new \coding_exception('The \'relateduserid\' must be set.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_attempts', 'restore' => 'lesson_attempt');
}
}

View file

@ -97,4 +97,16 @@ class group_override_created extends \core\event\base {
throw new \coding_exception('The \'groupid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_overrides', 'restore' => 'lesson_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson');
$othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group');
return $othermapped;
}
}

View file

@ -96,4 +96,16 @@ class group_override_deleted extends \core\event\base {
throw new \coding_exception('The \'groupid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_overrides', 'restore' => 'lesson_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson');
$othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group');
return $othermapped;
}
}

View file

@ -96,4 +96,16 @@ class group_override_updated extends \core\event\base {
throw new \coding_exception('The \'groupid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_overrides', 'restore' => 'lesson_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson');
$othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group');
return $othermapped;
}
}

View file

@ -111,4 +111,14 @@ class highscore_added extends \core\event\base {
throw new \coding_exception('The \'nickname\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
// The 'highscore' functionality was removed from core.
return false;
}
public static function get_other_mapping() {
// The 'highscore' functionality was removed from core.
return false;
}
}

View file

@ -87,4 +87,14 @@ class highscores_viewed extends \core\event\base {
return array($this->courseid, 'lesson', 'view highscores', 'highscores.php?id=' . $this->contextinstanceid,
$lesson->name, $this->contextinstanceid);
}
public static function get_objectid_mapping() {
// The 'highscore' functionality was removed from core.
return false;
}
public static function get_other_mapping() {
// The 'highscore' functionality was removed from core.
return false;
}
}

View file

@ -82,4 +82,8 @@ class lesson_ended extends \core\event\base {
return array($this->courseid, 'lesson', 'end', 'view.php?id=' . $this->contextinstanceid, $this->objectid,
$this->contextinstanceid);
}
public static function get_objectid_mapping() {
return array('db' => 'lesson', 'restore' => 'lesson');
}
}

View file

@ -72,4 +72,8 @@ class lesson_restarted extends \core\event\base {
return "The user with id '$this->userid' abandoned their previous incomplete attempt ".
"and started a new attempt on the lesson with course module id '$this->contextinstanceid'.";
}
public static function get_objectid_mapping() {
return array('db' => 'lesson', 'restore' => 'lesson');
}
}

View file

@ -72,4 +72,8 @@ class lesson_resumed extends \core\event\base {
return "The user with id '$this->userid' resumed their previous incomplete attempt on".
" the lesson with course module id '$this->contextinstanceid'.";
}
public static function get_objectid_mapping() {
return array('db' => 'lesson', 'restore' => 'lesson');
}
}

View file

@ -81,4 +81,8 @@ class lesson_started extends \core\event\base {
return array($this->courseid, 'lesson', 'start', 'view.php?id=' . $this->contextinstanceid,
$this->objectid, $this->contextinstanceid);
}
public static function get_objectid_mapping() {
return array('db' => 'lesson', 'restore' => 'lesson');
}
}

View file

@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die();
* The mod_lesson page_created event class.
*
* @property-read array $other {
* Extra information about event.
* Extra information about event.
*
* - string pagetype: the name of the pagetype as defined in the individual page class
* - string pagetype: the name of the pagetype as defined in the individual page class
* }
*
* @package mod_lesson
@ -95,4 +95,13 @@ class page_created extends \core\event\base {
throw new \coding_exception('The \'pagetype\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_pages', 'restore' => 'lesson_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die();
* The mod_lesson page_deleted event class.
*
* @property-read array $other {
* Extra information about event.
* Extra information about event.
*
* - string pagetype: the name of the pagetype as defined in the individual page class
* - string pagetype: the name of the pagetype as defined in the individual page class
* }
*
* @package mod_lesson
@ -95,4 +95,13 @@ class page_deleted extends \core\event\base {
throw new \coding_exception('The \'pagetype\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_pages', 'restore' => 'lesson_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -30,11 +30,11 @@ defined('MOODLE_INTERNAL') || die();
* The mod_lesson page_moved event class.
*
* @property-read array $other {
* Extra information about event.
* Extra information about event.
*
* - string pagetype: the name of the pagetype as defined in the individual page class
* - int prevpageid: the id of the previous lesson page
* - int nextpageid: the id of the next lesson page
* - string pagetype: the name of the pagetype as defined in the individual page class
* - int prevpageid: the id of the previous lesson page
* - int nextpageid: the id of the next lesson page
* }
*
* @package mod_lesson
@ -105,4 +105,16 @@ class page_moved extends \core\event\base {
throw new \coding_exception('The \'nextpageid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_pages', 'restore' => 'lesson_page');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['prevpageid'] = array('db' => 'lesson_pages', 'restore' => 'lesson_page');
$othermapped['nextpageid'] = array('db' => 'lesson_pages', 'restore' => 'lesson_page');
return $othermapped;
}
}

View file

@ -28,10 +28,11 @@ defined('MOODLE_INTERNAL') || die();
/**
* The mod_lesson page_updated event class.
* @property-read array $other {
* Extra information about event.
*
* - string pagetype: the name of the pagetype as defined in the individual page class
* @property-read array $other {
* Extra information about event.
*
* - string pagetype: the name of the pagetype as defined in the individual page class
* }
*
* @package mod_lesson
@ -113,4 +114,13 @@ class page_updated extends \core\event\base {
throw new \coding_exception('The \'pagetype\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_pages', 'restore' => 'lesson_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die();
* The mod_lesson question answered event class.
*
* @property-read array $other {
* Extra information about event.
* Extra information about event.
*
* - string pagetype: the name of the pagetype as defined in the individual page class
* - string pagetype: the name of the pagetype as defined in the individual page class
* }
*
* @package mod_lesson
@ -95,4 +95,13 @@ class question_answered extends \core\event\base {
throw new \coding_exception('The \'pagetype\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_pages', 'restore' => 'lesson_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die();
* The mod_lesson question viewed event class.
*
* @property-read array $other {
* Extra information about event.
* Extra information about event.
*
* - string pagetype: the name of the pagetype as defined in the individual page class
* - string pagetype: the name of the pagetype as defined in the individual page class
* }
*
* @package mod_lesson
@ -95,4 +95,13 @@ class question_viewed extends \core\event\base {
throw new \coding_exception('The \'pagetype\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_pages', 'restore' => 'lesson_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -95,4 +95,15 @@ class user_override_created extends \core\event\base {
throw new \coding_exception('The \'lessonid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_overrides', 'restore' => 'lesson_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson');
return $othermapped;
}
}

View file

@ -95,4 +95,15 @@ class user_override_deleted extends \core\event\base {
throw new \coding_exception('The \'lessonid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_overrides', 'restore' => 'lesson_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson');
return $othermapped;
}
}

View file

@ -96,4 +96,15 @@ class user_override_updated extends \core\event\base {
throw new \coding_exception('The \'lessonid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'lesson_overrides', 'restore' => 'lesson_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['lessonid'] = array('db' => 'lesson', 'restore' => 'lesson');
return $othermapped;
}
}