From b9249eb3d82c7ef8e1eeea8876c4e8ca9bbb0e3d Mon Sep 17 00:00:00 2001 From: David Monllao Date: Fri, 4 Jan 2019 17:12:43 +0100 Subject: [PATCH] MDL-64500 tool_analytics: No invalid analysables message --- .../classes/output/invalid_analysables.php | 6 ++ .../tool/analytics/lang/en/tool_analytics.php | 1 + .../templates/invalid_analysables.mustache | 61 +++++++++++-------- 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/admin/tool/analytics/classes/output/invalid_analysables.php b/admin/tool/analytics/classes/output/invalid_analysables.php index a5bda0949fd..0bb39025747 100644 --- a/admin/tool/analytics/classes/output/invalid_analysables.php +++ b/admin/tool/analytics/classes/output/invalid_analysables.php @@ -153,6 +153,12 @@ class invalid_analysables implements \renderable, \templatable { $data->analysables[] = $obj; } + if (empty($data->analysables)) { + $data->noanalysables = [ + 'message' => get_string('noinvalidanalysables', 'tool_analytics'), + 'announce' => true, + ]; + } return $data; } } diff --git a/admin/tool/analytics/lang/en/tool_analytics.php b/admin/tool/analytics/lang/en/tool_analytics.php index 8df2cc3690d..1c3bba2305a 100644 --- a/admin/tool/analytics/lang/en/tool_analytics.php +++ b/admin/tool/analytics/lang/en/tool_analytics.php @@ -75,6 +75,7 @@ $string['nextpage'] = 'Next page'; $string['nodatatoevaluate'] = 'There is no data to evaluate the model'; $string['nodatatopredict'] = 'No new elements to get predictions for'; $string['nodatatotrain'] = 'There is no new data that can be used for training'; +$string['noinvalidanalysables'] = 'This site does not contain any invalid analysable element.'; $string['notdefined'] = 'Not yet defined'; $string['pluginname'] = 'Analytic models'; $string['predictionresults'] = 'Prediction results'; diff --git a/admin/tool/analytics/templates/invalid_analysables.mustache b/admin/tool/analytics/templates/invalid_analysables.mustache index c97dd6be309..b7c6cbb0afc 100644 --- a/admin/tool/analytics/templates/invalid_analysables.mustache +++ b/admin/tool/analytics/templates/invalid_analysables.mustache @@ -48,31 +48,38 @@

{{#str}}modelinvalidanalysables, tool_analytics, {{modelname}}{{/str}}

{{#str}}invalidanalysablesinfo, tool_analytics{{/str}}
-
- {{#prev}}{{> core/single_button}}{{/prev}} - {{#next}}{{> core/single_button}}{{/next}} -
- - - - - - - - - - - {{#analysables}} - - - - - - {{/analysables}} - -
{{#str}}invalidanalysablestable, tool_analytics{{/str}}
{{#str}}name{{/str}}{{#str}}invalidtraining, tool_analytics{{/str}}{{#str}}invalidprediction, tool_analytics{{/str}}
{{{url}}}{{validtraining}}{{validprediction}}
-
- {{#prev}}{{> core/single_button}}{{/prev}} - {{#next}}{{> core/single_button}}{{/next}} -
+ {{#noanalysables}} +
+ {{> core/notification_info}} +
+ {{/noanalysables}} + {{#analysables}} +
+ {{#prev}}{{> core/single_button}}{{/prev}} + {{#next}}{{> core/single_button}}{{/next}} +
+ + + + + + + + + + + {{#analysables}} + + + + + + {{/analysables}} + +
{{#str}}invalidanalysablestable, tool_analytics{{/str}}
{{#str}}name{{/str}}{{#str}}invalidtraining, tool_analytics{{/str}}{{#str}}invalidprediction, tool_analytics{{/str}}
{{{url}}}{{validtraining}}{{validprediction}}
+
+ {{#prev}}{{> core/single_button}}{{/prev}} + {{#next}}{{> core/single_button}}{{/next}} +
+ {{/analysables}}