Commit a5c930d8 authored by Robert Lyon's avatar Robert Lyon

Bug 1724113: Changes for reports

This patch includes
- Allow the overview report to be the default report
- Fixed sorting of modified/visited columns for page activity report
- Fixed sorting for username in useractivity report
- Fixed total rows count for user activity
- Fixed collaboration report for institutions
- Fixed issues with the new columns in the groups report

Change-Id: I2269bb5610d238bc9786d04d4c2a9122c0a4ccfc
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 9dd5c16d
......@@ -58,14 +58,14 @@ if ($usersparam = param_variable('users', null)) {
}
define('PAGEHEADINGARROW', get_string('reports', 'statistics'));
$type = param_alpha('type', 'users');
$type = param_alpha('type', 'information');
$subtype = param_alpha('subtype', '');
if (isset($institution)) {
if (!$USER->get('admin') && !$USER->is_institutional_admin($institution) &&
$USER->is_institutional_staff($institution) && empty(get_config('staffstats')) && !empty(get_config('staffreports'))) {
// we need to give them the correct default report
$subtype = !empty($subtype) ? $subtype : 'userdetails';
$subtype = !empty($subtype) ? $subtype : 'information';
}
}
......
......@@ -2,5 +2,5 @@
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Registered users</h3>
<p>
Sum of all portfolios shared with registered user during the selected time period.
Sum of all portfolios shared with registered users during the selected time period.
</p>
<!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later -->
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Group page comments</h3>
<p>
Sum of all comments added to group pages and artefacts during the selected time period.
</p>
<!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later -->
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Shared page comments</h3>
<p>
Sum of all comments added to pages and page artefacts after they have been shared to a
group during the selected time period.
</p>
<p>Any comments added before the page is shared will not be counted.
</p>
<!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later -->
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Shared pages</h3>
<p>
Sum of all the pages, including all within collections, that have been shared to a
group during the selected time period.
</p>
......@@ -414,7 +414,8 @@ $string['publicshare'] = 'Public';
$string['secretshare'] = 'Secret URLs';
$string['friendshare'] = 'Friends';
$string['actions'] = 'Actions';
$string['lastactivity'] = 'Last activity';
$string['lastaction'] = 'Last action';
$string['lastactiontime'] = 'Last action time';
$string['removefilter'] = 'Remove filter';
$string['collaborationdate'] = 'w.c. %s';
$string['needadvancedanalytics'] = 'Advanced analytics need to be enabled for this report. Please see the "Logging settings" under "Configure site" for more information.';
......
......@@ -4596,8 +4596,20 @@ function sanitize_preferredname($value) {
return $value;
}
function generate_csv($data, $csvfields) {
$csv = join(',', $csvfields) . "\n";
function generate_csv($data, $csvfields, $csvheaders = array()) {
$csvfieldsheaders = $csvfields;
if (!empty($csvheaders)) {
// Allow for more human readable headers for csv columns
// You can define this for any number of columns.
// @TODO: allow lang string translations
foreach ($csvfieldsheaders as $k => $v) {
if (array_key_exists($v, $csvheaders)) {
$csvfieldsheaders[$k] = $csvheaders[$v];
}
}
}
$csv = join(',', $csvfieldsheaders) . "\n";
foreach ($data as $row) {
if (is_object($row)) {
$row = (array) $row;
......
This diff is collapsed.
......@@ -139,6 +139,14 @@ class ElasticsearchType_event_log extends ElasticsearchType {
$record->firstname = $user->firstname;
$record->lastname = $user->lastname;
$record->displayname = $user->preferredname;
// Need to adjust the view shared to group so ownerid is the group id being shared to
// rather than user id being shared from as the resourceid is the view_access row id not the group id.
if ($record->event == 'updateviewaccess' && $record->resourcetype == 'group' && $record->ownertype == 'user') {
$data = json_decode($record->data);
if (isset($data->rules) && isset($data->rules->group)) {
$record->ownerid = $data->rules->group;
}
}
$record->createdbyuser = FALSE;
if ($record->usr === $record->realusr) {
// A non-masquerading event
......
......@@ -21,5 +21,6 @@ Scenario: Viewing user statistics
When I choose "Reports" from administration menu
And I press "Configure report"
And I set the select2 value "Institution One" for "reportconfigform_institution"
And I set the select2 value "People overview" for "reportconfigform_typesubtype"
And I press "Submit"
Then I should see "People overview | Institution One"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment