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.

Differences Between: [Versions 39 and 400]

Condition on grades of current user.

Copyright: 2014 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 319 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: condition  - X-Ref

Condition on grades of current user.

__construct($structure)   X-Ref
Constructor.

param: \stdClass $structure Data structure from JSON decode

save()   X-Ref
No description

get_json($gradeitemid, $min = null, $max = null)   X-Ref
Returns a JSON object which corresponds to a condition of this type.

Intended for unit testing, as normally the JSON values are constructed
by JavaScript code.

return: stdClass Object representing condition
param: int $gradeitemid Grade item id
param: number|null $min Min grade (or null if no min)
param: number|null $max Max grade (or null if no max)

is_available($not, \core_availability\info $info, $grabthelot, $userid)   X-Ref
No description

get_description($full, $not, \core_availability\info $info)   X-Ref
No description

get_description_callback_value(\course_modinfo $modinfo, \context $context, array $params)   X-Ref
Gets the grade name at display time.

return: string Text value
param: \course_modinfo $modinfo Modinfo
param: \context $context Context
param: string[] $params Parameters (just grade item id)

get_debug_string()   X-Ref
No description

get_cached_grade_name($courseid, $gradeitemid)   X-Ref
Obtains the name of a grade item, also checking that it exists. Uses a
cache. The name returned is suitable for display.

return: string Grade name or empty string if no grade with that id
param: int $courseid Course id
param: int $gradeitemid Grade item id

get_cached_grade_score($gradeitemid, $courseid,$grabthelot=false, $userid=0)   X-Ref
Obtains a grade score. Note that this score should not be displayed to
the user, because gradebook rules might prohibit that. It may be a
non-final score subject to adjustment later.

return: float Grade score as a percentage in range 0-100 (e.g. 100.0
param: int $gradeitemid Grade item ID we're interested in
param: int $courseid Course id
param: bool $grabthelot If true, grabs all scores for current user on
param: int $userid Set if requesting grade for a different user (does

update_after_restore($restoreid, $courseid, \base_logger $logger, $name)   X-Ref
No description

update_dependency_id($table, $oldid, $newid)   X-Ref
No description