Skip to content

Commit

Permalink
MDL-64477 analytics: Include new stats in site registration info
Browse files Browse the repository at this point in the history
These four new figures will be submitted to the Moodle sites directory
as a part of the site registration.
  • Loading branch information
mudrd8mz committed Mar 11, 2019
1 parent 5e9b091 commit 6cae6c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lang/en/hub.php
Expand Up @@ -29,6 +29,10 @@
$string['advertiseon'] = 'Share this course on {$a}';
$string['readvertiseon'] = 'Update advertising information on {$a}';
$string['advertisepublication_help'] = 'This course will be listed on Moodle.net as a course that people can enrol in and participate. Email-based self-registration should be enabled on the site and you need to enable self enrolment in this course.';
$string['analyticsactions'] = 'Number of actions taken on generated predictions ({$a})';
$string['analyticsactionsnotuseful'] = 'Number of actions marking a prediction as not useful ({$a})';
$string['analyticsenabledmodels'] = 'Number of enabled prediction models ({$a})';
$string['analyticspredictions'] = 'Number of generated predictions ({$a})';
$string['audience'] = 'Audience';
$string['audience_help'] = 'Select the intended audience for the course.';
$string['audienceeducators'] = 'Educators';
Expand Down
12 changes: 12 additions & 0 deletions lib/classes/hub/registration.php
Expand Up @@ -56,6 +56,8 @@ class registration {
'commnews', // Receive communication news. This was added in 3.4 and is "On" by default. Admin must confirm or opt-out.
'mobileservicesenabled', 'mobilenotificationsenabled', 'registereduserdevices', 'registeredactiveuserdevices' // Mobile stats added in 3.4.
],
// Analytics stats added in Moodle 3.7.
2019022200 => ['analyticsenabledmodels', 'analyticspredictions', 'analyticsactions', 'analyticsactionsnotuseful'],
];

/** @var Site privacy: not displayed */
Expand Down Expand Up @@ -196,6 +198,12 @@ public static function get_site_info($defaults = []) {
}
}

// Analytics related data follow.
$siteinfo['analyticsenabledmodels'] = \core_analytics\stats::enabled_models();
$siteinfo['analyticspredictions'] = \core_analytics\stats::predictions();
$siteinfo['analyticsactions'] = \core_analytics\stats::actions();
$siteinfo['analyticsactionsnotuseful'] = \core_analytics\stats::actions_not_useful();

// IMPORTANT: any new fields in siteinfo have to be added to the constant CONFIRM_NEW_FIELDS.

return $siteinfo;
Expand Down Expand Up @@ -236,6 +244,10 @@ public static function get_stats_summary($siteinfo) {
'mobilenotificationsenabled' => get_string('mobilenotificationsenabled', 'hub', $mobilenotificationsenabled),
'registereduserdevices' => get_string('registereduserdevices', 'hub', $siteinfo['registereduserdevices']),
'registeredactiveuserdevices' => get_string('registeredactiveuserdevices', 'hub', $siteinfo['registeredactiveuserdevices']),
'analyticsenabledmodels' => get_string('analyticsenabledmodels', 'hub', $siteinfo['analyticsenabledmodels']),
'analyticspredictions' => get_string('analyticspredictions', 'hub', $siteinfo['analyticspredictions']),
'analyticsactions' => get_string('analyticsactions', 'hub', $siteinfo['analyticsactions']),
'analyticsactionsnotuseful' => get_string('analyticsactionsnotuseful', 'hub', $siteinfo['analyticsactionsnotuseful']),
];

foreach ($senddata as $key => $str) {
Expand Down

0 comments on commit 6cae6c9

Please sign in to comment.