Skip to content

Commit

Permalink
MDL-64500 tool_analytics: No invalid analysables message
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Feb 1, 2019
1 parent 2188da9 commit e3d3ae2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 27 deletions.
6 changes: 6 additions & 0 deletions admin/tool/analytics/classes/output/invalid_analysables.php
Expand Up @@ -153,6 +153,12 @@ public function export_for_template(\renderer_base $output) {
$data->analysables[] = $obj;
}

if (empty($data->analysables)) {
$data->noanalysables = [
'message' => get_string('noinvalidanalysables', 'tool_analytics'),
'announce' => true,
];
}
return $data;
}
}
1 change: 1 addition & 0 deletions admin/tool/analytics/lang/en/tool_analytics.php
Expand Up @@ -75,6 +75,7 @@
$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';
Expand Down
61 changes: 34 additions & 27 deletions admin/tool/analytics/templates/invalid_analysables.mustache
Expand Up @@ -48,31 +48,38 @@
<div class="box">
<h3>{{#str}}modelinvalidanalysables, tool_analytics, {{modelname}}{{/str}}</h3>
<div>{{#str}}invalidanalysablesinfo, tool_analytics{{/str}}</div>
<div class="m-t-2 m-b-1">
<span>{{#prev}}{{> core/single_button}}{{/prev}}</span>
<span>{{#next}}{{> core/single_button}}{{/next}}</span>
</div>
<table class="generaltable fullwidth">
<caption class="accesshide">{{#str}}invalidanalysablestable, tool_analytics{{/str}}</caption>
<thead>
<tr>
<th scope="col">{{#str}}name{{/str}}</th>
<th scope="col">{{#str}}invalidtraining, tool_analytics{{/str}}</th>
<th scope="col">{{#str}}invalidprediction, tool_analytics{{/str}}</th>
</tr>
</thead>
<tbody>
{{#analysables}}
<tr>
<td>{{{url}}}</td>
<td>{{validtraining}}</td>
<td>{{validprediction}}</td>
</tr>
{{/analysables}}
</tbody>
</table>
<div class="m-t-1 m-b-2">
<span>{{#prev}}{{> core/single_button}}{{/prev}}</span>
<span>{{#next}}{{> core/single_button}}{{/next}}</span>
</div>
{{#noanalysables}}
<div class="m-t-2 m-b-1">
{{> core/notification_info}}
</div>
{{/noanalysables}}
{{#analysables}}
<div class="m-t-2 m-b-1">
<span>{{#prev}}{{> core/single_button}}{{/prev}}</span>
<span>{{#next}}{{> core/single_button}}{{/next}}</span>
</div>
<table class="generaltable fullwidth">
<caption class="accesshide">{{#str}}invalidanalysablestable, tool_analytics{{/str}}</caption>
<thead>
<tr>
<th scope="col">{{#str}}name{{/str}}</th>
<th scope="col">{{#str}}invalidtraining, tool_analytics{{/str}}</th>
<th scope="col">{{#str}}invalidprediction, tool_analytics{{/str}}</th>
</tr>
</thead>
<tbody>
{{#analysables}}
<tr>
<td>{{{url}}}</td>
<td>{{validtraining}}</td>
<td>{{validprediction}}</td>
</tr>
{{/analysables}}
</tbody>
</table>
<div class="m-t-1 m-b-2">
<span>{{#prev}}{{> core/single_button}}{{/prev}}</span>
<span>{{#next}}{{> core/single_button}}{{/next}}</span>
</div>
{{/analysables}}
</div>

0 comments on commit e3d3ae2

Please sign in to comment.