MDL-40052 events: Add get_url() api to various report content_viewed classes

This commit is contained in:
Ankit Agarwal 2013-08-20 11:14:17 +08:00 committed by Damyon Wiese
parent bb0038074e
commit b9e1f0997c
5 changed files with 60 additions and 0 deletions

View file

@ -31,5 +31,17 @@ namespace report_log\event;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class content_viewed extends \core\event\content_viewed {
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
if (!empty($this->other['url'])) {
return new \moodle_url($this->other['url']);
}
return new \moodle_url('report/log/index.php', array('id' => $this->courseid));
}
}

View file

@ -31,5 +31,17 @@ namespace report_loglive\event;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class content_viewed extends \core\event\content_viewed {
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
if (!empty($this->other['url'])) {
return new \moodle_url($this->other['url']);
}
return new \moodle_url('report/loglive/index.php', array('id' => $this->courseid));
}
}

View file

@ -31,5 +31,17 @@ namespace report_outline\event;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class content_viewed extends \core\event\content_viewed {
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
if (!empty($this->other['url'])) {
return new \moodle_url($this->other['url']);
}
return new \moodle_url('report/outline/index.php', array('id' => $this->courseid));
}
}

View file

@ -31,5 +31,17 @@ namespace report_participation\event;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class content_viewed extends \core\event\content_viewed {
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
if (!empty($this->other['url'])) {
return new \moodle_url($this->other['url']);
}
return new \moodle_url('report/participation/index.php', array('id' => $this->courseid));
}
}

View file

@ -31,5 +31,17 @@ namespace report_stats\event;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class content_viewed extends \core\event\content_viewed {
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
if (!empty($this->other['url'])) {
return new \moodle_url($this->other['url']);
}
return new \moodle_url('report/stats/index.php', array('id' => $this->courseid));
}
}