Merge branch 'w03_MDL-43661_m27_edulevel' of https://github.com/skodak/moodle

This commit is contained in:
Dan Poltawski 2014-01-22 09:15:52 +08:00
commit 259d41fcb9
148 changed files with 215 additions and 171 deletions

View file

@ -49,7 +49,7 @@ abstract class assessable_submitted extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -56,7 +56,7 @@ abstract class assessable_uploaded extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -40,7 +40,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read string $objecttable name of database table where is object record stored
* @property-read int $objectid optional id of the object
* @property-read string $crud letter indicating event type
* @property-read int $level log level (number between 1 and 100)
* @property-read int $edulevel log level (one of the constants LEVEL_)
* @property-read int $contextid
* @property-read int $contextlevel
* @property-read int $contextinstanceid
@ -101,7 +101,7 @@ abstract class base implements \IteratorAggregate {
/** @var array list of event properties */
private static $fields = array(
'eventname', 'component', 'action', 'target', 'objecttable', 'objectid', 'crud', 'level', 'contextid',
'eventname', 'component', 'action', 'target', 'objecttable', 'objectid', 'crud', 'edulevel', 'contextid',
'contextlevel', 'contextinstanceid', 'userid', 'courseid', 'relateduserid', 'other',
'timecreated');
@ -148,7 +148,7 @@ abstract class base implements \IteratorAggregate {
* @throws \coding_exception
*/
public static final function create(array $data = null) {
global $PAGE, $USER, $CFG;
global $USER, $CFG;
$data = (array)$data;
@ -161,6 +161,14 @@ abstract class base implements \IteratorAggregate {
// Set static event data specific for child class.
$event->init();
if (isset($event->data['level'])) {
if (!isset($event->data['edulevel'])) {
debugging('level property is deprecated, use edulevel property instead', DEBUG_DEVELOPER);
$event->data['edulevel'] = $event->data['level'];
}
unset($event->data['level']);
}
// Set automatic data.
$event->data['timecreated'] = time();
@ -205,7 +213,7 @@ abstract class base implements \IteratorAggregate {
// Warn developers if they do something wrong.
if ($CFG->debugdeveloper) {
static $automatickeys = array('eventname', 'component', 'action', 'target', 'contextlevel', 'contextinstanceid', 'timecreated');
static $initkeys = array('crud', 'level', 'objecttable');
static $initkeys = array('crud', 'level', 'objecttable', 'edulevel');
foreach ($data as $key => $ignored) {
if ($key === 'context') {
@ -234,7 +242,7 @@ abstract class base implements \IteratorAggregate {
*
* Set all required data properties:
* 1/ crud - letter [crud]
* 2/ level - using a constant self::LEVEL_*.
* 2/ edulevel - using a constant self::LEVEL_*.
* 3/ objecttable - name of database table if objectid specified
*
* Optionally it can set:
@ -362,7 +370,7 @@ abstract class base implements \IteratorAggregate {
/**
* Return standardised event data as array.
*
* @return array
* @return array All elements are scalars except the 'other' field which is array.
*/
public function get_data() {
return $this->data;
@ -371,7 +379,9 @@ abstract class base implements \IteratorAggregate {
/**
* Return auxiliary data that was stored in logs.
*
* TODO MDL-41331: Properly define this method once logging is finalised.
* List of standard properties:
* - origin: IP number, cli,cron
* - realuserid: id of the user when logged-in-as
*
* @return array the format is standardised by logging API
*/
@ -425,8 +435,8 @@ abstract class base implements \IteratorAggregate {
if (empty($this->data['crud'])) {
throw new \coding_exception('crud must be specified in init() method of each method');
}
if (!isset($this->data['level'])) {
throw new \coding_exception('level must be specified in init() method of each method');
if (!isset($this->data['edulevel'])) {
throw new \coding_exception('edulevel must be specified in init() method of each method');
}
if (!empty($this->data['objectid']) and empty($this->data['objecttable'])) {
throw new \coding_exception('objecttable must be specified in init() method if objectid present');
@ -439,9 +449,9 @@ abstract class base implements \IteratorAggregate {
if (!in_array($this->data['crud'], array('c', 'r', 'u', 'd'), true)) {
debugging("Invalid event crud value specified.", DEBUG_DEVELOPER);
}
if (!in_array($this->data['level'], array(self::LEVEL_OTHER, self::LEVEL_TEACHING, self::LEVEL_PARTICIPATING))) {
if (!in_array($this->data['edulevel'], array(self::LEVEL_OTHER, self::LEVEL_TEACHING, self::LEVEL_PARTICIPATING))) {
// Bitwise combination of levels is not allowed at this stage.
debugging('Event property level must a constant value, see event_base::LEVEL_*', DEBUG_DEVELOPER);
debugging('Event property edulevel must a constant value, see event_base::LEVEL_*', DEBUG_DEVELOPER);
}
if (self::$fields !== array_keys($this->data)) {
debugging('Number of event data fields must not be changed in event classes', DEBUG_DEVELOPER);
@ -601,6 +611,10 @@ abstract class base implements \IteratorAggregate {
* @return mixed
*/
public function __get($name) {
if ($name === 'level') {
debugging('level property is deprecated, use edulevel property instead', DEBUG_DEVELOPER);
return $this->data['edulevel'];
}
if (array_key_exists($name, $this->data)) {
return $this->data[$name];
}
@ -630,6 +644,10 @@ abstract class base implements \IteratorAggregate {
* @return bool
*/
public function __isset($name) {
if ($name === 'level') {
debugging('level property is deprecated, use edulevel property instead', DEBUG_DEVELOPER);
return isset($this->data['edulevel']);
}
return isset($this->data[$name]);
}

View file

@ -51,7 +51,7 @@ class blog_association_created extends \core\event\base {
$this->context = \context_system::instance();
$this->data['objecttable'] = 'blog_association';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -50,7 +50,7 @@ class blog_entries_viewed extends base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -47,7 +47,7 @@ class blog_entry_created extends \core\event\base {
$this->context = \context_system::instance();
$this->data['objecttable'] = 'post';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -46,7 +46,7 @@ class blog_entry_deleted extends \core\event\base {
$this->context = \context_system::instance();
$this->data['objecttable'] = 'post';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -45,7 +45,7 @@ class blog_entry_updated extends base {
$this->context = \context_system::instance();
$this->data['objecttable'] = 'post';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -41,7 +41,7 @@ class cohort_created extends base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'cohort';
}

View file

@ -41,7 +41,7 @@ class cohort_deleted extends base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'cohort';
}

View file

@ -41,7 +41,7 @@ class cohort_member_added extends base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'cohort';
}

View file

@ -42,7 +42,7 @@ class cohort_member_removed extends base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'cohort';
}

View file

@ -41,7 +41,7 @@ class cohort_updated extends base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'cohort';
}

View file

@ -50,7 +50,7 @@ abstract class comment_created extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'comments';
}

View file

@ -50,7 +50,7 @@ abstract class comment_deleted extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'comments';
}

View file

@ -44,7 +44,7 @@ abstract class comments_viewed extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -61,7 +61,7 @@ abstract class content_viewed extends base {
global $PAGE;
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = $PAGE->context;
}

View file

@ -33,7 +33,7 @@ class course_category_created extends base {
protected function init() {
$this->data['objecttable'] = 'course_categories';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -44,7 +44,7 @@ class course_category_deleted extends base {
protected function init() {
$this->data['objecttable'] = 'course_categories';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -36,7 +36,7 @@ class course_category_updated extends base {
protected function init() {
$this->data['objecttable'] = 'course_categories';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -33,7 +33,7 @@ class course_completed extends base {
protected function init() {
$this->data['objecttable'] = 'course_completions';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -40,7 +40,7 @@ class course_completion_updated extends base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -39,7 +39,7 @@ class course_content_deleted extends base {
protected function init() {
$this->data['objecttable'] = 'course';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -40,7 +40,7 @@ class course_created extends base {
protected function init() {
$this->data['objecttable'] = 'course';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -41,7 +41,7 @@ class course_deleted extends base {
protected function init() {
$this->data['objecttable'] = 'course';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -33,7 +33,7 @@ class course_module_completion_updated extends base {
protected function init() {
$this->data['objecttable'] = 'course_modules_completion';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -50,7 +50,7 @@ class course_module_created extends base {
protected function init() {
$this->data['objecttable'] = 'course_modules';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -49,7 +49,7 @@ class course_module_deleted extends base {
protected function init() {
$this->data['objecttable'] = 'course_modules';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -52,7 +52,7 @@ abstract class course_module_instance_list_viewed extends base{
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
if (strstr($this->component, 'mod_') === false) {
throw new \coding_exception('The event name or namespace is invalid.');
} else {

View file

@ -50,7 +50,7 @@ class course_module_updated extends base {
protected function init() {
$this->data['objecttable'] = 'course_modules';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -45,7 +45,7 @@ abstract class course_module_viewed extends base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
/**

View file

@ -74,7 +74,7 @@ class course_reset_ended extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -74,7 +74,7 @@ class course_reset_started extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -43,7 +43,7 @@ class course_restored extends base {
protected function init() {
$this->data['objecttable'] = 'course';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -49,7 +49,7 @@ class course_section_updated extends base {
protected function init() {
$this->data['objecttable'] = 'course_sections';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -43,7 +43,7 @@ class course_updated extends base {
protected function init() {
$this->data['objecttable'] = 'course';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**

View file

@ -32,7 +32,7 @@ class email_failed extends base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -86,7 +86,7 @@ class group_created extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}

View file

@ -86,7 +86,7 @@ class group_deleted extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}

View file

@ -98,7 +98,7 @@ class group_member_added extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}

View file

@ -89,7 +89,7 @@ class group_member_removed extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}

View file

@ -86,7 +86,7 @@ class group_updated extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groups';
}

View file

@ -93,7 +93,7 @@ class grouping_created extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groupings';
}

View file

@ -93,7 +93,7 @@ class grouping_deleted extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groupings';
}

View file

@ -93,7 +93,7 @@ class grouping_updated extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'groupings';
}

View file

@ -33,7 +33,7 @@ class mnet_access_control_created extends base {
protected function init() {
$this->data['objecttable'] = 'mnet_sso_access_control';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -33,7 +33,7 @@ class mnet_access_control_updated extends base {
protected function init() {
$this->data['objecttable'] = 'mnet_sso_access_control';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -49,7 +49,7 @@ class note_created extends \core\event\base {
protected function init() {
$this->data['objecttable'] = 'post';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -49,7 +49,7 @@ class note_deleted extends \core\event\base {
protected function init() {
$this->data['objecttable'] = 'post';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -49,7 +49,7 @@ class note_updated extends \core\event\base {
protected function init() {
$this->data['objecttable'] = 'post';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -48,7 +48,7 @@ class notes_viewed extends \core\event\content_viewed {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -32,7 +32,7 @@ class role_allow_assign_updated extends base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -32,7 +32,7 @@ class role_allow_override_updated extends base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -32,7 +32,7 @@ class role_allow_switch_updated extends base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -38,7 +38,7 @@ class role_assigned extends base {
protected function init() {
$this->data['objecttable'] = 'role';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -36,7 +36,7 @@ class role_capabilities_updated extends base {
protected function init() {
$this->data['objecttable'] = 'role';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -41,7 +41,7 @@ class role_deleted extends base {
protected function init() {
$this->data['objecttable'] = 'role';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -38,7 +38,7 @@ class role_unassigned extends base {
protected function init() {
$this->data['objecttable'] = 'role';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -40,7 +40,7 @@ class user_created extends base {
protected function init() {
$this->data['objecttable'] = 'user';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -50,7 +50,7 @@ class user_deleted extends base {
protected function init() {
$this->data['objecttable'] = 'user';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -46,7 +46,7 @@ class user_enrolment_created extends base {
protected function init() {
$this->data['objecttable'] = 'user_enrolments';
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -47,7 +47,7 @@ class user_enrolment_deleted extends base {
protected function init() {
$this->data['objecttable'] = 'user_enrolments';
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -46,7 +46,7 @@ class user_enrolment_updated extends base {
protected function init() {
$this->data['objecttable'] = 'user_enrolments';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -42,7 +42,7 @@ class user_list_viewed extends \core\event\base {
protected function init() {
$this->data['objecttable'] = 'course';
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -95,7 +95,7 @@ class user_loggedin extends \core\event\base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'user';
}

View file

@ -49,7 +49,7 @@ class user_loggedinas extends base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'user';
}

View file

@ -47,7 +47,7 @@ class user_loggedout extends base {
$this->context = \context_system::instance();
$this->data['objecttable'] = 'user';
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -42,7 +42,7 @@ class user_profile_viewed extends base {
protected function init() {
$this->data['objecttable'] = 'user';
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -40,7 +40,7 @@ class user_updated extends base {
protected function init() {
$this->data['objecttable'] = 'user';
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**

View file

@ -79,7 +79,7 @@ class webservice_function_called extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = \context_system::instance();
}

View file

@ -83,7 +83,7 @@ class webservice_login_failed extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = \context_system::instance();
}

View file

@ -87,7 +87,7 @@ class webservice_service_created extends \core\event\base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'external_services';
}

View file

@ -81,7 +81,7 @@ class webservice_service_deleted extends \core\event\base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'external_services';
}

View file

@ -81,7 +81,7 @@ class webservice_service_updated extends \core\event\base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'external_services';
}

View file

@ -80,7 +80,7 @@ class webservice_service_user_added extends \core\event\base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'external_services';
}

View file

@ -80,7 +80,7 @@ class webservice_service_user_removed extends \core\event\base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'external_services';
}

View file

@ -87,7 +87,7 @@ class webservice_token_created extends \core\event\base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'external_tokens';
}

View file

@ -69,7 +69,7 @@ class webservice_token_sent extends \core\event\base {
protected function init() {
$this->context = \context_system::instance();
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'external_tokens';
}

View file

@ -52,7 +52,7 @@ class core_event_testcase extends advanced_testcase {
$this->assertSame('unittest', $event->target);
$this->assertSame(5, $event->objectid);
$this->assertSame('u', $event->crud);
$this->assertSame(\core\event\base::LEVEL_PARTICIPATING, $event->level);
$this->assertSame(\core\event\base::LEVEL_PARTICIPATING, $event->edulevel);
$this->assertEquals($system, $event->get_context());
$this->assertSame($system->id, $event->contextid);
@ -451,6 +451,23 @@ class core_event_testcase extends advanced_testcase {
\core_tests\event\unittest_observer::$info);
}
public function test_deprecated() {
global $DB;
$this->resetAfterTest(true);
$event = \core_tests\event\deprecated_event1::create();
$this->assertDebuggingCalled('level property is deprecated, use edulevel property instead');
$this->assertSame($event::LEVEL_TEACHING, $event->level);
$this->assertDebuggingCalled('level property is deprecated, use edulevel property instead');
$this->assertTrue(isset($event->level));
$this->assertDebuggingCalled('level property is deprecated, use edulevel property instead');
$this->assertSame($event::LEVEL_TEACHING, $event->edulevel);
}
public function test_legacy() {
global $DB;

View file

@ -41,7 +41,7 @@ class unittest_executed extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
}
public function get_url() {
@ -116,14 +116,14 @@ class unittest_observer {
class bad_event1 extends \core\event\base {
protected function init() {
//$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
}
class bad_event2 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
//$this->data['level'] = 10;
//$this->data['edulevel'] = 10;
}
}
@ -131,14 +131,14 @@ class bad_event2b extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
// Invalid level value.
$this->data['level'] = -1;
$this->data['edulevel'] = -1;
}
}
class bad_event3 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
unset($this->data['courseid']);
}
}
@ -146,7 +146,7 @@ class bad_event3 extends \core\event\base {
class bad_event4 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['xxx'] = 1;
}
}
@ -154,14 +154,14 @@ class bad_event4 extends \core\event\base {
class bad_event5 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'x';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
}
class bad_event6 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'xxx_xxx_xx';
}
}
@ -169,7 +169,7 @@ class bad_event6 extends \core\event\base {
class bad_event7 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = null;
}
}
@ -177,7 +177,7 @@ class bad_event7 extends \core\event\base {
class bad_event8 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'user';
}
}
@ -185,14 +185,14 @@ class bad_event8 extends \core\event\base {
class problematic_event1 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
}
}
class problematic_event2 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = \context_system::instance();
}
}
@ -200,7 +200,7 @@ class problematic_event2 extends \core\event\base {
class problematic_event3 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = \context_system::instance();
}
@ -211,11 +211,19 @@ class problematic_event3 extends \core\event\base {
}
}
class deprecated_event1 extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_TEACHING; // Tests edulevel hint.
$this->context = \context_system::instance();
}
}
class noname_event extends \core\event\base {
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->context = \context_system::instance();
}
}
@ -237,7 +245,7 @@ class content_viewed extends \core\event\content_viewed {
class course_module_viewed extends \core\event\course_module_viewed {
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'feedback';
}
}

View file

@ -6,6 +6,7 @@ information provided here is intended especially for developers.
* $core_renderer->block_move_target() changed to support more verbose move-block-here descriptions.
DEPRECATIONS:
* Update init methods in all event classes - "level" property was renamed to "edulevel", the level property is now deprecated.
* Abstract class \core\event\course_module_instances_list_viewed is deprecated now, use \core\event\instances_list_viewed instead.
* mod_book\event\instances_list_viewed has been deprecated. Please use mod_book\event\course_module_instance_list_viewed instead.
* mod_chat\event\instances_list_viewed has been deprecated. Please use mod_chat\event\course_module_instance_list_viewed instead.

View file

@ -95,7 +95,7 @@ class all_submissions_downloaded extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign';
}

View file

@ -85,7 +85,7 @@ class extension_granted extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign';
}

View file

@ -85,7 +85,7 @@ class identities_revealed extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign';
}

View file

@ -91,7 +91,7 @@ class marker_updated extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign';
}

View file

@ -85,7 +85,7 @@ class statement_accepted extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'assign_submission';
}

View file

@ -85,7 +85,7 @@ class submission_duplicated extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'assign_submission';
}

View file

@ -85,7 +85,7 @@ class submission_graded extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign_grades';
}

View file

@ -85,7 +85,7 @@ class submission_locked extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign';
}

View file

@ -91,7 +91,7 @@ class submission_status_updated extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign_submission';
}

View file

@ -85,7 +85,7 @@ class submission_unlocked extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign';
}

View file

@ -85,7 +85,7 @@ class submission_updated extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'assign_submission';
}

View file

@ -91,7 +91,7 @@ class workflow_state_updated extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'assign';
}

View file

@ -81,7 +81,7 @@ class chapter_created extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'book_chapters';
}

View file

@ -84,7 +84,7 @@ class chapter_deleted extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'book_chapters';
}

View file

@ -81,7 +81,7 @@ class chapter_updated extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['level'] = self::LEVEL_TEACHING;
$this->data['edulevel'] = self::LEVEL_TEACHING;
$this->data['objecttable'] = 'book_chapters';
}

View file

@ -78,7 +78,7 @@ class chapter_viewed extends \core\event\content_viewed {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'book_chapters';
}

View file

@ -41,7 +41,7 @@ class course_module_viewed extends \core\event\course_module_viewed {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'book';
}
}

View file

@ -78,7 +78,7 @@ class book_exported extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_OTHER;
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'book';
}

View file

@ -78,7 +78,7 @@ class book_printed extends \core\event\base {
*/
protected function init() {
$this->data['crud'] = 'r';
$this->data['level'] = self::LEVEL_PARTICIPATING;
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
$this->data['objecttable'] = 'book';
}

Some files were not shown because too many files have changed in this diff Show more