Conflicts:
	lib/classes/event/user_deleted.php
This commit is contained in:
Marina Glancy 2013-11-01 13:04:29 +11:00
commit 1637827d75
12 changed files with 29 additions and 23 deletions

View File

@ -265,8 +265,7 @@ class blog_entry implements renderable {
// Trigger an event for the new entry.
$event = \core\event\blog_entry_created::create(array(
'objectid' => $this->id,
'relateduserid' => $this->userid,
'other' => array('subject' => $this->subject)
'relateduserid' => $this->userid
));
$event->set_custom_data($this);
$event->trigger();
@ -308,8 +307,7 @@ class blog_entry implements renderable {
$event = \core\event\blog_entry_updated::create(array(
'objectid' => $entry->id,
'relateduserid' => $entry->userid,
'other' => array('subject' => $entry->subject)
'relateduserid' => $entry->userid
));
$event->set_custom_data($entry);
$event->trigger();
@ -333,9 +331,8 @@ class blog_entry implements renderable {
$event = \core\event\blog_entry_deleted::create(array(
'objectid' => $this->id,
'relateduserid' => $this->userid,
'other' => array('record' => (array) $record)
));
'relateduserid' => $this->userid
));
$event->add_record_snapshot("post", $record);
$event->set_custom_data($this);
$event->trigger();

View File

@ -55,7 +55,7 @@ class blog_entry_created extends \core\event\base {
*
* @param \blog_entry $data A reference to the active blog_entry object.
*/
public function set_custom_data($data) {
public function set_custom_data(\blog_entry $data) {
$this->customobject = $data;
}
@ -74,7 +74,7 @@ class blog_entry_created extends \core\event\base {
* @return string
*/
public function get_description() {
return 'Blog entry "'. $this->other['subject']. '" was created by user with id '. $this->userid;
return 'Blog entry id '. $this->objectid. ' was created by userid '. $this->userid;
}
/**

View File

@ -63,7 +63,7 @@ class blog_entry_deleted extends \core\event\base {
*
* @param \blog_entry $data A reference to the active blog_entry object.
*/
public function set_custom_data($data) {
public function set_custom_data(\blog_entry $data) {
$this->customobject = $data;
}
@ -73,7 +73,7 @@ class blog_entry_deleted extends \core\event\base {
* @return string
*/
public function get_description() {
return "Blog entry ".$this->other['record']['subject']." was deleted by user with id ".$this->userid;
return 'Blog entry id '. $this->objectid. ' was deleted by userid '. $this->userid;
}
/**

View File

@ -53,7 +53,7 @@ class blog_entry_updated extends base {
*
* @param \blog_entry $data A reference to the active blog_entry object.
*/
public function set_custom_data($data) {
public function set_custom_data(\blog_entry $data) {
$this->customobject = $data;
}
@ -72,7 +72,7 @@ class blog_entry_updated extends base {
* @return string
*/
public function get_description() {
return 'User with id {$this->userid} updated blog entry {$this->other["subject"]';
return 'Blog entry id '. $this->objectid. ' was updated by userid '. $this->userid;
}
/**
@ -108,7 +108,7 @@ class blog_entry_updated extends base {
*/
protected function get_legacy_logdata() {
return array(SITEID, 'blog', 'update', 'index.php?userid=' . $this->relateduserid . '&entryid=' . $this->objectid,
$this->other['subject']);
$this->customobject->subject);
}
}

View File

@ -87,7 +87,7 @@ abstract class content_viewed extends base {
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' viewed content ' . $this->get_url();
return 'User with id ' . $this->userid . ' viewed content';
}
/**

View File

@ -60,8 +60,8 @@ class course_module_created extends base {
* @return string
*/
public function get_description() {
return 'The '. $this->other['modulename'] . ' module ' . $this->other['name']. ' was created by user with id '.
$this->userid;
return 'The '. $this->other['modulename'] . ' module with instance id ' . $this->other['instanceid'] .
' was created by user with id ' . $this->userid;
}
/**

View File

@ -60,8 +60,8 @@ class course_module_updated extends base {
* @return string
*/
public function get_description() {
return 'The ' . $this->other['modulename'] . ' module ' . $this->other['name']. ' was updated by user with id '.
$this->userid;
return 'The ' . $this->other['modulename'] . ' module with instance id ' . $this->other['instanceid'] .
' was updated by user with id ' . $this->userid;
}
/**

View File

@ -59,7 +59,7 @@ class user_deleted extends base {
*/
public function get_description() {
$user = $this->get_record_snapshot('user', $this->data['objectid']);
return 'User profile deleted for user '.$user->firstname.' '.$user->lastname.' id ('.$user->id.')';
return 'User profile deleted for userid ' . $user->id;
}
/**

View File

@ -40,7 +40,7 @@ class course_module_viewed extends \core\event\content_viewed {
* @return string
*/
public function get_description() {
return "The user $this->userid has viewed the book $this->objectid.";
return 'User with id ' . $this->userid . ' viewed book activity with instance id ' . $this->objectid;
}
/**

View File

@ -52,6 +52,15 @@ class course_module_viewed extends \core\event\content_viewed {
return get_string('event_choice_viewed', 'choice');
}
/**
* Returns non-localised description of what happened.
*
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' viewed choice activity with instance id ' . $this->objectid;
}
/**
* Returns relevant URL.
* @return \moodle_url

View File

@ -49,7 +49,7 @@ class course_module_viewed extends \core\event\content_viewed {
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' viewed page resource with instanceid ' . $this->objectid;
return 'User with id ' . $this->userid . ' viewed page resource with instance id ' . $this->objectid;
}
/**

View File

@ -58,7 +58,7 @@ class course_module_viewed extends \core\event\content_viewed {
* @return string
*/
public function get_description() {
return 'User with id ' . $this->userid . ' viewed content ' . $this->get_url() . ' In phase ' . $this->other['content'];
return 'User with id ' . $this->userid . ' viewed workshop activity with instance id ' . $this->objectid;
}
/**