mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-44017 Events: Deprecated content_viewed event
Replaced content_viewed event with appropriate events and deprecated content_viewed event
This commit is contained in:
parent
0a489777fc
commit
e1b16f9773
39 changed files with 1291 additions and 453 deletions
|
@ -16,8 +16,11 @@
|
|||
/**
|
||||
* Abstract event for content viewing.
|
||||
*
|
||||
* This class has been deprecated, please extend base event or other relevent abstract class.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2013 Ankit Agarwal
|
||||
* @deprecated since Moodle 2.7
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
@ -25,28 +28,17 @@ namespace core\event;
|
|||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
debugging('core\event\content_viewed has been deprecated. Please extend base event or other relevant abstract class.',
|
||||
DEBUG_DEVELOPER);
|
||||
|
||||
/**
|
||||
* Class content_viewed.
|
||||
*
|
||||
* Base class for a content view event. Each plugin must extend this to create their own content view event.
|
||||
*
|
||||
* An example usage:-
|
||||
* $event = \report_participation\event\content_viewed::create(array('courseid' => $course->id,
|
||||
* 'other' => array('content' => 'participants'));
|
||||
* $event->set_page_detail();
|
||||
* $event->set_legacy_logdata(array($course->id, "course", "report participation",
|
||||
* "report/participation/index.php?id=$course->id", $course->id));
|
||||
* $event->trigger();
|
||||
* where \report_participation\event\content_viewed extends \core\event\content_viewed
|
||||
*
|
||||
* @property-read array $other {
|
||||
* Extra information about event.
|
||||
*
|
||||
* @type string content viewed content identifier.
|
||||
* }
|
||||
* This class has been deprecated, please extend base event or other relevent abstract class.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2013 Ankit Agarwal
|
||||
* @deprecated since Moodle 2.7
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class content_viewed extends base {
|
||||
|
|
|
@ -31,17 +31,11 @@ defined('MOODLE_INTERNAL') || die();
|
|||
*
|
||||
* Class for event to be triggered when a note is viewed.
|
||||
*
|
||||
* @property-read array $other {
|
||||
* Extra information about event.
|
||||
*
|
||||
* @type string content hard-coded to notes.
|
||||
* }
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2013 Ankit Agarwal
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class notes_viewed extends \core\event\content_viewed {
|
||||
class notes_viewed extends \core\event\base {
|
||||
|
||||
/**
|
||||
* Set basic properties for the event.
|
||||
|
@ -66,7 +60,11 @@ class notes_viewed extends \core\event\content_viewed {
|
|||
* @return string
|
||||
*/
|
||||
public function get_description() {
|
||||
return 'Note for user with id "'. $this->relateduserid . '" was viewed by user with id "'. $this->userid . '"';
|
||||
if (!empty($this->relateduserid)) {
|
||||
return 'Note for user with id "'. $this->relateduserid . '" was viewed by user with id "'. $this->userid . '"';
|
||||
} else {
|
||||
return 'Note for course with id "'. $this->courseid . '" was viewed by user with id "'. $this->userid . '"';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +72,7 @@ class notes_viewed extends \core\event\content_viewed {
|
|||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return new \moodle_url('/note/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
|
||||
return new \moodle_url('/notes/index.php', array('course' => $this->courseid, 'user' => $this->relateduserid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue