Part of MDL-57791 epic.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-namespace tool_models\local\target;
+namespace tool_models\analytics\target;
defined('MOODLE_INTERNAL') || die();
return get_string('nocoursesections', 'tool_models');
}
+ if ($course->get_end() == 0) {
+ // We require time end to be set.
+ return get_string('nocourseendtime', 'tool_models');
+ }
+
// Ongoing courses data can not be used to train.
if ($fortraining && !$course->is_finished()) {
- if ($course->get_end() === 0) {
- // More specific error.
- return get_string('nocourseendtime', 'tool_models');
- }
return get_string('coursenotyetfinished', 'tool_models');
}
function xmldb_tool_models_install() {
// TODO All of them for the moment, we will define a limited set of them once in core.
- $target = \core_analytics\manager::get_target('\tool_models\local\target\course_dropout');
+ $target = \core_analytics\manager::get_target('\tool_models\analytics\target\course_dropout');
$indicators = \core_analytics\manager::get_all_indicators();
// We need the model to be created in order to know all its potential indicators and set them.
$string['executionresults'] = 'Results using {$a->name} course duration splitting';
$string['extrainfo'] = 'Info';
$string['generalerror'] = 'Evaluation error. Status code {$a}';
-
$string['goodmodel'] = 'This is a good model and it can be used to predict, enable it and execute it to start getting predictions.';
$string['indicators'] = 'Indicators';
$string['info'] = 'Info';
$string['labelstudentdropoutno'] = 'Not at risk';
$string['loginfo'] = 'Log extra info';
$string['lowaccuracy'] = 'The model accuracy is low';
+$string['modelresults'] = '{$a} results';
$string['modelslist'] = 'Models list';
$string['modeltimesplitting'] = 'Time splitting';
$string['nocompletiondetection'] = 'No method available to detect course completion (no completion nor competencies nor course grade pass)';
$string['nodatatoevaluate'] = 'There is no data to evaluate the model';
$string['nodatatopredict'] = 'There is no data to use for predictions';
$string['notdefined'] = 'Not yet defined';
-$string['prediction'] = 'Prediction';
+$string['pluginname'] = 'Analytic models';
$string['predictionresults'] = 'Prediction results';
-$string['predictions'] = 'Predictions';
$string['predictmodels'] = 'Predict models';
$string['predictorresultsin'] = 'Predictor logged information in {$a} directory';
-$string['predictiondetails'] = 'Prediction details';
$string['predictionprocessfinished'] = 'Prediction process finished';
-
-$string['pluginname'] = 'Analytic models';
-$string['modelresults'] = '{$a} results';
$string['samestartdate'] = 'Current start date is good';
$string['sameenddate'] = 'Current end date is good';
$string['target'] = 'Target';
foreach ($users as $user) {
$message = new \core\message\message();
- $message->component = 'analytics';
+ $message->component = 'moodle';
$message->name = 'insights';
$message->userfrom = get_admin();
// Filters out previous predictions keeping only the last time range one.
$select = "modelid = :modelid AND contextid = :contextid";
- $params = array($this->model->id, $context->id);
+ $params = array('modelid' => $this->model->id, 'contextid' => $context->id);
return $DB->record_exists_select('analytics_predictions', $select, $params);
}
// We want to track how effective are our suggested actions, we pass users through a script that will log these actions.
$params = array('action' => $actionname, 'predictionid' => $prediction->get_prediction_data()->id, 'forwardurl' => $actionurl->out(false));
- $url = new \moodle_url('/reports/insights/action.php', $params);
+ $url = new \moodle_url('/report/insights/action.php', $params);
if ($primary === false) {
$this->actionlink = new \action_menu_link_secondary($url, $icon, $text);
$string['insightmessagesubject'] = 'New insight for "{$a->contextname}": {$a->insightname}';
$string['insightinfo'] = '{$a->insightname} - {$a->contextname}';
$string['insightinfomessage'] = 'There are some insights you may find useful. Check out {$a}';
-$string['insights'] = 'Insights';
$string['invalidtimesplitting'] = 'Model with id {$a} needs a time splitting method before it can be used to train';
$string['invalidanalysablefortimesplitting'] = 'It can not be analysed using {$a} time splitting method';
$string['messageprovider:insights'] = 'Insights generated by prediction models';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(__DIR__ . '/../../../config.php');
+require_once(__DIR__ . '/../../config.php');
$predictionid = required_param('predictionid', PARAM_INT);
$actionname = required_param('action', PARAM_ALPHANUMEXT);
throw new \moodle_exception('errorunknownaction', 'report_insights');
}
-$modelready = $model->$model->is_enabled() && $model->is_trained() && $model->predictions_exist($context);
+$modelready = $model->is_enabled() && $model->is_trained() && $model->predictions_exist($context);
if (!$modelready && !has_capability('moodle/analytics:managemodels', $context)) {
$PAGE->set_pagelayout('report');
$data->predictions = array();
foreach ($predictions as $prediction) {
- $predictionrenderable = new \core_analytics\output\prediction($prediction, $this->model);
+ $predictionrenderable = new \report_insights\output\prediction($prediction, $this->model);
$data->predictions[] = $predictionrenderable->export_for_template($output);
}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(__DIR__ . '/../../../config.php');
+require_once(__DIR__ . '/../../config.php');
$contextid = required_param('contextid', PARAM_INT);
$modelid = optional_param('modelid', false, PARAM_INT);
$insightinfo = new stdClass();
$insightinfo->contextname = $context->get_context_name();
$insightinfo->insightname = $model->get_target()->get_name();
-$title = get_string('insightinfo', 'report_insights', $insightinfo);
+$title = get_string('insightinfo', 'analytics', $insightinfo);
if (!$model->is_enabled() && !has_capability('moodle/analytics:managemodels', $context)) {
echo $OUTPUT->header();
-$renderable = new \core_analytics\output\predictions_list($model, $context, $othermodels);
+$renderable = new \report_insights\output\predictions_list($model, $context, $othermodels);
echo $renderer->render($renderable);
echo $OUTPUT->footer();
$string['disabledmodel'] = 'Sorry, this model has been disabled by the administrator';
$string['errorpredictionnotfound'] = 'Prediction not found';
+$string['insights'] = 'Insights';
$string['pluginname'] = 'Insights';
+$string['prediction'] = 'Prediction';
+$string['predictiondetails'] = 'Prediction details';
+$string['predictions'] = 'Predictions';
$string['selectotherinsights'] = 'Select other insights...';
if (has_capability('moodle/analytics:listinsights', $context)) {
$cache = \cache::make('core', 'modelswithpredictions');
- $models = $cache->get($context->id);
- if ($models === false) {
+ $modelids = $cache->get($context->id);
+ if ($modelids === false) {
// Fill the cache.
$models = \core_analytics\manager::get_all_models(true, true, $context);
$modelids = array_keys($models);
$url = new moodle_url('/report/insights/insights.php', array('contextid' => $context->id));
$settingsnode = navigation_node::create(get_string('insights', 'report_insights'), $url, navigation_node::TYPE_SETTING,
null, null, new pix_icon('i/settings', ''));
- $reportnode = $navigation->get('coursereports');
- if (isset($settingsnode) && !empty($reportnode)) {
- $reportnode->add_node($settingsnode);
- }
+ $navigation->add_node($settingsnode);
}
}
}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(__DIR__ . '/../../../config.php');
+require_once(__DIR__ . '/../../config.php');
$predictionid = required_param('id', PARAM_INT);
require_capability('moodle/analytics:listinsights', $context);
$params = array('id' => $predictionobj->id);
-$url = new \moodle_url('/reports/insights/prediction.php', $params);
+$url = new \moodle_url('/report/insights/prediction.php', $params);
$PAGE->set_url($url);
$PAGE->set_pagelayout('report');
$insightinfo = new stdClass();
$insightinfo->contextname = $context->get_context_name();
$insightinfo->insightname = $model->get_target()->get_name();
-$title = get_string('insightinfo', 'report_insights', $insightinfo);
+$title = get_string('insightinfo', 'analytics', $insightinfo);
-$modelready = $model->$model->is_enabled() && $model->is_trained() && $model->predictions_exist($context);
+$modelready = $model->is_enabled() && $model->is_trained() && $model->predictions_exist($context);
if (!$modelready && !has_capability('moodle/analytics:managemodels', $context)) {
echo $renderer->render_model_disabled($insightinfo);
exit(0);
echo $OUTPUT->header();
-$renderable = new \core_analytics\output\prediction($prediction, $model);
+$renderable = new \report_insights\output\prediction($prediction, $model);
echo $renderer->render($renderable);
echo $OUTPUT->footer();
* none
}}
-<h2>{{#str}}prediction, analytics{{/str}}</h2>
+<h2>{{#str}}prediction, report_insights{{/str}}</h2>
{{> report_insights/prediction}}
-<h3>{{#str}} predictiondetails, analytics {{/str}}</h3>
+<h3>{{#str}} predictiondetails, report_insights {{/str}}</h3>
<div class="container prediction-calculations m-t-2">
{{#calculations}}
<div class="{{style}}">{{name}} - {{displayvalue}}</div>
</div>
{{/modelselector}}
-<h3>{{#str}} predictions, analytics {{/str}}</h3>
+<h3>{{#str}} predictions, report_insights {{/str}}</h3>
<div class="predictions-list">
{{#predictions}}
{{> report_insights/prediction}}