Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

class block_recent_activity

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 299 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

block_recent_activity:: (8 methods):
  init()
  get_content()
  get_timestart()
  get_recent_enrolments()
  get_structural_changes()
  get_modules_recent_activity()
  applicable_formats()
  migrate_logs()


Class: block_recent_activity  - X-Ref

class block_recent_activity

init()   X-Ref
Initialises the block


get_content()   X-Ref
Returns the content object

return: stdObject

get_timestart()   X-Ref
Returns the time since when we want to show recent activity

For guest users it is 2 days, for registered users it is the time of last access to the course

return: int

get_recent_enrolments()   X-Ref
Returns all recent enrolments.

This function previously used get_recent_enrolments located in lib/deprecatedlib.php which would
return an empty array which was identified in MDL-36993. The use of this function outside the
deprecated lib was removed in MDL-40649.

return: array array of entries from {user} table

get_structural_changes()   X-Ref
Returns list of recent changes in course structure

It includes adding, editing or deleting of the resources or activities
Excludes changes on modules without a view link (i.e. labels), and also
if activity was both added and deleted

return: array array of changes. Each element is an array containing attributes:

get_modules_recent_activity()   X-Ref
Returns list of recent activity within modules

For each used module type executes callback MODULE_print_recent_activity()

return: array array of pairs moduletype => content

applicable_formats()   X-Ref
Which page types this block may appear on.

return: array page-type prefix => true/false.

migrate_logs($course)   X-Ref
Migrates entries from table {log} into {block_recent_activity}

We only migrate logs for the courses that actually have recent activity
block and that are being viewed within COURSE_MAX_RECENT_PERIOD time
after the upgrade.

The presence of entry in {block_recent_activity} with the cmid=0 indicates
that the course needs log migration. Those entries were installed in
db/upgrade.php when the table block_recent_activity was created.

param: stdClass $course