MDL-43557 events: renamed event class names

1) The core 'item_tagged' class was renamed to 'tag_added'.
2) The core 'item_untagged' class was renamed to 'tag_removed'.
3) The core 'message_read' class was renamed to 'message_viewed'.
4) The mod_forum 'userreport_viewed' class was renamed to 'user_report_viewed'.
5) The report_outline 'activity_viewed' was renamed to 'activity_report_viewed'.
6) The report_outline 'outline_viewed' was renamed to 'report_viewed'.
This commit is contained in:
Mark Nelson 2014-04-17 15:52:34 -07:00
parent e692f58558
commit f3d981897e
16 changed files with 65 additions and 65 deletions

View File

@ -58,7 +58,7 @@ $string['eventmessagecontactadded'] = 'Message contact added';
$string['eventmessagecontactblocked'] = 'Message contact blocked';
$string['eventmessagecontactremoved'] = 'Message contact removed';
$string['eventmessagecontactunblocked'] = 'Message contact unblocked';
$string['eventmessageread'] = 'Message read';
$string['eventmessageviewed'] = 'Message viewed';
$string['eventmessagesent'] = 'Message sent';
$string['forced'] = 'Forced';
$string['formorethan'] = 'For more than';

View File

@ -36,11 +36,11 @@ $string['edittag'] = 'Edit this tag';
$string['entertags'] = 'Enter tags separated by commas';
$string['errortagfrontpage'] = 'Tagging the site main page is not allowed';
$string['errorupdatingrecord'] = 'Error updating tag record';
$string['eventitemtagged'] = 'Item tagged';
$string['eventitemuntagged'] = 'Item untagged';
$string['eventtagadded'] = 'Tag added to an item';
$string['eventtagcreated'] = 'Tag created';
$string['eventtagdeleted'] = 'Tag deleted';
$string['eventtagflagged'] = 'Tag flagged';
$string['eventtagremoved'] = 'Tag removed from an item';
$string['eventtagunflagged'] = 'Tag unflagged';
$string['eventtagupdated'] = 'Tag updated';
$string['flag'] = 'Flag';

View File

@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Message read event class.
* Message viewed event class.
*
* @property-read array $other {
* Extra information about event.
@ -32,7 +32,7 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
class message_read extends base {
class message_viewed extends base {
/**
* Init method.
@ -49,7 +49,7 @@ class message_read extends base {
* @return string
*/
public static function get_name() {
return get_string('eventmessageread', 'message');
return get_string('eventmessageviewed', 'message');
}
/**

View File

@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Item tagged event.
* Event for when a tag has been added to an item.
*
* @property-read array $other {
* Extra information about event.
@ -37,7 +37,7 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
class item_tagged extends base {
class tag_added extends base {
/**
* Initialise the event data.
@ -54,7 +54,7 @@ class item_tagged extends base {
* @return string
*/
public static function get_name() {
return get_string('eventitemtagged', 'tag');
return get_string('eventtagadded', 'tag');
}
/**

View File

@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Item untagged event.
* Event for when a tag has been removed from an item.
*
* @property-read array $other {
* Extra information about event.
@ -37,7 +37,7 @@ namespace core\event;
defined('MOODLE_INTERNAL') || die();
class item_untagged extends base {
class tag_removed extends base {
/**
* Initialise the event data.
@ -54,7 +54,7 @@ class item_untagged extends base {
* @return string
*/
public static function get_name() {
return get_string('eventitemuntagged', 'tag');
return get_string('eventtagremoved', 'tag');
}
/**

View File

@ -2378,7 +2378,7 @@ function message_mark_message_read($message, $timeread, $messageworkingempty=fal
$DB->delete_records('message', array('id' => $messageid));
// Trigger event for reading a message.
$event = \core\event\message_read::create(array(
$event = \core\event\message_viewed::create(array(
'objectid' => $messagereadid,
'userid' => $message->useridto, // Using the user who read the message as they are the ones performing the action.
'context' => context_user::instance($message->useridto),

View File

@ -179,9 +179,9 @@ class core_message_events_testcase extends advanced_testcase {
}
/**
* Test the message read event.
* Test the message viewed event.
*/
public function test_message_read() {
public function test_message_viewed() {
global $DB;
// Create a message to mark as read.
@ -199,7 +199,7 @@ class core_message_events_testcase extends advanced_testcase {
$event = reset($events);
// Check that the event data is valid.
$this->assertInstanceOf('\core\event\message_read', $event);
$this->assertInstanceOf('\core\event\message_viewed', $event);
$this->assertEquals(context_user::instance(2), $event->get_context());
$url = new moodle_url('/message/index.php', array('user1' => $event->userid, 'user2' => $event->relateduserid));
$this->assertEquals($url, $event->get_url());

View File

@ -37,7 +37,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class userreport_viewed extends \core\event\base {
class user_report_viewed extends \core\event\base {
/**
* Init method.

View File

@ -1083,9 +1083,9 @@ class mod_forum_events_testcase extends advanced_testcase {
}
/**
* Ensure userreport_viewed event validates that the reportmode is set.
* Ensure user_report_viewed event validates that the reportmode is set.
*/
public function test_userreport_viewed_reportmode_validation() {
public function test_user_report_viewed_reportmode_validation() {
$user = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
@ -1095,13 +1095,13 @@ class mod_forum_events_testcase extends advanced_testcase {
);
$this->setExpectedException('coding_exception', 'reportmode must be set in other.');
\mod_forum\event\userreport_viewed::create($params);
\mod_forum\event\user_report_viewed::create($params);
}
/**
* Ensure userreport_viewed event validates that the contextlevel is correct.
* Ensure user_report_viewed event validates that the contextlevel is correct.
*/
public function test_userreport_viewed_contextlevel_validation() {
public function test_user_report_viewed_contextlevel_validation() {
$user = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
$forum = $this->getDataGenerator()->create_module('forum', array('course' => $course->id));
@ -1113,13 +1113,13 @@ class mod_forum_events_testcase extends advanced_testcase {
);
$this->setExpectedException('coding_exception', 'Context passed must be system or course.');
\mod_forum\event\userreport_viewed::create($params);
\mod_forum\event\user_report_viewed::create($params);
}
/**
* Ensure userreport_viewed event validates that the relateduserid is set.
* Ensure user_report_viewed event validates that the relateduserid is set.
*/
public function test_userreport_viewed_relateduserid_validation() {
public function test_user_report_viewed_relateduserid_validation() {
$params = array(
'context' => context_system::instance(),
@ -1127,13 +1127,13 @@ class mod_forum_events_testcase extends advanced_testcase {
);
$this->setExpectedException('coding_exception', 'relateduserid must be set.');
\mod_forum\event\userreport_viewed::create($params);
\mod_forum\event\user_report_viewed::create($params);
}
/**
* Test the userreport_viewed event.
* Test the user_report_viewed event.
*/
public function test_userreport_viewed() {
public function test_user_report_viewed() {
// Setup test data.
$user = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
@ -1145,7 +1145,7 @@ class mod_forum_events_testcase extends advanced_testcase {
'other' => array('reportmode' => 'discussions'),
);
$event = \mod_forum\event\userreport_viewed::create($params);
$event = \mod_forum\event\user_report_viewed::create($params);
// Trigger and capture the event.
$sink = $this->redirectEvents();
@ -1155,7 +1155,7 @@ class mod_forum_events_testcase extends advanced_testcase {
$event = reset($events);
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_forum\event\userreport_viewed', $event);
$this->assertInstanceOf('\mod_forum\event\user_report_viewed', $event);
$this->assertEquals($context, $event->get_context());
$expected = array($course->id, 'forum', 'user report',
"user.php?id={$user->id}&amp;mode=discussions&amp;course={$course->id}", $user->id);

View File

@ -121,7 +121,7 @@ $params = array(
'relateduserid' => $user->id,
'other' => array('reportmode' => $mode),
);
$event = \mod_forum\event\userreport_viewed::create($params);
$event = \mod_forum\event\user_report_viewed::create($params);
$event->trigger();
// Get the posts by the requested user that the current user can access.

View File

@ -31,7 +31,7 @@ namespace report_outline\event;
* @copyright 2014 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class activity_viewed extends \core\event\base {
class activity_report_viewed extends \core\event\base {
/**
* Init method.

View File

@ -34,7 +34,7 @@ namespace report_outline\event;
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class outline_viewed extends \core\event\base {
class report_viewed extends \core\event\base {
/**
* Init method.

View File

@ -37,8 +37,8 @@ require_login($course);
$context = context_course::instance($course->id);
require_capability('report/outline:view', $context);
// Trigger a content view event.
$event = \report_outline\event\activity_viewed::create(array('context' => $context));
// Trigger an activity report viewed event.
$event = \report_outline\event\activity_report_viewed::create(array('context' => $context));
$event->trigger();
$showlastaccess = true;

View File

@ -65,7 +65,7 @@ $PAGE->set_title("$course->shortname: $stractivityreport");
$PAGE->set_heading($course->fullname);
// Trigger a report viewed event.
$event = \report_outline\event\outline_viewed::create(array('context' => context_course::instance($course->id),
$event = \report_outline\event\report_viewed::create(array('context' => context_course::instance($course->id),
'relateduserid' => $userid, 'other' => array('mode' => $mode)));
$event->trigger();

View File

@ -678,15 +678,15 @@ function tag_delete($tagids) {
if ($taginstances) {
// Save the system context in case the 'contextid' column in the 'tag_instance' table is null.
$syscontextid = context_system::instance()->id;
// Loop through the tag instances and fire an 'item_untagged' event.
// Loop through the tag instances and fire a 'tag_removed'' event.
foreach ($taginstances as $taginstance) {
// We can not fire an event with 'null' as the contextid.
if (is_null($taginstance->contextid)) {
$taginstance->contextid = $syscontextid;
}
// Trigger item untagged event.
$event = \core\event\item_untagged::create(array(
// Trigger tag removed event.
$event = \core\event\tag_removed::create(array(
'objectid' => $taginstance->id,
'contextid' => $taginstance->contextid,
'other' => array(
@ -757,15 +757,15 @@ function tag_delete_instances($component, $contextid = null) {
$DB->delete_records('tag_instance',$params);
// Save the system context in case the 'contextid' column in the 'tag_instance' table is null.
$syscontextid = context_system::instance()->id;
// Loop through the tag instances and fire an 'item_untagged' event.
// Loop through the tag instances and fire an 'tag_removed' event.
foreach ($taginstances as $taginstance) {
// We can not fire an event with 'null' as the contextid.
if (is_null($taginstance->contextid)) {
$taginstance->contextid = $syscontextid;
}
// Trigger item untagged event.
$event = \core\event\item_untagged::create(array(
// Trigger tag removed event.
$event = \core\event\tag_removed::create(array(
'objectid' => $taginstance->id,
'contextid' => $taginstance->contextid,
'other' => array(
@ -814,8 +814,8 @@ function tag_delete_instance($record_type, $record_id, $tagid, $userid = null) {
$taginstance->contextid = context_system::instance()->id;
}
// Trigger item untagged event.
$event = \core\event\item_untagged::create(array(
// Trigger tag removed event.
$event = \core\event\tag_removed::create(array(
'objectid' => $taginstance->id,
'contextid' => $taginstance->contextid,
'other' => array(
@ -1020,8 +1020,8 @@ function tag_assign($record_type, $record_id, $tagid, $ordering, $userid = 0, $c
$contextid = context_system::instance()->id;
}
// Trigger item tagged event.
$event = \core\event\item_tagged::create(array(
// Trigger tag added event.
$event = \core\event\tag_added::create(array(
'objectid' => $tag_instance_object->id,
'contextid' => $contextid,
'other' => array(

View File

@ -99,9 +99,9 @@ class core_tag_events_testcase extends advanced_testcase {
}
/**
* Test the item tagged event.
* Test the tag added event.
*/
public function test_item_tagged() {
public function test_tag_added() {
global $DB;
// Create a course to tag.
@ -113,9 +113,9 @@ class core_tag_events_testcase extends advanced_testcase {
$events = $sink->get_events();
$event = $events[1];
// Check that the course was tagged and that the event data is valid.
// Check that the tag was added to the course and that the event data is valid.
$this->assertEquals(1, $DB->count_records('tag_instance', array('component' => 'core')));
$this->assertInstanceOf('\core\event\item_tagged', $event);
$this->assertInstanceOf('\core\event\tag_added', $event);
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$expected = array($course->id, 'coursetags', 'add', 'tag/search.php?query=A+tag', 'Course tagged');
$this->assertEventLegacyLogData($expected, $event);
@ -132,18 +132,18 @@ class core_tag_events_testcase extends advanced_testcase {
$events = $sink->get_events();
$event = reset($events);
// Check that the question was tagged and the event data is valid.
// Check that the tag was added to the question and the event data is valid.
$this->assertEquals(1, $DB->count_records('tag_instance', array('component' => 'core')));
$this->assertInstanceOf('\core\event\item_tagged', $event);
$this->assertInstanceOf('\core\event\tag_added', $event);
$this->assertEquals(context_system::instance(), $event->get_context());
$expected = null;
$this->assertEventLegacyLogData($expected, $event);
}
/**
* Test the item untagged event.
* Test the tag removed event.
*/
public function test_item_untagged() {
public function test_tag_removed() {
global $DB;
$this->setAdminUser();
@ -169,9 +169,9 @@ class core_tag_events_testcase extends advanced_testcase {
$events = $sink->get_events();
$event = reset($events);
// Check that the course was untagged and the event data is valid.
// Check that the tag was removed from the course and the event data is valid.
$this->assertEquals(0, $DB->count_records('tag_instance'));
$this->assertInstanceOf('\core\event\item_untagged', $event);
$this->assertInstanceOf('\core\event\tag_removed', $event);
$this->assertEquals(context_course::instance($course->id), $event->get_context());
// Create the tag.
@ -186,9 +186,9 @@ class core_tag_events_testcase extends advanced_testcase {
$events = $sink->get_events();
$event = reset($events);
// Check that wiki page was untagged and the event data is valid.
// Check that tag was removed from the wiki page and the event data is valid.
$this->assertEquals(0, $DB->count_records('tag_instance'));
$this->assertInstanceOf('\core\event\item_untagged', $event);
$this->assertInstanceOf('\core\event\tag_removed', $event);
$this->assertEquals(context_module::instance($wiki->cmid), $event->get_context());
// Create a tag again - the other would have been deleted since there were no more instances associated with it.
@ -204,9 +204,9 @@ class core_tag_events_testcase extends advanced_testcase {
$events = $sink->get_events();
$event = reset($events);
// Check that wiki page was untagged and the event data is valid.
// Check that tag was removed from the wiki page and the event data is valid.
$this->assertEquals(0, $DB->count_records('tag_instance'));
$this->assertInstanceOf('\core\event\item_untagged', $event);
$this->assertInstanceOf('\core\event\tag_removed', $event);
$this->assertEquals(context_module::instance($wiki->cmid), $event->get_context());
// Create a tag again - the other would have been deleted since there were no more instances associated with it.
@ -221,9 +221,9 @@ class core_tag_events_testcase extends advanced_testcase {
$events = $sink->get_events();
$event = reset($events);
// Check that wiki page was untagged and the event data is valid.
// Check that tag was removed from the wiki page and the event data is valid.
$this->assertEquals(0, $DB->count_records('tag_instance'));
$this->assertInstanceOf('\core\event\item_untagged', $event);
$this->assertInstanceOf('\core\event\tag_removed', $event);
$this->assertEquals(context_module::instance($wiki->cmid), $event->get_context());
// Create another wiki.
@ -244,15 +244,15 @@ class core_tag_events_testcase extends advanced_testcase {
$event1 = reset($events);
$event2 = $events[1];
// Check that wiki pages were untagged.
// Check that the tags were removed from the wiki pages.
$this->assertEquals(0, $DB->count_records('tag_instance'));
// Check the first event data is valid.
$this->assertInstanceOf('\core\event\item_untagged', $event1);
$this->assertInstanceOf('\core\event\tag_removed', $event1);
$this->assertEquals(context_module::instance($wiki->cmid), $event1->get_context());
// Check that the second event data is valid.
$this->assertInstanceOf('\core\event\item_untagged', $event2);
$this->assertInstanceOf('\core\event\tag_removed', $event2);
$this->assertEquals(context_module::instance($wiki2->cmid), $event2->get_context());
}