MDL-66091 report_insights: Usability improvements

- More feedback provided for the user once they click on useful/notuseful from the email.
- Replace the indicator calculations table headers for the table caption and
  replace the text by just "Indicators"
- Replace "System" for the site name for insights generated at system
  level
- Replace "$modelname prediction" for "$modelname" in report/insights/prediction.php
  heading

MDL-66091
This commit is contained in:
David Monllaó 2019-08-22 15:49:41 +08:00
parent 1c3efe48f8
commit 21202090f7
6 changed files with 34 additions and 21 deletions

View File

@ -195,7 +195,8 @@ class insights_generator {
$actionurl = $action->get_url();
if (!$actionurl->get_param('forwardurl')) {
$actiondoneurl = new \moodle_url('/report/insights/done.php');
$params = ['actionvisiblename' => $action->get_text(), 'target' => '_blank'];
$actiondoneurl = new \moodle_url('/report/insights/done.php', $params);
// Set the forward url to the 'done' script.
$actionurl->param('forwardurl', $actiondoneurl->out(false));
}

View File

@ -26,5 +26,18 @@ require_once(__DIR__ . '/../../config.php');
require_login();
$url = new \moodle_url('/');
redirect($url, get_string('actionsaved', 'report_insights'), null, \core\output\notification::NOTIFY_SUCCESS);
$actionvisiblename = required_param('actionvisiblename', PARAM_NOTAGS);
$PAGE->set_pagelayout('popup');
$PAGE->set_context(\context_system::instance());
$PAGE->set_title(get_site()->fullname);
$PAGE->set_url(new \moodle_url('/report/insights/done.php'));
echo $OUTPUT->header();
$notification = new \core\output\notification(get_string('actionsaved', 'report_insights', $actionvisiblename),
\core\output\notification::NOTIFY_SUCCESS);
$notification->set_show_closebutton(false);
echo $OUTPUT->render($notification);
echo $OUTPUT->footer();

View File

@ -103,8 +103,12 @@ if (!$model->uses_insights()) {
exit(0);
}
if ($context->id == SYSCONTEXTID) {
$PAGE->set_heading(get_site()->shortname);
} else {
$PAGE->set_heading($insightinfo->contextname);
}
$PAGE->set_title($insightinfo->insightname);
$PAGE->set_heading($insightinfo->contextname);
// Some models generate one single prediction per context. We can directly show the prediction details in this case.
if ($model->get_analyser()::one_sample_per_analysable()) {

View File

@ -22,11 +22,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['actionsaved'] = 'Your action has been saved.';
$string['calculatedvalue'] = 'Calculated value';
$string['actionsaved'] = 'Your feedback of \'{$a}\' has been saved.';
$string['disabledmodel'] = 'Sorry, this model has been disabled by the administrator';
$string['indicator'] = 'Indicator';
$string['insightprediction'] = '{$a} prediction';
$string['indicators'] = 'Indicators';
$string['insight'] = 'Insight';
$string['insights'] = 'Insights';
$string['justpredictions'] = 'Please note that the following insights are only predictions. It is not possible to predict the future with any certainty. The insights are provided so that action can be taken as necessary to prevent any negative predictions becoming reality.';
@ -39,7 +37,6 @@ $string['outcomeverypositive'] = 'Very positive outcome';
$string['outcomeverynegative'] = 'Very negative outcome';
$string['pluginname'] = 'Insights';
$string['prediction'] = 'Prediction';
$string['predictioncalculations'] = 'Indicator calculations';
$string['predictiondetails'] = 'Prediction details';
$string['nodetailsavailable'] = 'No prediction details are relevant.';
$string['timecreated'] = 'Time predicted';

View File

@ -71,8 +71,12 @@ if (!$model->uses_insights()) {
exit(0);
}
if ($context->id == SYSCONTEXTID) {
$PAGE->set_heading(get_site()->shortname);
} else {
$PAGE->set_heading($insightinfo->contextname);
}
$PAGE->set_title($insightinfo->insightname);
$PAGE->set_heading($insightinfo->contextname);
echo $OUTPUT->header();

View File

@ -73,7 +73,7 @@
}
}}
<h2 class="mb-2">{{#str}}insightprediction, report_insights, {{insightname}} {{/str}}</h2>
<h2 class="mb-2">{{insightname}}</h2>
<table class="generaltable insights-list">
{{#showpredicionheading}}
<caption>
@ -101,29 +101,23 @@
<caption>{{#str}}predictiondetails, report_insights{{/str}}</caption>
<tbody>
<tr>
<td scope="row">{{#str}}timecreated, report_insights{{/str}}</td>
<th scope="row">{{#str}}timecreated, report_insights{{/str}}</td>
<td>{{timecreated}}</td>
</tr>
{{#timerange}}
<tr>
<td scope="row">{{#str}}timerange, report_insights{{/str}}</td>
<th scope="row">{{#str}}timerange, report_insights{{/str}}</td>
<td>{{.}}</td>
</tr>
{{/timerange}}
</tbody>
</table>
<table class="generaltable prediction-calculations">
<caption class="accesshide">{{#str}}predictioncalculations, report_insights{{/str}}</caption>
<thead>
<tr>
<th scope="col">{{#str}}indicator, report_insights{{/str}}</th>
<th scope="col">{{#str}}calculatedvalue, report_insights{{/str}}</th>
</tr>
</thead>
<caption>{{#str}}indicators, report_insights{{/str}}</caption>
<tbody>
{{#calculations}}
<tr>
<td class="{{#style}}table-{{style}}{{/style}}">{{name}}</td>
<th scope="row" class="{{#style}}table-{{style}}{{/style}}">{{name}}</td>
<td class="{{#style}}table-{{style}}{{/style}}">{{#outcomeicon}}{{> core/pix_icon}}{{/outcomeicon}} {{displayvalue}}</td>
</tr>
{{/calculations}}