Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
02a5a4b2
Commit
02a5a4b2
authored
Apr 23, 2014
by
Mark Nelson
Browse files
MDL-43557 events: fixed minor issues in existing events
parent
4d9c1b57
Changes
319
Hide whitespace changes
Inline
Side-by-side
admin/tool/capability/classes/event/report_viewed.php
View file @
02a5a4b2
...
...
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
Event for when
capability report
is
viewed.
*
The tool_
capability report viewed
event
.
*
* @package tool_capability
* @copyright 2014 Petr Skoda
...
...
@@ -24,7 +24,7 @@
namespace
tool_capability\event
;
/**
*
Event triggered, when
capability report
is
viewed.
*
The tool_
capability report viewed
event class
.
*
* @package tool_capability
* @since Moodle 2.7
...
...
@@ -59,7 +59,7 @@ class report_viewed extends \core\event\base {
* @return string
*/
public
function
get_description
()
{
return
"The user with
id "
.
$this
->
userid
.
"
viewed capability overview report"
;
return
"The user with
the id '
$this->userid
'
viewed
the
capability overview report
.
"
;
}
/**
...
...
badges/classes/observer.php
View file @
02a5a4b2
...
...
@@ -81,7 +81,7 @@ class core_badges_observer {
require_once
(
$CFG
->
dirroot
.
'/lib/badgeslib.php'
);
$eventdata
=
$event
->
get_record_snapshot
(
'course_completions'
,
$event
->
objectid
);
$userid
=
$event
->
other
[
'
relateduserid
'
]
;
$userid
=
$event
->
relateduserid
;
$courseid
=
$event
->
courseid
;
// Need to take into account that course can be a part of course_completion and courseset_completion criteria.
...
...
blog/tests/bloglib_test.php
View file @
02a5a4b2
...
...
@@ -328,7 +328,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid'
=>
3
,
'other'
=>
array
(
'associateid'
=>
2
,
'blogid'
=>
3
,
'subject'
=>
'blog subject'
)));
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
'
Invalid
associatetype'
,
$e
->
getMessage
());
$this
->
assertContains
(
'
The \'
associatetype
\' value must be set in other and be a valid type.
'
,
$e
->
getMessage
());
}
try
{
\
core\event\blog_association_created
::
create
(
array
(
...
...
@@ -336,7 +336,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid'
=>
3
,
'other'
=>
array
(
'associateid'
=>
2
,
'blogid'
=>
3
,
'associatetype'
=>
'random'
,
'subject'
=>
'blog subject'
)));
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
'
Invalid
associatetype'
,
$e
->
getMessage
());
$this
->
assertContains
(
'
The \'
associatetype
\' value must be set in other and be a valid type.
'
,
$e
->
getMessage
());
}
// Make sure associateid validations work.
try
{
...
...
@@ -345,7 +345,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid'
=>
3
,
'other'
=>
array
(
'blogid'
=>
3
,
'associatetype'
=>
'course'
,
'subject'
=>
'blog subject'
)));
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
'
A
ssociate
id must be set'
,
$e
->
getMessage
());
$this
->
assertContains
(
'
The \'a
ssociateid
\' value
must be set
in other.
'
,
$e
->
getMessage
());
}
// Make sure blogid validations work.
try
{
...
...
@@ -354,7 +354,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid'
=>
3
,
'other'
=>
array
(
'associateid'
=>
3
,
'associatetype'
=>
'course'
,
'subject'
=>
'blog subject'
)));
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
'
B
log
id must be set'
,
$e
->
getMessage
());
$this
->
assertContains
(
'
The \'b
logid
\' value
must be set
in other.
'
,
$e
->
getMessage
());
}
// Make sure blogid validations work.
try
{
...
...
@@ -363,7 +363,7 @@ class core_bloglib_testcase extends advanced_testcase {
'objectid'
=>
3
,
'other'
=>
array
(
'blogid'
=>
3
,
'associateid'
=>
3
,
'associatetype'
=>
'course'
)));
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
'
Subject
must be set'
,
$e
->
getMessage
());
$this
->
assertContains
(
'
The \'subject\' value
must be set
in other.
'
,
$e
->
getMessage
());
}
}
...
...
calendar/tests/event_test.php
→
calendar/tests/event
s
_test.php
View file @
02a5a4b2
...
...
@@ -33,7 +33,7 @@ require_once($CFG->dirroot . '/calendar/tests/externallib_test.php');
* @copyright 2014 Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
core_calendar_event_testcase
extends
advanced_testcase
{
class
core_calendar_event
s
_testcase
extends
advanced_testcase
{
/**
* The test user.
...
...
@@ -126,7 +126,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_created to be triggered without
other['repeatid']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other[
'repeatid
']
must be set
"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \
'repeatid
\' value
must be set
in other.'
,
$e
->
getMessage
());
}
// Test not setting other['name'].
...
...
@@ -142,7 +142,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_created to be triggered without
other['name']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other['name'] cannot be empty"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \'name\' value must be set in other.'
,
$e
->
getMessage
());
}
// Test not setting other['timestart'].
...
...
@@ -158,7 +158,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_deleted to be triggered without
other['timestart']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other['timestart'] cannot be empty"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \'timestart\' value must be set in other.'
,
$e
->
getMessage
());
}
}
...
...
@@ -239,7 +239,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_updated to be triggered without
other['repeatid']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other[
'repeatid
']
must be set
"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \
'repeatid
\' value
must be set
in other.'
,
$e
->
getMessage
());
}
// Test not setting other['name'].
...
...
@@ -255,7 +255,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_updated to be triggered without
other['name']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other['name'] cannot be empty"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \'name\' value must be set in other.'
,
$e
->
getMessage
());
}
// Test not setting other['timestart'].
...
...
@@ -271,7 +271,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_deleted to be triggered without
other['timestart']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other['timestart'] cannot be empty"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \'timestart\' value must be set in other.'
,
$e
->
getMessage
());
}
}
...
...
@@ -351,7 +351,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_deleted to be triggered without
other['repeatid']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other[
'repeatid
']
must be set
"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \
'repeatid
\' value
must be set
in other.'
,
$e
->
getMessage
());
}
// Test not setting other['name'].
...
...
@@ -367,7 +367,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_deleted to be triggered without
other['name']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other['name'] cannot be empty"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \'name\' value must be set in other.'
,
$e
->
getMessage
());
}
// Test not setting other['timestart'].
...
...
@@ -383,7 +383,7 @@ class core_calendar_event_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
calendar_event_deleted to be triggered without
other['timestart']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"Field other['timestart'] cannot be empty"
,
$e
->
getMessage
());
$this
->
assertContains
(
'The \'timestart\' value must be set in other.'
,
$e
->
getMessage
());
}
}
}
completion/completion_completion.php
View file @
02a5a4b2
...
...
@@ -165,9 +165,9 @@ class completion_completion extends data_object {
array
(
'objectid'
=>
$data
->
id
,
'userid'
=>
$USER
->
id
,
'relateduserid'
=>
$data
->
userid
,
'context'
=>
context_course
::
instance
(
$data
->
course
),
'courseid'
=>
$data
->
course
,
'other'
=>
array
(
'relateduserid'
=>
$data
->
userid
)
'courseid'
=>
$data
->
course
)
);
$event
->
add_record_snapshot
(
'course_completions'
,
$data
);
...
...
course/tests/courselib_test.php
View file @
02a5a4b2
...
...
@@ -2014,7 +2014,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
course_module_created to be triggered without
other['instanceid']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"
Field other['instanceid'] cannot be empty
"
,
$e
->
getMessage
());
$this
->
assertContains
(
"
The 'instanceid' value must be set in other.
"
,
$e
->
getMessage
());
}
// Test not setting modulename.
...
...
@@ -2031,7 +2031,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
course_module_created to be triggered without
other['modulename']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"
Field other['modulename'] cannot be empty
"
,
$e
->
getMessage
());
$this
->
assertContains
(
"
The 'modulename' value must be set in other.
"
,
$e
->
getMessage
());
}
// Test not setting name.
...
...
@@ -2049,7 +2049,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
course_module_created to be triggered without
other['name']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"
Field other['name'] cannot be empty
"
,
$e
->
getMessage
());
$this
->
assertContains
(
"
The 'name' value must be set in other.
"
,
$e
->
getMessage
());
}
}
...
...
@@ -2166,7 +2166,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
course_module_updated to be triggered without
other['instanceid']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"
Field other['instanceid'] cannot be empty
"
,
$e
->
getMessage
());
$this
->
assertContains
(
"
The 'instanceid' value must be set in other.
"
,
$e
->
getMessage
());
}
// Test not setting modulename.
...
...
@@ -2183,7 +2183,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
course_module_updated to be triggered without
other['modulename']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"
Field other['modulename'] cannot be empty
"
,
$e
->
getMessage
());
$this
->
assertContains
(
"
The 'modulename' value must be set in other.
"
,
$e
->
getMessage
());
}
// Test not setting name.
...
...
@@ -2201,7 +2201,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
course_module_updated to be triggered without
other['name']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"
Field other['name'] cannot be empty
"
,
$e
->
getMessage
());
$this
->
assertContains
(
"
The 'name' value must be set in other.
"
,
$e
->
getMessage
());
}
}
...
...
@@ -2269,7 +2269,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
course_module_deleted to be triggered without
other['instanceid']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"
Field other['instanceid'] cannot be empty
"
,
$e
->
getMessage
());
$this
->
assertContains
(
"
The 'instanceid' value must be set in other.
"
,
$e
->
getMessage
());
}
// Test not setting modulename.
...
...
@@ -2286,7 +2286,7 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
fail
(
"Event validation should not allow
\\
core
\\
event
\\
course_module_deleted to be triggered without
other['modulename']"
);
}
catch
(
coding_exception
$e
)
{
$this
->
assertContains
(
"
Field other['modulename'] cannot be empty
"
,
$e
->
getMessage
());
$this
->
assertContains
(
"
The 'modulename' value must be set in other.
"
,
$e
->
getMessage
());
}
}
...
...
@@ -2468,8 +2468,6 @@ class core_course_courselib_testcase extends advanced_testcase {
$this
->
assertEquals
(
null
,
$event
->
objectid
);
$this
->
assertEquals
(
$course
->
id
,
$event
->
courseid
);
$this
->
assertEquals
(
$coursecontext
->
id
,
$event
->
contextid
);
$expecteddesc
=
"User with id '
$event->userid
' viewed list of resources in course with id '
$event->courseid
'"
;
$this
->
assertEquals
(
$expecteddesc
,
$event
->
get_description
());
$expectedlegacydata
=
array
(
array
(
$course
->
id
,
"book"
,
"view all"
,
'index.php?id='
.
$course
->
id
,
''
),
array
(
$course
->
id
,
"page"
,
"view all"
,
'index.php?id='
.
$course
->
id
,
''
),
...
...
lib/accesslib.php
View file @
02a5a4b2
...
...
@@ -1756,9 +1756,16 @@ function role_assign($roleid, $userid, $contextid, $component = '', $itemid = 0,
reload_all_capabilities
();
}
$event
=
\
core\event\role_assigned
::
create
(
array
(
'context'
=>
$context
,
'objectid'
=>
$ra
->
roleid
,
'relateduserid'
=>
$ra
->
userid
,
'other'
=>
array
(
'id'
=>
$ra
->
id
,
'component'
=>
$ra
->
component
,
'itemid'
=>
$ra
->
itemid
)));
$event
=
\
core\event\role_assigned
::
create
(
array
(
'context'
=>
$context
,
'objectid'
=>
$ra
->
roleid
,
'relateduserid'
=>
$ra
->
userid
,
'other'
=>
array
(
'id'
=>
$ra
->
id
,
'component'
=>
$ra
->
component
,
'itemid'
=>
$ra
->
itemid
)
));
$event
->
add_record_snapshot
(
'role_assignments'
,
$ra
);
$event
->
trigger
();
...
...
@@ -1844,9 +1851,16 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual =
if
(
!
empty
(
$USER
->
id
)
&&
$USER
->
id
==
$ra
->
userid
)
{
reload_all_capabilities
();
}
$event
=
\
core\event\role_unassigned
::
create
(
array
(
'context'
=>
$context
,
'objectid'
=>
$ra
->
roleid
,
'relateduserid'
=>
$ra
->
userid
,
'other'
=>
array
(
'id'
=>
$ra
->
id
,
'component'
=>
$ra
->
component
,
'itemid'
=>
$ra
->
itemid
)));
$event
=
\
core\event\role_unassigned
::
create
(
array
(
'context'
=>
$context
,
'objectid'
=>
$ra
->
roleid
,
'relateduserid'
=>
$ra
->
userid
,
'other'
=>
array
(
'id'
=>
$ra
->
id
,
'component'
=>
$ra
->
component
,
'itemid'
=>
$ra
->
itemid
)
));
$event
->
add_record_snapshot
(
'role_assignments'
,
$ra
);
$event
->
trigger
();
}
...
...
lib/classes/event/assessable_submitted.php
View file @
02a5a4b2
...
...
@@ -41,7 +41,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract
class
assessable_submitted
extends
\
core\event\
base
{
abstract
class
assessable_submitted
extends
base
{
/**
* Init method.
...
...
lib/classes/event/assessable_uploaded.php
View file @
02a5a4b2
...
...
@@ -39,8 +39,8 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
*
@type
array pathnamehashes uploaded files path name hashes.
*
@type
string content
string
.
*
-
array pathnamehashes
:
uploaded files path name hashes.
*
-
string content
: the content
.
* }
*
* @package core
...
...
@@ -48,7 +48,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Frédéric Massart
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract
class
assessable_uploaded
extends
\
core\event\
base
{
abstract
class
assessable_uploaded
extends
base
{
/**
* Init method.
...
...
@@ -69,11 +69,11 @@ abstract class assessable_uploaded extends \core\event\base {
protected
function
validate_data
()
{
parent
::
validate_data
();
if
(
$this
->
contextlevel
!=
CONTEXT_MODULE
)
{
throw
new
\
coding_exception
(
'Context
passed
must be
module context
.'
);
throw
new
\
coding_exception
(
'Context
level
must be
CONTEXT_MODULE
.'
);
}
else
if
(
!
isset
(
$this
->
other
[
'pathnamehashes'
])
||
!
is_array
(
$this
->
other
[
'pathnamehashes'
]))
{
throw
new
\
coding_exception
(
'pathnamehashes must be set in
$
other and must be an array.'
);
throw
new
\
coding_exception
(
'
The \'
pathnamehashes
\' value
must be set in other and must be an array.'
);
}
else
if
(
!
isset
(
$this
->
other
[
'content'
])
||
!
is_string
(
$this
->
other
[
'content'
]))
{
throw
new
\
coding_exception
(
'content must be set in
$
other and must be a string.'
);
throw
new
\
coding_exception
(
'
The \'
content
\' value
must be set in other and must be a string.'
);
}
}
...
...
lib/classes/event/blog_association_created.php
View file @
02a5a4b2
...
...
@@ -32,10 +32,10 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other {
* Extra information about event.
*
*
@type
string associatetype type of blog association, course/coursemodule.
*
@type
int blogid id of blog.
*
@type
int associateid id of associate.
*
@type
string subject blog subject.
*
-
string associatetype
:
type of blog association, course/coursemodule.
*
-
int blogid
:
id of blog.
*
-
int associateid
:
id of associate.
*
-
string subject
:
blog subject.
* }
*
* @package core
...
...
@@ -43,7 +43,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 onwards Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
blog_association_created
extends
\
core\event\
base
{
class
blog_association_created
extends
base
{
/**
* Set basic properties for the event.
...
...
@@ -70,8 +70,8 @@ class blog_association_created extends \core\event\base {
* @return string
*/
public
function
get_description
()
{
return
"
Blog association added between entry
id
{
$this
->
other
[
'blogid'
]
}
and
{
$this
->
other
[
'associatetype'
]
}
with
id
{
$this
->
other
[
'associateid'
]
}
"
;
return
"
The blog entry with the
id
'
{
$this
->
other
[
'blogid'
]
}
' was associated with the context '
{
$this
->
other
[
'associatetype'
]
}
'
with
"
.
"the id '
{
$this
->
other
[
'associateid'
]
}
' by the user with the id '
$this->userid
'.
"
;
}
/**
...
...
@@ -91,10 +91,10 @@ class blog_association_created extends \core\event\base {
if
(
$this
->
other
[
'associatetype'
]
===
'course'
)
{
return
array
(
SITEID
,
'blog'
,
'add association'
,
'index.php?userid='
.
$this
->
relateduserid
.
'&entryid='
.
$this
->
other
[
'blogid'
],
$this
->
other
[
'subject'
],
0
,
$this
->
relateduserid
);
}
else
{
return
array
(
SITEID
,
'blog'
,
'add association'
,
'index.php?userid='
.
$this
->
relateduserid
.
'&entryid='
.
$this
->
other
[
'blogid'
],
$this
->
other
[
'subject'
],
$this
->
other
[
'associateid'
],
$this
->
relateduserid
);
}
return
array
(
SITEID
,
'blog'
,
'add association'
,
'index.php?userid='
.
$this
->
relateduserid
.
'&entryid='
.
$this
->
other
[
'blogid'
],
$this
->
other
[
'subject'
],
$this
->
other
[
'associateid'
],
$this
->
relateduserid
);
}
/**
...
...
@@ -105,15 +105,16 @@ class blog_association_created extends \core\event\base {
*/
protected
function
validate_data
()
{
parent
::
validate_data
();
if
(
empty
(
$this
->
other
[
'associatetype'
])
||
(
$this
->
other
[
'associatetype'
]
!==
'course'
&&
$this
->
other
[
'associatetype'
]
!==
'coursemodule'
))
{
throw
new
\
coding_exception
(
'
Invalid
associatetype
in event blog_association_created
.'
);
throw
new
\
coding_exception
(
'
The \'
associatetype
\' value must be set in other and be a valid type
.'
);
}
else
if
(
!
isset
(
$this
->
other
[
'blogid'
]))
{
throw
new
\
coding_exception
(
'
B
log
id must be set in
event blog_association_created
.'
);
throw
new
\
coding_exception
(
'
The \'b
logid
\' value
must be set in
other
.'
);
}
else
if
(
!
isset
(
$this
->
other
[
'associateid'
]))
{
throw
new
\
coding_exception
(
'
A
ssociate
id must be set in
event blog_association_created
.'
);
throw
new
\
coding_exception
(
'
The \'a
ssociateid
\' value
must be set in
other
.'
);
}
else
if
(
!
isset
(
$this
->
other
[
'subject'
]))
{
throw
new
\
coding_exception
(
'
Subject must be set in event blog_association_created
.'
);
throw
new
\
coding_exception
(
'
The \'subject\' value must be set in other
.'
);
}
}
}
lib/classes/event/blog_comment_created.php
View file @
02a5a4b2
...
...
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* blog comment created event.
*
The
blog comment created event.
*
* @package core
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
...
...
@@ -26,14 +26,15 @@ namespace core\event;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
* blog comment created event.
*
The
blog comment created event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
blog_comment_created
extends
\
core\event\comment_created
{
class
blog_comment_created
extends
comment_created
{
/**
* Get URL related to the action.
*
...
...
@@ -49,6 +50,6 @@ class blog_comment_created extends \core\event\comment_created {
* @return string
*/
public
function
get_description
()
{
return
'U
ser with id '
.
$this
->
userid
.
' added comment
for
blog with id '
.
$this
->
other
[
'itemid'
];
return
"The u
ser with
the
id '
$this->userid
' added
a
comment
to the
blog with
the
id '
{
$this
->
other
[
'itemid'
]
}
'."
;
}
}
lib/classes/event/blog_comment_deleted.php
View file @
02a5a4b2
...
...
@@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* blog comment deleted event.
*
The
blog comment deleted event.
*
* @package core
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
...
...
@@ -26,14 +26,15 @@ namespace core\event;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
* blog comment deleted event.
*
The
blog comment deleted event.
*
* @package core
* @since Moodle 2.7
* @copyright 2013 Rajesh Taneja <rajesh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
blog_comment_deleted
extends
\
core\event\comment_deleted
{
class
blog_comment_deleted
extends
comment_deleted
{
/**
* Get URL related to the action.
*
...
...
@@ -49,6 +50,6 @@ class blog_comment_deleted extends \core\event\comment_deleted {
* @return string
*/
public
function
get_description
()
{
return
'U
ser with id '
.
$this
->
userid
.
' deleted comment for blog with id '
.
$this
->
other
[
'itemid'
];
return
"The u
ser with
the
id '
$this->userid
' deleted comment for
the
blog with
the
id '
{
$this
->
other
[
'itemid'
]
}
'."
;
}
}
lib/classes/event/blog_entries_viewed.php
View file @
02a5a4b2
...
...
@@ -25,14 +25,12 @@ namespace core\event;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
* blog_entries_viewed
*
* Class for event to be triggered when blog entries are viewed.
*
* @property-read array $other {
* Extra information about event.
*
*
@type
int courseid id of associated course.
*
-
int courseid
:
id of associated course.
* }
*
* @package core
...
...
lib/classes/event/blog_entry_created.php
View file @
02a5a4b2
...
...
@@ -14,10 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace
core\event
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
* Event for when a new blog entry is added..
*
...
...
@@ -26,6 +22,10 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace
core\event
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
* Class blog_entry_created
*
...
...
@@ -36,7 +36,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2013 Ankit Agarwal
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
blog_entry_created
extends
\
core\event\
base
{
class
blog_entry_created
extends
base
{
/** @var \blog_entry A reference to the active blog_entry object. */
protected
$blogentry
;
...
...
@@ -54,7 +54,7 @@ class blog_entry_created extends \core\event\base {
/**
* Set blog_entry object to be used by observers.
*
* @param \blog_entry $
data
A reference to the active blog_entry object.
* @param \blog_entry $
blogentry
A reference to the active blog_entry object.
*/
public
function
set_blog_entry
(
\
blog_entry
$blogentry
)
{
$this
->
blogentry
=
$blogentry
;
...
...
@@ -63,6 +63,7 @@ class blog_entry_created extends \core\event\base {
/**
* Returns created blog_entry object for event observers.
*
* @throws \coding_exception
* @return \blog_entry
*/
public
function
get_blog_entry
()
{
...
...
@@ -78,7 +79,7 @@ class blog_entry_created extends \core\event\base {
* @return string
*/
public
static
function
get_name
()
{
return
get_string
(
"
evententryadded
"
,
"
core_blog
"
);
return
get_string
(
'
evententryadded
'
,
'
core_blog
'
);
}
/**
...
...
@@ -87,7 +88,7 @@ class blog_entry_created extends \core\event\base {
* @return string
*/
public
function
get_description
()
{
return
'B
log entry id '
.
$this
->
objectid
.
' was created by
user
id '
.
$this
->
userid
;
return
"The b
log entry
with the
id '
$this->objectid
' was created by
the user with the
id '
$this->userid
'."
;
}
/**
...
...
@@ -117,12 +118,12 @@ class blog_entry_created extends \core\event\base {
}
/**
*
r
eplace add_to_log() statement.
*
R
eplace add_to_log() statement.
*
* @return array of parameters to be passed to legacy add_to_log() function.
*/
protected
function
get_legacy_logdata
()
{
return
array
(
SITEID
,
'blog'
,
'add'
,
'index.php?userid='
.
$this
->
relateduserid
.
'&entryid='
.
$this
->
objectid
,
$this
->
blogentry
->
subject
);
$this
->
blogentry
->
subject
);
}
}
lib/classes/event/blog_entry_deleted.php
View file @
02a5a4b2
...
...
@@ -25,7 +25,7 @@ namespace core\event;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
*
c
lass blog_entry_deleted
*
C
lass blog_entry_deleted
*
* Event for when a new blog entry is deleted.
*
...
...
@@ -35,9 +35,9 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
blog_entry_deleted
extends
\
core\event\
base
{
class
blog_entry_deleted
extends
base
{
/** @var
\blog_entry A reference to the active blog_entry object. */
/** @var \blog_entry A reference to the active blog_entry object. */
protected
$blogentry
;
/**
...
...
@@ -62,7 +62,7 @@ class blog_entry_deleted extends \core\event\base {
/**
* Sets blog_entry object to be used by observers.
*
* @param \blog_entry $
data
A reference to the active blog_entry object.
* @param \blog_entry $
blogentry
A reference to the active blog_entry object.
*/
public
function
set_blog_entry
(
\
blog_entry
$blogentry
)
{
$this
->
blogentry
=
$blogentry
;
...
...
@@ -71,6 +71,7 @@ class blog_entry_deleted extends \core\event\base {
/**
* Returns deleted blog entry for event observers.
*
* @throws \coding_exception
* @return \blog_entry
*/
public
function
get_blog_entry
()
{
...
...
@@ -86,7 +87,7 @@ class blog_entry_deleted extends \core\event\base {
* @return string
*/