mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-59063 analytics: Expand analysable API to provide a name
This commit is contained in:
parent
8816022df7
commit
b0fb8ef59f
@ -47,6 +47,13 @@ interface analysable {
|
||||
*/
|
||||
public function get_id();
|
||||
|
||||
/**
|
||||
* The analysable human readable name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name();
|
||||
|
||||
/**
|
||||
* The analysable context.
|
||||
*
|
||||
|
@ -195,6 +195,15 @@ class course implements \core_analytics\analysable {
|
||||
return $this->course->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The course short name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
return format_string($this->course->shortname, true, array('context' => $this->get_context()));
|
||||
}
|
||||
|
||||
/**
|
||||
* get_context
|
||||
*
|
||||
|
@ -363,7 +363,7 @@ abstract class base {
|
||||
$result = $this->analysabletarget->is_valid_analysable($analysable, $includetarget);
|
||||
if ($result !== true) {
|
||||
$a = new \stdClass();
|
||||
$a->analysableid = $analysable->get_id();
|
||||
$a->analysableid = $analysable->get_name();
|
||||
$a->result = $result;
|
||||
$this->add_log(get_string('analysablenotvalidfortarget', 'analytics', $a));
|
||||
return array();
|
||||
@ -407,7 +407,7 @@ abstract class base {
|
||||
}
|
||||
|
||||
$a = new \stdClass();
|
||||
$a->analysableid = $analysable->get_id();
|
||||
$a->analysableid = $analysable->get_name();
|
||||
$a->errors = implode(', ', $errors);
|
||||
$this->add_log(get_string('analysablenotused', 'analytics', $a));
|
||||
}
|
||||
|
@ -54,6 +54,15 @@ class site implements \core_analytics\analysable {
|
||||
return SYSCONTEXTID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Site.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
return get_string('site');
|
||||
}
|
||||
|
||||
/**
|
||||
* Analysable context.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user