Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

User profile field condition.

Copyright: 2014 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 618 lines (25 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_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