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

@ -126,4 +126,16 @@ class attempt_abandoned extends \core\event\base {
throw new \coding_exception('The \'submitterid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['submitterid'] = array('db' => 'user', 'restore' => 'user');
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

@ -128,4 +128,16 @@ class attempt_becameoverdue extends \core\event\base {
throw new \coding_exception('The \'submitterid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['submitterid'] = array('db' => 'user', 'restore' => 'user');
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
/**
* The mod_quiz attempt deleted event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int quizid: the id of the quiz.
* }
*
* @package mod_quiz
* @since Moodle 2.7
* @copyright 2014 Mark Nelson <markn@moodle.com>
@ -99,4 +105,15 @@ class attempt_deleted extends \core\event\base {
throw new \coding_exception('The \'quizid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

@ -106,4 +106,15 @@ class attempt_preview_started extends \core\event\base {
throw new \coding_exception('The \'quizid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

@ -105,4 +105,15 @@ class attempt_reviewed extends \core\event\base {
throw new \coding_exception('The \'quizid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

@ -27,6 +27,12 @@ defined('MOODLE_INTERNAL') || die();
/**
* The mod_quiz attempt started event class.
*
* @property-read array $other {
* Extra information about event.
*
* - int quizid: (optional) the id of the quiz.
* }
*
* @package mod_quiz
* @since Moodle 2.6
* @copyright 2013 Adrian Greeve <adrian@moodle.com>
@ -125,4 +131,15 @@ class attempt_started extends \core\event\base {
throw new \coding_exception('The \'relateduserid\' must be set.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

@ -126,4 +126,16 @@ class attempt_submitted extends \core\event\base {
throw new \coding_exception('The \'submitterid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['submitterid'] = array('db' => 'user', 'restore' => 'user');
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

@ -108,4 +108,15 @@ class attempt_summary_viewed extends \core\event\base {
throw new \coding_exception('The \'quizid\' must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

@ -106,4 +106,15 @@ class attempt_viewed extends \core\event\base {
throw new \coding_exception('The \'quizid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

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

View file

@ -101,4 +101,11 @@ class edit_page_viewed extends \core\event\base {
throw new \coding_exception('The \'quizid\' value must be set in other.');
}
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

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' => 'quiz_overrides', 'restore' => 'quiz_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
$othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group');
return $othermapped;
}
}

View file

@ -106,4 +106,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' => 'quiz_overrides', 'restore' => 'quiz_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
$othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group');
return $othermapped;
}
}

View file

@ -106,4 +106,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' => 'quiz_overrides', 'restore' => 'quiz_override');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
$othermapped['groupid'] = array('db' => 'groups', 'restore' => 'group');
return $othermapped;
}
}

View file

@ -111,6 +111,17 @@ class question_manually_graded extends \core\event\base {
if (!isset($this->other['slot'])) {
throw new \coding_exception('The \'slot\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'question', 'restore' => 'question');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
$othermapped['attemptid'] = array('db' => 'quiz_attempts', 'restore' => 'quiz_attempt');
return $othermapped;
}
}

View file

@ -109,4 +109,11 @@ class report_viewed extends \core\event\base {
throw new \coding_exception('The \'reportname\' value must be set in other.');
}
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['quizid'] = array('db' => 'quiz', 'restore' => 'quiz');
return $othermapped;
}
}

View file

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

View file

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

View file

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