Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
/my/ -> lib.php (source)

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

My Moodle -- a user's personal dashboard This file contains common functions for the dashboard and profile pages.

Author: Hubert Chathi <hubert@remote-learner.net>
Author: Olav Jordan <olav.jordan@remote-learner.net>
Copyright: 2010 Remote-Learner.net
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 334 lines (13 kb)
Included or required:0 times
Referenced: 6 times
Includes or requires: 0 files

Defines 1 class

my_syspage_block_manager:: (1 method):
  load_blocks()

Defines 1 function


Class: my_syspage_block_manager  - X-Ref

load_blocks($includeinvisible = null)   X-Ref
Load blocks using the system context, rather than the user's context.

This is needed because the My Moodle pages set the page context to the
user's context for access control, etc.  But the blocks for the system
pages are stored in the system context.

Functions that are not part of a class:

my_get_page(?int $userid, int $private = MY_PAGE_PRIVATE, string $pagename = MY_PAGE_DEFAULT)   X-Ref
For a given user, this returns the $page information for their My Moodle page

param: int|null $userid the id of the user whose page should be retrieved
param: int|null $private either MY_PAGE_PRIVATE or MY_PAGE_PUBLIC
param: string|null $pagename Differentiate between standard /my or /courses pages.

my_copy_page(int $userid,int $private = MY_PAGE_PRIVATE,string $pagetype = 'my-index',string $pagename = MY_PAGE_DEFAULT)   X-Ref
This copies a system default page to the current user

param: int $userid the id of the user whose page should be reset
param: int $private either MY_PAGE_PRIVATE or MY_PAGE_PUBLIC
param: string $pagetype either my-index or user-profile
param: string $pagename Differentiate between standard /my or /courses pages.

my_reset_page(int $userid,int $private = MY_PAGE_PRIVATE,string $pagetype='my-index',string $pagename = MY_PAGE_DEFAULT)   X-Ref
For a given user, this deletes their My Moodle page and returns them to the system default.

return: mixed system page, or false on error
param: int $userid the id of the user whose page should be reset
param: int $private either MY_PAGE_PRIVATE or MY_PAGE_PUBLIC
param: string $pagetype either my-index or user-profile
param: string $pagename Differentiate between standard /my or /courses pages.

my_reset_page_for_all_users(int $private = MY_PAGE_PRIVATE,string $pagetype = 'my-index',?progress_bar $progressbar = null,string $pagename = MY_PAGE_DEFAULT)   X-Ref
Resets the page customisations for all users.

return: void
param: int $private Either MY_PAGE_PRIVATE or MY_PAGE_PUBLIC.
param: string $pagetype Either my-index or user-profile.
param: progress_bar|null $progressbar A progress bar to update.
param: string $pagename Differentiate between standard /my or /courses pages.