Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Insights generator.

Copyright: 2019 David Monllao {@link http://www.davidmonllao.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 275 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

insights_generator:: (6 methods):
  __construct()
  generate()
  notification()
  get_context_courseid()
  prediction_info()
  set_notification_language()


Class: insights_generator  - X-Ref

Insights generator.

__construct(int $modelid, \core_analytics\local\target\base $target)   X-Ref
Constructor.

param: int $modelid
param: \core_analytics\local\target\base $target

generate($samplecontexts, $predictions)   X-Ref
Generates insight notifications.

param: array                         $samplecontexts    The contexts these predictions belong to
param: \core_analytics\prediction[]  $predictions       The prediction records
return: null

notification(\context $context, \stdClass $user, \moodle_url $insighturl, string $fullmessage, string $fullmessagehtml)   X-Ref
Generates a insight notification for the user.

param: \context    $context
param: \stdClass   $user
param: \moodle_url $insighturl    The insight URL
param: string      $fullmessage
param: string      $fullmessagehtml
return: null

get_context_courseid(\context $context)   X-Ref
Returns the course context of the provided context reading an internal cache first.

param: \context $context
return: int

prediction_info(\core_analytics\prediction $prediction, \context $context, \stdClass $user)   X-Ref
Extracts info from the prediction for display purposes.

param: \core_analytics\prediction   $prediction
param: \context                     $context
param: \stdClass                    $user
return: array Three items array with formats [\moodle_url, string, string]

set_notification_language($user)   X-Ref
Sets the session language to the language used by the notification receiver.

param: \stdClass $user The user who will receive the message
return: null