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

@ -73,4 +73,8 @@ class comments_viewed extends \core\event\comments_viewed {
public function get_url() {
return new \moodle_url('/mod/wiki/comments.php', array('pageid' => $this->objectid));
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
}

View file

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

View file

@ -82,4 +82,8 @@ class page_created extends \core\event\base {
public function get_url() {
return new \moodle_url('/mod/wiki/view.php', array('pageid' => $this->objectid));
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
}

View file

@ -88,4 +88,15 @@ class page_deleted extends \core\event\base {
public function get_url() {
return new \moodle_url('/mod/wiki/admin.php', array('pageid' => $this->objectid));
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['subwikiid'] = array('db' => 'wiki_subwikis', 'restore' => 'wiki_subwiki');
return $othermapped;
}
}

View file

@ -110,4 +110,13 @@ class page_diff_viewed extends \core\event\base {
throw new \coding_exception('The \'compare\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -82,4 +82,8 @@ class page_history_viewed extends \core\event\base {
public function get_url() {
return new \moodle_url('/mod/wiki/history.php', array('pageid' => $this->objectid));
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
}

View file

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
* - int section: (optional) section id.
* - string section: (optional) section name.
* }
*
* @package mod_wiki
@ -88,4 +88,13 @@ class page_locks_deleted extends \core\event\base {
public function get_url() {
return new \moodle_url('/mod/wiki/view.php', array('pageid' => $this->objectid));
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -101,4 +101,13 @@ class page_map_viewed extends \core\event\base {
throw new \coding_exception('The \'option\' value must be set in other, even if 0.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -88,4 +88,13 @@ class page_updated extends \core\event\base {
public function get_url() {
return new \moodle_url('/mod/wiki/view.php', array('pageid' => $this->objectid));
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
public static function get_other_mapping() {
// Nothing to map.
return false;
}
}

View file

@ -101,4 +101,15 @@ class page_version_deleted extends \core\event\base {
throw new \coding_exception('The \'pageid\' value must be set in other.');
}
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_versions', 'restore' => 'wiki_version');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['pageid'] = array('db' => 'wiki_pages', 'restore' => 'wiki_page');
return $othermapped;
}
}

View file

@ -102,4 +102,15 @@ class page_version_restored extends \core\event\base {
throw new \coding_exception('The pageid needs to be set in $other');
}
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_versions', 'restore' => 'wiki_version');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['pageid'] = array('db' => 'wiki_pages', 'restore' => 'wiki_page');
return $othermapped;
}
}

View file

@ -103,4 +103,15 @@ class page_version_viewed extends \core\event\base {
throw new \coding_exception('The versionid need to be set in $other');
}
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
public static function get_other_mapping() {
$othermapped = array();
$othermapped['versionid'] = array('db' => 'wiki_versions', 'restore' => 'wiki_version');
return $othermapped;
}
}

View file

@ -102,4 +102,8 @@ class page_viewed extends \core\event\base {
return new \moodle_url('/mod/wiki/view.php', array('pageid' => $this->objectid));
}
}
public static function get_objectid_mapping() {
return array('db' => 'wiki_pages', 'restore' => 'wiki_page');
}
}