[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/user/profile/ -> lib.php (summary)

Profile field API library file.

Copyright: 2007 onwards Shane Elliot {@link http://pukunui.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 664 lines (22 kb)
Included or required:0 times
Referenced: 20 times
Includes or requires: 0 files

Defines 1 class

profile_field_base:: (34 methods):
  __construct()
  profile_field_base()
  edit_field_add()
  display_data()
  edit_field()
  edit_after_data()
  edit_save_data()
  edit_validate_field()
  edit_field_set_default()
  edit_field_set_required()
  edit_field_set_locked()
  edit_save_data_preprocess()
  edit_load_user_data()
  is_user_object_data()
  set_userid()
  set_fieldid()
  load_data()
  is_visible()
  is_empty()
  is_required()
  is_locked()
  is_unique()
  is_signup_field()
  profile_load_data()
  profile_definition()
  profile_definition_after_data()
  profile_validation()
  profile_save_data()
  profile_display_fields()
  profile_signup_fields()
  profile_user_record()
  profile_get_custom_fields()
  profile_load_custom_fields()
  profile_view()


Class: profile_field_base  - X-Ref

Base class for the customisable profile fields.

__construct($fieldid=0, $userid=0)   X-Ref
Constructor method.

param: int $fieldid id of the profile from the user_info_field table
param: int $userid id of the user for whom we are displaying data

profile_field_base($fieldid=0, $userid=0)   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


edit_field_add($mform)   X-Ref
Abstract method: Adds the profile field to the moodle form class

param: moodleform $mform instance of the moodleform class

display_data()   X-Ref
Display the data for this field

return: string

edit_field($mform)   X-Ref
Print out the form field in the edit profile page

param: moodleform $mform instance of the moodleform class
return: bool

edit_after_data($mform)   X-Ref
Tweaks the edit form

param: moodleform $mform instance of the moodleform class
return: bool

edit_save_data($usernew)   X-Ref
Saves the data coming from form

param: stdClass $usernew data coming from the form
return: mixed returns data id if success of db insert/update, false on fail, 0 if not permitted

edit_validate_field($usernew)   X-Ref
Validate the form field from profile page

param: stdClass $usernew
return: string  contains error message otherwise null

edit_field_set_default($mform)   X-Ref
Sets the default data for the field in the form object

param: moodleform $mform instance of the moodleform class

edit_field_set_required($mform)   X-Ref
Sets the required flag for the field in the form object

param: moodleform $mform instance of the moodleform class

edit_field_set_locked($mform)   X-Ref
HardFreeze the field if locked.

param: moodleform $mform instance of the moodleform class

edit_save_data_preprocess($data, $datarecord)   X-Ref
Hook for child classess to process the data before it gets saved in database

param: stdClass $data
param: stdClass $datarecord The object that will be used to save the record
return: mixed

edit_load_user_data($user)   X-Ref
Loads a user object with data for this field ready for the edit profile
form

param: stdClass $user a user object

is_user_object_data()   X-Ref
Check if the field data should be loaded into the user object
By default it is, but for field types where the data may be potentially
large, the child class should override this and return false

return: bool

set_userid($userid)   X-Ref
Accessor method: set the userid for this instance

param: integer $userid id from the user table

set_fieldid($fieldid)   X-Ref
Accessor method: set the fieldid for this instance

param: integer $fieldid id from the user_info_field table

load_data()   X-Ref
Accessor method: Load the field record and user data associated with the
object's fieldid and userid


is_visible()   X-Ref
Check if the field data is visible to the current user

return: bool

is_empty()   X-Ref
Check if the field data is considered empty

return: boolean

is_required()   X-Ref
Check if the field is required on the edit profile page

return: bool

is_locked()   X-Ref
Check if the field is locked on the edit profile page

return: bool

is_unique()   X-Ref
Check if the field data should be unique

return: bool

is_signup_field()   X-Ref
Check if the field should appear on the signup page

return: bool

profile_load_data($user)   X-Ref
Loads user profile field data into the user object.

param: stdClass $user

profile_definition($mform, $userid = 0)   X-Ref
Print out the customisable categories and fields for a users profile

param: moodleform $mform instance of the moodleform class
param: int $userid id of user whose profile is being edited.

profile_definition_after_data($mform, $userid)   X-Ref
Adds profile fields to user edit forms.

param: moodleform $mform
param: int $userid

profile_validation($usernew, $files)   X-Ref
Validates profile data.

param: stdClass $usernew
param: array $files
return: array

profile_save_data($usernew)   X-Ref
Saves profile data for a user.

param: stdClass $usernew

profile_display_fields($userid)   X-Ref
Display profile fields.

param: int $userid

profile_signup_fields($mform)   X-Ref
Adds code snippet to a moodle form object for custom profile fields that
should appear on the signup page

param: moodleform $mform moodle form object

profile_user_record($userid, $onlyinuserobject = true)   X-Ref
Returns an object with the custom profile fields set for the given user

param: integer $userid
param: bool $onlyinuserobject True if you only want the ones in $USER.
return: stdClass

profile_get_custom_fields($onlyinuserobject = false)   X-Ref
Obtains a list of all available custom profile fields, indexed by id.

Some profile fields are not included in the user object data (see
profile_user_record function above). Optionally, you can obtain only those
fields that are included in the user object.

To be clear, this function returns the available fields, and does not
return the field values for a particular user.

param: bool $onlyinuserobject True if you only want the ones in $USER
return: array Array of field objects from database (indexed by id)

profile_load_custom_fields($user)   X-Ref
Load custom profile fields into user object

Please note originally in 1.9 we were using the custom field names directly,
but it was causing unexpected collisions when adding new fields to user table,
so instead we now use 'profile_' prefix.

param: stdClass $user user object

profile_view($user, $context, $course = null)   X-Ref
Trigger a user profile viewed event.

param: stdClass  $user user  object
param: stdClass  $context  context object (course or user)
param: stdClass  $course course  object



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1