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 401 and 403]

Helper class for gradehistory report.

Copyright: 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 226 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

helper:: (5 methods):
  init_js()
  get_users()
  get_users_count()
  get_users_sql_and_params()
  get_graders()


Class: helper  - X-Ref

Helper class for gradehistory report.

init_js($courseid, array $currentusers = null)   X-Ref
Initialise the js to handle the user selection {@link gradereport_history_user_button}.

param: int $courseid       course id.
param: array $currentusers List of currently selected users.
return: output\user_button the user select button.

get_users($context, $search = '', $page = 0, $perpage = 25)   X-Ref
Retrieve a list of users.

We're interested in anyone that had a grade history in this course. This api returns a list of such users based on various
criteria passed.

param: \context $context Context of the page where the results would be shown.
param: string $search the text to search for (empty string = find all).
param: int $page page number, defaults to 0.
param: int $perpage Number of entries to display per page, defaults to 0.
return: array list of users.

get_users_count($context, $search = '')   X-Ref
Get total number of users present for the given search criteria.

param: \context $context Context of the page where the results would be shown.
param: string $search the text to search for (empty string = find all).
return: int number of users found.

get_users_sql_and_params($context, $search = '', $count = false)   X-Ref
Get sql and params to use to get list of users.

param: \context $context Context of the page where the results would be shown.
param: string $search the text to search for (empty string = find all).
param: bool $count setting this to true, returns an sql to get count only instead of the complete data records.
return: array sql and params list

get_graders($courseid)   X-Ref
Get a list of graders.

param: int $courseid Id of course for which we need to fetch graders.
return: array list of graders.