Merge branch 'MDL-59063_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Andrew Nicols 2017-10-19 09:01:58 +08:00
commit ff7081150b
12 changed files with 317 additions and 4 deletions

View file

@ -47,6 +47,13 @@ interface analysable {
*/
public function get_id();
/**
* The analysable human readable name
*
* @return string
*/
public function get_name();
/**
* The analysable context.
*

View file

@ -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
*

View file

@ -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));
}

View file

@ -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.
*