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

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.

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)
return: stdClass Object representing condition

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.

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

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.

param: int $courseid Course id
param: int $gradeitemid Grade item id
return: string Grade name or empty string if no grade with that 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.

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
return: float Grade score as a percentage in range 0-100 (e.g. 100.0

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

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