| Línea 67... |
Línea 67... |
| 67 |
|
67 |
|
| 68 |
$settings = new admin_settingpage('analyticssettings', new lang_string('analyticssettings', 'analytics'));
|
68 |
$settings = new admin_settingpage('analyticssettings', new lang_string('analyticssettings', 'analytics'));
|
| Línea 69... |
Línea 69... |
| 69 |
$ADMIN->add('analytics', $settings);
|
69 |
$ADMIN->add('analytics', $settings);
|
| 70 |
|
- |
|
| 71 |
if ($ADMIN->fulltree) {
|
- |
|
| 72 |
|
70 |
|
| 73 |
|
71 |
if ($ADMIN->fulltree) {
|
| 74 |
// Select the site prediction's processor.
|
72 |
// Select the site prediction's processor.
|
| 75 |
$predictionprocessors = \core_analytics\manager::get_all_prediction_processors();
|
73 |
$predictionprocessors = \core_analytics\manager::get_all_prediction_processors();
|
| 76 |
$predictors = array();
|
74 |
$predictors = [];
|
| 77 |
foreach ($predictionprocessors as $fullclassname => $predictor) {
|
75 |
foreach ($predictionprocessors as $fullclassname => $predictor) {
|
| 78 |
$pluginname = substr($fullclassname, 1, strpos($fullclassname, '\\', 1) - 1);
|
76 |
$pluginname = substr($fullclassname, 1, strpos($fullclassname, '\\', 1) - 1);
|
| - |
|
77 |
$predictors[$fullclassname] = new lang_string('pluginname', $pluginname);
|
| 79 |
$predictors[$fullclassname] = new lang_string('pluginname', $pluginname);
|
78 |
}
|
| - |
|
79 |
$settings->add(
|
| - |
|
80 |
new \core_analytics\admin_setting_predictor(
|
| 80 |
}
|
81 |
'analytics/predictionsprocessor',
|
| 81 |
$settings->add(new \core_analytics\admin_setting_predictor('analytics/predictionsprocessor',
|
82 |
new lang_string('defaultpredictionsprocessor', 'analytics'),
|
| - |
|
83 |
new lang_string('predictionsprocessor_help', 'analytics'),
|
| - |
|
84 |
\core_analytics\manager::default_mlbackend(),
|
| 82 |
new lang_string('defaultpredictionsprocessor', 'analytics'), new lang_string('predictionsprocessor_help', 'analytics'),
|
85 |
$predictors,
|
| - |
|
86 |
)
|
| - |
|
87 |
);
|
| - |
|
88 |
// Warn if current processor is not configured.
|
| - |
|
89 |
// We are avoiding doing this check in write_config because it is likely the default
|
| - |
|
90 |
// mlbackend_python plugin is not configured and will output warnings during install.
|
| - |
|
91 |
$currentprocessor = get_config('analytics', 'predictionsprocessor');
|
| - |
|
92 |
if (!empty($currentprocessor)) {
|
| - |
|
93 |
$currentprocessor = new $currentprocessor;
|
| - |
|
94 |
$currentprocessorisready = $currentprocessor->is_ready();
|
| - |
|
95 |
if ($currentprocessorisready !== true) {
|
| - |
|
96 |
$settings->add(new admin_setting_description(
|
| - |
|
97 |
'processornotready',
|
| - |
|
98 |
'',
|
| - |
|
99 |
html_writer::tag('div', $currentprocessorisready, ['class' => 'alert alert-danger'])
|
| - |
|
100 |
));
|
| Línea 83... |
Línea 101... |
| 83 |
\core_analytics\manager::default_mlbackend(), $predictors)
|
101 |
}
|
| 84 |
);
|
102 |
}
|
| 85 |
|
103 |
|
| 86 |
// Log store.
|
104 |
// Log store.
|