mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-57791 analytics: Always absolute full class names
Some extra tiny changes as well.
This commit is contained in:
parent
1cc2b4bac3
commit
3a396286b1
@ -65,7 +65,7 @@ if ($hassiteconfig) {
|
||||
|
||||
$timesplittingoptions = array();
|
||||
$timesplittingdefaults = array('\\core_analytics\\local\\time_splitting\\quarters_accum',
|
||||
'\\core_analytics\\local\\time_splitting\\quarters');
|
||||
'\\core_analytics\\local\\time_splitting\\quarters', '\\core_analytics\\local\\time_splitting\\no_splitting');
|
||||
foreach ($alltimesplittings as $key => $timesplitting) {
|
||||
$timesplittingoptions[$key] = $timesplitting->get_name();
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ class renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Defer to template.
|
||||
*
|
||||
* @param templatable $templatable
|
||||
* @param \tool_models\output\models_list $templatable
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function render_models_list(templatable $templatable) {
|
||||
$data = $templatable->export_for_template($this);
|
||||
protected function render_models_list(\tool_models\output\models_list $modelslist) {
|
||||
$data = $modelslist->export_for_template($this);
|
||||
return parent::render_from_template('tool_models/models_list', $data);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ abstract class calculable {
|
||||
* @return string
|
||||
*/
|
||||
public static function get_name() {
|
||||
return get_called_class();
|
||||
return '\\' . get_called_class();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ abstract class binary extends discrete {
|
||||
*/
|
||||
public static function get_feature_headers() {
|
||||
// Just 1 single feature obtained from the calculated value.
|
||||
return array(get_called_class());
|
||||
return array('\\' . get_called_class());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -511,7 +511,7 @@ abstract class community_of_inquiry_activity extends linear {
|
||||
|
||||
switch ($potentiallevel) {
|
||||
case 5:
|
||||
// Cognitive level 4 is to comment on feedback.
|
||||
// Cognitive level 5 is to submit after feedback.
|
||||
if ($this->any_feedback('submitted', $cm, $contextid, $user)) {
|
||||
$score += $scoreperlevel * 5;
|
||||
break;
|
||||
|
@ -50,7 +50,7 @@ abstract class discrete extends base {
|
||||
* @return string[]
|
||||
*/
|
||||
public static function get_feature_headers() {
|
||||
$fullclassname = get_called_class();
|
||||
$fullclassname = '\\' . get_called_class();
|
||||
|
||||
$headers = array($fullclassname);
|
||||
foreach (self::get_classes() as $class) {
|
||||
|
@ -51,7 +51,7 @@ abstract class linear extends base {
|
||||
*/
|
||||
public static function get_feature_headers() {
|
||||
|
||||
$fullclassname = get_called_class();
|
||||
$fullclassname = '\\' . get_called_class();
|
||||
|
||||
if (static::include_averages()) {
|
||||
// The calculated value + context indicators.
|
||||
|
@ -389,7 +389,7 @@ abstract class base {
|
||||
|
||||
// The target as well.
|
||||
if ($target) {
|
||||
$headers[] = get_class($target);
|
||||
$headers[] = $target->get_id();
|
||||
}
|
||||
|
||||
return $headers;
|
||||
|
@ -106,7 +106,10 @@ class manager {
|
||||
|
||||
$models = array();
|
||||
foreach ($modelobjs as $modelobj) {
|
||||
$models[$modelobj->id] = new \core_analytics\model($modelobj);
|
||||
$model = new \core_analytics\model($modelobj);
|
||||
if ($model->is_available()) {
|
||||
$models[$modelobj->id] = $model;
|
||||
}
|
||||
}
|
||||
return $models;
|
||||
}
|
||||
|
@ -135,6 +135,26 @@ class model {
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick safety check to discard site models which required components are not available anymore.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_available() {
|
||||
$target = $this->get_target();
|
||||
if (!$target) {
|
||||
return false;
|
||||
}
|
||||
$analyser = $this->get_target();
|
||||
|
||||
$classname = $target->get_analyser_class();
|
||||
if (!class_exists($classname)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the model id.
|
||||
*
|
||||
@ -1217,7 +1237,7 @@ class model {
|
||||
if (!is_object($indicator) && !is_scalar($indicator)) {
|
||||
$indicator = strval($indicator);
|
||||
} else if (is_object($indicator)) {
|
||||
$indicator = get_class($indicator);
|
||||
$indicator = '\\' . get_class($indicator);
|
||||
}
|
||||
throw new \moodle_exception('errorinvalidindicator', 'analytics', '', $indicator);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user