Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 39 and 402]

User profile field condition.

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

Defines 1 class


Class: condition  - X-Ref

User profile field condition.

__construct($structure)   X-Ref
Constructor.

param: \stdClass $structure Data structure from JSON decode

save()   X-Ref
No description

get_json($customfield, $fieldname, $operator, $value = 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: bool $customfield True if this is a custom field
param: string $fieldname Field name
param: string $operator Operator name (OP_xx constant)
param: string|null $value Value (not required for some operator types)
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_debug_string()   X-Ref
No description

is_field_condition_met($operator, $uservalue, $value)   X-Ref
Returns true if a field meets the required conditions, false otherwise.

param: string $operator the requirement/condition
param: string $uservalue the user's value
param: string $value the value required
return: boolean True if conditions are met

get_standard_profile_fields()   X-Ref
Return list of standard user profile fields used by the condition

return: string[]

get_custom_profile_fields()   X-Ref
Gets data about custom profile fields. Cached statically in current
request.

This only includes fields which can be tested by the system (those whose
data is cached in $USER object) - basically doesn't include textarea type
fields.

return: array Array of records indexed by shortname

wipe_static_cache()   X-Ref
Wipes the static cache (for use in unit tests).


get_cached_user_profile_field($userid)   X-Ref
Return the value for a user's profile field

param: int $userid User ID
return: string|bool Value, or false if user does not have a value for this field

is_applied_to_user_lists()   X-Ref
No description

filter_user_list(array $users, $not, \core_availability\info $info,\core_availability\capability_checker $checker)   X-Ref
No description

get_condition_sql($field, $field2 = null, $istext = false)   X-Ref
Gets SQL to match a field against this condition. The second copy of the
field is in case you're using variables for the field so that it needs
to be two different ones.

param: string $field Field name
param: string $field2 Second copy of field name (default same).
param: boolean $istext Any of the fields correspond to a TEXT column in database (true) or not (false).
return: array Array of SQL and parameters

get_user_list_sql($not, \core_availability\info $info, $onlyactive)   X-Ref
No description