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]

This file contains the profile_define_base class.

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

Defines 1 class


Class: profile_define_base  - X-Ref

Class profile_define_base

define_form(&$form)   X-Ref
Prints out the form snippet for creating or editing a profile field

param: moodleform $form instance of the moodleform class

define_form_common(&$form)   X-Ref
Prints out the form snippet for the part of creating or editing a profile field common to all data types.

param: moodleform $form instance of the moodleform class

define_form_specific($form)   X-Ref
Prints out the form snippet for the part of creating or editing a profile field specific to the current data type.

param: moodleform $form instance of the moodleform class

define_validate($data, $files)   X-Ref
Validate the data from the add/edit profile field form.

Generally this method should not be overwritten by child classes.

param: stdClass|array $data from the add/edit profile field form
param: array $files
return: array associative array of error messages

define_validate_common($data, $files)   X-Ref
Validate the data from the add/edit profile field form that is common to all data types.

Generally this method should not be overwritten by child classes.

param: stdClass|array $data from the add/edit profile field form
param: array $files
return: array    associative array of error messages

define_validate_specific($data, $files)   X-Ref
Validate the data from the add/edit profile field form
that is specific to the current data type

param: array $data
param: array $files
return: array    associative array of error messages

define_after_data(&$mform)   X-Ref
Alter form based on submitted or existing data

param: moodleform $mform

define_save($data)   X-Ref
Add a new profile field or save changes to current field

param: array|stdClass $data from the add/edit profile field form

define_save_preprocess($data)   X-Ref
Preprocess data from the add/edit profile field form before it is saved.

This method is a hook for the child classes to overwrite.

param: array|stdClass $data from the add/edit profile field form
return: array|stdClass processed data object

define_editors()   X-Ref
Provides a method by which we can allow the default data in profile_define_* to use an editor

This should return an array of editor names (which will need to be formatted/cleaned)

return: array

profile_reorder_fields()   X-Ref
Reorder the profile fields within a given category starting at the field at the given startorder.


profile_reorder_categories()   X-Ref
Reorder the profile categoriess starting at the category at the given startorder.


profile_delete_category($id)   X-Ref
Delete a profile category

param: int $id of the category to be deleted
return: bool success of operation

profile_delete_field($id)   X-Ref
Deletes a profile field.

param: int $id

profile_move_field($id, $move)   X-Ref
Change the sort order of a field

param: int $id of the field
param: string $move direction of move
return: bool success of operation

profile_move_category($id, $move)   X-Ref
Change the sort order of a category.

param: int $id of the category
param: string $move direction of move
return: bool success of operation

profile_list_datatypes()   X-Ref
Retrieve a list of all the available data types

return: array   a list of the datatypes suitable to use in a select statement

profile_list_categories()   X-Ref
Retrieve a list of categories and ids suitable for use in a form

return: array

profile_edit_category($id, $redirect)   X-Ref
Edit a category

param: int $id
param: string $redirect

profile_edit_field($id, $datatype, $redirect)   X-Ref
Edit a profile field.

param: int $id
param: string $datatype
param: string $redirect